:root {
  font: 15px/1.45 Inter, "Segoe UI", sans-serif;
  color: #172b46;
  background: #eef5fc;
  --blue: #087ad2;
  --muted: #5d7290;
  --line: #d9e5f3;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 1px solid #c9d9eb; background: white; color: #264566;
  border-radius: 7px; padding: 9px 14px; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #e7f4ff; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #0b83da; outline-offset: 2px;
}
button:disabled { opacity: .62; cursor: wait; }
.primary { background: var(--blue); color: #fff; border-color: transparent; font-weight: 650; }
.primary:hover { background: #0569b5; }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar {
  background: linear-gradient(160deg,#11599b,#123658 72%); color: #fff;
  padding: 24px 13px 17px; display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 700; padding: 0 6px 26px; }
.brand small { display: block; color: #bdd8f5; font-weight: 400; }
.mark { display: inline-grid; place-items: center; border-radius: 10px; width: 42px; height: 42px; color: #123f68; background: #e5f4ff; font-weight: 800; flex: none; }
nav { display: grid; gap: 5px; }
nav button, nav .button, #logout { background: transparent; color: #e8f5ff; border-color: transparent; text-align: left; }
nav button:hover, nav .button:hover, #logout:hover, nav button.active { background: #ffffff23; color: #fff; }
nav button span, nav .button span { display: inline-block; width: 25px; }
.sidebar-foot { margin-top: auto; padding: 10px 6px; border-top: 1px solid #ffffff35; display: grid; }
#logout { width: fit-content; padding-left: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 67px; background: #f9fcff; padding: 12px 29px; border-bottom: 1px solid var(--line); }
.breadcrumb { color: var(--muted); display: flex; gap: 10px; }
.breadcrumb strong { color: #263f5d; }
.content { padding: 22px 28px; }
.heading, .toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
h1, h2 { line-height: 1.15; margin: 0; letter-spacing: -.025em; }
.heading h1 { font-size: 31px; }
.segmented { display: flex; gap: 2px; background: #dce9f6; padding: 3px; border-radius: 8px; }
.segmented button { border: none; background: transparent; padding: 6px 11px; }
.segmented button.active { background: white; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #becfe3; background: white; color: #172b46; border-radius: 7px; padding: 9px 10px; }
#search { max-width: 380px; }
#activity-filter { width: auto; }
.sales-report { display: grid; gap: 16px; max-width: 1220px; }
.report-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.report-controls label { display: grid; gap: 5px; }
.report-controls select { min-width: 148px; }
.report-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.report-card, .report-panel { background: #fff; border: 1px solid #d3e1ed; border-radius: 10px; padding: 13px; min-width: 0; }
.report-card { display: grid; align-content: start; gap: 4px; }
.report-card strong { color: #174577; font-size: clamp(17px,3vw,24px); overflow-wrap: anywhere; }
.report-panel h2 { font-size: 20px; margin: 0 0 10px; }
.report-table { min-width: 575px; }
.report-table tbody th { background: #f8fbff; font-weight: 600; }
.report-record { min-width: 150px; text-align: left; white-space: normal; }
.report-issues { min-width: 230px; margin: 0; padding-left: 18px; }
.report-issues li + li { margin-top: 4px; }
.project-stale { display: block; width: fit-content; margin-top: 4px; padding: 3px 7px; border-radius: 6px; background: #fff1d5; color: #754710; }
.report-plan p, .report-note { margin: 4px 0; color: var(--muted); }
.report-plan progress { max-width: 400px; width: 100%; accent-color: #2873b9; }
@media (max-width: 650px) {
  .report-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.count, small { color: var(--muted); }
.board { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; min-height: 61vh; padding: 3px 0 16px; }
.column { width: 232px; flex: 0 0 232px; background: #e4eef8; border-radius: 9px; min-height: 235px; }
.column.over { outline: 2px dashed var(--blue); outline-offset: -2px; }
.column-head { padding: 11px 12px; display: flex; justify-content: space-between; gap: 6px; min-height: 44px; border-radius: 9px 9px 0 0; font-weight: 670; background: #bdddff; }
.tone-1 .column-head, .tone-2 .column-head { background: #abe6f1; }
.tone-3 .column-head, .tone-4 .column-head { background: #c7dcff; }
.tone-5 .column-head, .tone-6 .column-head { background: #dcd3ff; }
.tone-7 .column-head { background: #bce8ca; }
.tone-N .column-head { background: #ffe4b8; }
.tone-L .column-head { background: #f6cbd3; }
.column-total { display: block; color: var(--muted); padding: 8px 12px 1px; font-size: 13px; }
.cards { display: grid; gap: 8px; padding: 9px; }
.card { text-align: left; padding: 12px; box-shadow: 0 2px 4px #103a6410; overflow-wrap: anywhere; }
.card strong, .card small { display: block; margin-bottom: 5px; }
.card .amount { display: block; font-size: 17px; font-weight: 650; padding: 6px 0; }
.empty { color: var(--muted); margin: 6px 4px 12px; font-size: 13px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: white; }
table { border-collapse: collapse; width: 100%; min-width: 560px; text-align: left; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); }
th { background: #e1efff; color: #294767; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td button { padding: 3px 6px; text-align: left; color: #075eaa; border: 0; font-weight: 650; }
.empty-list { padding: 26px; text-align: center; background: white; border: 1px dashed #b7cee7; border-radius: 10px; color: var(--muted); }
dialog { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; border: 0; width: min(680px, 100%); max-width: 100%; max-height: 100%; height: 100%; color: inherit; background: #f2f7fc; box-shadow: -8px 0 35px #132b5140; }
dialog::backdrop { background: #0a234a70; }
#editor { min-height: 100%; }
.drawer-head, .drawer-foot { padding: 16px 22px; background: #fff; position: sticky; z-index: 1; }
.drawer-head { top: 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer-foot { bottom: 0; border-top: 1px solid var(--line); }
.drawer-foot button { margin-right: 8px; }
.danger { color: #a81f32; border-color: #dfacb4; }
.danger:hover { background: #fff0f2; }
.close { font-size: 22px; line-height: 1; }
#fields { padding: 17px 22px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field, .login-card label { display: grid; gap: 5px; align-content: start; font-weight: 600; }
.field small { font-weight: 400; }
.wide, details, .stage-info { grid-column: 1 / -1; }
textarea { min-height: 78px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 7px; min-width: 0; margin: 0; background: white; max-height: 175px; overflow: auto; }
fieldset label { display: flex; align-items: flex-start; gap: 7px; font-weight: 400; padding: 3px 0; }
input[type=checkbox] { width: auto; }
details { padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: white; }
summary { cursor: pointer; }
.stage-info { padding: 10px; background: #e0f1ff; border-radius: 7px; margin: 0; }
.stage-warnings { padding: 10px 14px 10px 28px; background: #fff1d5; color: #754710; border-radius: 7px; margin: 0; }
.error { color: #a81f32; margin: 0 0 8px; white-space: pre-line; }
.error:empty { display: none; }
.permission-row {
  display: grid; grid-template-columns: minmax(110px,1fr) auto auto minmax(150px,1.2fr);
  align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0;
}
.permissions { background: white; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.permissions .toggle { margin-top: 10px; }
.toggle, .permission-row label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 560px) {
  .permission-row { grid-template-columns: 1fr 1fr; gap: 7px; }
  .permission-row strong, .permission-row select { grid-column: 1 / -1; }
}
#notice { border: 1px solid #afd1ee; border-radius: 8px; padding: 10px 14px; background: #e4f3ff; }
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at 20% 5%,#d9edff,#edf5fd 60%); }
.login-card { width: min(100%,420px); background: white; border-radius: 16px; padding: 30px; box-shadow: 0 10px 36px #163e6b1a; display: grid; gap: 14px; }
.login-card h1 { font-size: 25px; }
.login-card p { margin: 0; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-actions .reminder-alert { background: #fff1d5; color: #754710; border-color: #ebbe70; }
.calendar-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(228px,285px); gap: 16px; align-items: start; }
.calendar-side { display: grid; gap: 14px; }
.calendar-card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.calendar-header { display: flex; gap: 6px; align-items: center; margin-bottom: 13px; }
.calendar-header h2 { font-size: 20px; flex: 1; }
.calendar-header button { padding: 5px 9px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; }
.weekday { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.calendar-day { display: grid; align-content: start; gap: 4px; text-align: left; min-height: 79px; padding: 5px; min-width: 0; }
.calendar-day-head { display: flex; justify-content: space-between; align-items: center; gap: 3px; font-weight: 650; }
.calendar-day.outside { background: #f5f8fc; color: #687c94; }
.calendar-day.today { border-color: var(--blue); }
.calendar-day[aria-pressed=true] { background: #ddecff; border-color: var(--blue); }
.calendar-count { border-radius: 10px; background: #e3eefb; padding: 0 5px; font-size: 11px; }
.calendar-chip { font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; padding: 1px 3px; background: #d4f0f7; color: #15566b; }
.calendar-chip.reminder { background: #fff0ce; color: #774b12; }
.calendar-chip.task { background: #e7edff; color: #3b4d93; }
.calendar-task-title { font-size: 14px; margin: 14px 0 5px; color: var(--muted); }
.calendar-task { border-left: 3px solid #7492e4; }
.agenda h2 { font-size: 17px; margin-bottom: 6px; }
.agenda > small { display: block; margin-bottom: 8px; }
.calendar-event { display: grid; text-align: left; width: 100%; gap: 3px; margin-top: 7px; overflow-wrap: anywhere; }
@media (max-width: 1050px) { .calendar-layout { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 550px) {
  .calendar-card { padding: 9px; }
  .calendar-grid { gap: 3px; }
  .calendar-day { min-height: 39px; padding: 4px 2px; }
  .calendar-day-head { justify-content: center; flex-wrap: wrap; font-size: 12px; }
  .calendar-chip { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .button, input, select, textarea {
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  }
  .card {
    transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  }
  @media (hover: hover) and (pointer: fine) {
    .card:hover {
      transform: translateY(-2px);
      box-shadow: 0 5px 13px #103a6422;
    }
  }
  .login-card, .section-enter {
    animation: reveal 180ms ease-out both;
  }
  dialog {
    opacity: 0;
    transform: translateX(36px);
    transition: opacity 180ms ease, transform 200ms ease,
                display 200ms allow-discrete, overlay 200ms allow-discrete;
  }
  dialog[open] {
    opacity: 1;
    transform: translateX(0);
  }
  dialog::backdrop {
    background-color: transparent;
    transition: background-color 200ms ease,
                display 200ms allow-discrete, overlay 200ms allow-discrete;
  }
  dialog[open]::backdrop { background-color: #0a234a70; }
  @starting-style {
    dialog[open] { opacity: 0; transform: translateX(36px); }
    dialog[open]::backdrop { background-color: transparent; }
  }
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 760px) {
  .workspace { display: block; }
  .sidebar { height: auto; position: static; padding: 10px; }
  .brand { padding: 0 3px 8px; }
  nav { display: flex; flex-wrap: wrap; gap: 3px; }
  nav button, nav .button { padding: 6px 8px; }
  nav button span, nav .button span { display: none; }
  .sidebar-foot { padding: 3px 4px; display: flex; justify-content: space-between; align-items: center; }
  .topbar, .content { padding: 12px; }
  .toolbar { flex-wrap: wrap; }
  #search { max-width: none; }
  #fields { grid-template-columns: 1fr; padding: 13px; }
}
