/* Кот и Пёс — ветеринарный центр. Синий и зелёный фирменного знака. */
:root {
  --page:#f3f8fa;
  --surface:#ffffff;
  --text-1:#173244;
  --text-2:#496575;
  --muted:#597482;
  --grid:#e3edf1;
  --axis:#c1d4dd;
  --border:rgba(29,80,106,.13);
  --wash:rgba(28,131,189,.05);
  --brand-blue:#1c83bd;
  --brand-green:#0b913e;
  --series-1:#1779b0;
  --series-2:#e47543;
  --series-3:#0b913e;
  --good:#278743;
  --ok-text:#28783d;
  --critical:#c34155;
  --shadow:0 2px 5px rgba(22,62,82,.035),0 10px 28px rgba(22,62,82,.045);
  --brand-on-accent:#fff;
  --brand-data-ink:#fff;
  --topbar-height:80px;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --page:#0e1b24;
  --surface:#162833;
  --text-1:#eff7fa;
  --text-2:#bdd1db;
  --muted:#94afbd;
  --grid:#2a414e;
  --axis:#4d6978;
  --border:rgba(178,213,231,.14);
  --wash:rgba(106,191,231,.075);
  --series-1:#72c4ef;
  --series-2:#ed956c;
  --series-3:#6dce8d;
  --good:#87ca91;
  --ok-text:#91d29b;
  --critical:#f095a1;
  --shadow:0 2px 5px rgba(0,0,0,.16),0 12px 32px rgba(0,0,0,.13);
  --brand-on-accent:#102a38;
  --brand-data-ink:#102a38;
}
@media(prefers-color-scheme:dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme:dark;
    --page:#0e1b24;--surface:#162833;--text-1:#eff7fa;--text-2:#bdd1db;--muted:#94afbd;
    --grid:#2a414e;--axis:#4d6978;--border:rgba(178,213,231,.14);--wash:rgba(106,191,231,.075);
    --series-1:#72c4ef;--series-2:#ed956c;--series-3:#6dce8d;
    --good:#87ca91;--ok-text:#91d29b;--critical:#f095a1;
    --shadow:0 2px 5px rgba(0,0,0,.16),0 12px 32px rgba(0,0,0,.13);
    --brand-on-accent:#102a38;--brand-data-ink:#102a38;
  }
}
body { font-family:Inter,"Segoe UI",system-ui,-apple-system,sans-serif; }
h1,h2,h3 { letter-spacing:-.025em; }
.topbar {
  height:80px; padding:0 24px; gap:24px; background:var(--surface);
  border-bottom:1px solid var(--border); box-shadow:0 2px 8px rgba(22,62,82,.025);
}
.brand { gap:10px; flex:none; min-width:0; }
.brand-logo-wrap { display:flex; align-items:center; justify-content:center; flex:none; background:#fff; border-radius:14px; overflow:hidden; }
.brand-logo { display:block; width:176px; height:66px; object-fit:contain; }
.brand-copy { display:flex; flex-direction:column; gap:1px; padding-left:14px; border-left:1px solid var(--border); }
.brand-copy strong { font-size:18px; font-weight:650; line-height:1.4; }
.brand-copy .brand-sub { display:block; padding:0; color:var(--muted); font-size:11.5px; line-height:1.4; white-space:nowrap; }
.tabs { gap:4px; margin-left:4px; padding:4px; background:var(--page); border:1px solid var(--border); border-radius:13px; }
.tab { padding:8px 14px; font-size:13px; border-radius:9px; }
.tab.on { color:var(--series-1); background:var(--surface); box-shadow:0 1px 4px rgba(22,62,82,.08); }
.topbar-actions { gap:8px; }
.topbar-actions .ghost { height:36px; border-color:transparent; }
#theme-toggle { width:36px; height:36px; border-radius:10px; }
#logout { display:inline-flex; align-items:center; justify-content:center; gap:5px; }
.logout-icon { display:none; }
.sync-btn { border-radius:10px; padding:8px 13px; }
#process-latest { background:var(--series-1); color:var(--brand-on-accent); border-color:transparent; box-shadow:0 3px 9px rgba(28,131,189,.12); }
#process-latest:hover:not(:disabled) { background:color-mix(in srgb,var(--series-1) 88%,var(--text-1)); }
#process-latest.busy { color:var(--brand-on-accent); }
/* Old cached HTML must not flash internal processing information before boot. */
.archive-status,#topics-sub,#manual-status,.bk-voice { display:none!important; }
.filters { top:var(--topbar-height); padding:14px 24px; gap:10px; background:var(--page); border-bottom-color:var(--border); }
.filters-refine { border-top:0; padding-top:0; gap:8px; }
.filters :is(input,select),.range-btn,.chip,.filters-reset { border-radius:10px; }
.filters input[type="search"]::placeholder { color:var(--muted); font-size:12.5px; }
.seg { padding:3px; gap:3px; border-radius:12px; background:var(--surface); border-color:var(--border); }
.seg button { padding:6px 13px; border:0; border-radius:8px; }
.seg button.on { background:var(--series-1); color:var(--brand-on-accent); box-shadow:0 2px 5px rgba(28,131,189,.12); }
main { padding:22px 24px 60px; margin:0; max-width:none; gap:18px; }
.tasks,.bookings { max-width:none; margin:0; }
.ov-dash,.charts { gap:18px; }
.card,.brief,.kpi { border-radius:18px; border:1px solid var(--border); box-shadow:var(--shadow); }
.card { padding:20px; }
.card-head { margin-bottom:14px; }
.card-head h2 { font-size:16px; font-weight:650; }
.card-head p { margin-top:4px; }
.ghost.small { border-color:var(--border); border-radius:8px; background:var(--surface); }
.brief { padding:18px 22px; border-left:3px solid var(--series-1); background:var(--surface); }
.brief-head h2 { font-size:18px; font-weight:650; }
.brief p { font-size:13px; }
.kpis { gap:12px; }
.kpi { padding:18px; gap:6px; }
.kpi .k-label { font-size:12px; font-weight:550; }
.kpi .k-value { font-size:32px; font-weight:650; letter-spacing:-.035em; }
.kpi.hero { background:color-mix(in srgb,var(--series-1) 4%,var(--surface)); }
.kpi.hero .k-value { color:var(--series-1); font-size:44px; }
.kpi .k-note { font-size:11.5px; line-height:1.5; }
.row { padding-top:15px; padding-bottom:15px; }
.row .who { font-weight:550; }
.row .who .sub { font-weight:400; }
.row .sum .none { font-style:normal; }
.tag { border-radius:7px; }
.tasks-head h2 { font-size:20px; }
.task,.tasks-cal,.task-form,.bk-form,.bk-pop,.day-view,.bk-modal-card { border-radius:16px; }
.task { box-shadow:0 2px 6px rgba(22,62,82,.03); }
.task-form,.bk-modal-card { box-shadow:var(--shadow); }
.bcal,.tasks-cal { background:var(--surface); }
.cal-day.on,.cal-day:not(.overdue) .cal-count,.bcal-day.today .bcal-num,.bcal-add:hover { color:var(--brand-on-accent); }
.cal-day.on .cal-count { background:var(--surface); color:var(--series-1); }
.bcal-day { border-color:var(--border); }
.bchip { border-radius:7px; }
.drawer { background:var(--surface); box-shadow:-12px 0 48px rgba(15,39,52,.12); }
.drawer-head { padding-top:19px; padding-bottom:19px; }
.drawer-head { flex:none; }
.drawer-body { min-height:0; flex:1; align-content:start; overscroll-behavior:contain; }
.transcript-roles { border-radius:12px; background:var(--page); }
:is(input,select,textarea,button,a):focus-visible { outline:2px solid var(--series-1); outline-offset:3px; }
:is(input,select,textarea) { accent-color:var(--series-1); }
.login { background:var(--page); }
.login-card { max-width:390px; padding:32px; border-radius:24px; gap:10px; box-shadow:0 4px 8px rgba(22,62,82,.03),0 20px 64px rgba(22,62,82,.08); }
.login-logo { display:block; width:240px; height:90px; max-width:100%; object-fit:contain; margin:0 auto 16px; background:#fff; border-radius:16px; }
.login-card h1 { font-size:25px; font-weight:650; }
.login-card p { line-height:1.6; font-size:13px; margin-bottom:14px; }
.login-card input { border-radius:11px; padding:12px 13px; background:var(--page); }
.login-card button { background:var(--series-1); color:var(--brand-on-accent); padding:12px; border-radius:11px; }
.bottomnav { background:var(--surface); }
.bn-tab.on { color:var(--series-1); }
@media(min-width:641px) and (max-width:1120px) {
  .topbar { gap:14px; padding-left:18px; padding-right:18px; }
  .brand-copy { display:none; }
  .brand-logo { width:168px; height:63px; }
}
@media(min-width:641px) and (max-width:780px) {
  .topbar { gap:8px; }
  .brand-logo { width:144px; height:54px; }
  .tab { padding:8px 10px; }
  #process-latest .sync-label { display:none; }
}
@media(max-width:640px) {
  :root { --topbar-height:72px; }
  .topbar { height:72px; padding:0 12px 0 5px; gap:8px; }
  .brand { gap:0; }
  .brand-logo { width:160px; height:60px; }
  .brand-logo-wrap { border-radius:12px; }
  .brand-copy { display:none; }
  .tabs { display:none; }
  .topbar-actions { gap:6px; }
  .topbar-actions .ghost,#theme-toggle { width:36px; height:36px; padding:0; }
  .topbar-actions .sync-btn { width:36px; height:36px; padding:0; justify-content:center; }
  .topbar-actions .sync-label,#logout span { display:none; }
  .logout-icon { display:block; }
  .archive-status { padding:9px 14px 3px; gap:3px; font-size:11px; }
  #archive-sync { margin-left:0; }
  .filters { padding:9px 12px; top:var(--topbar-height); position:static; }
  .seg { padding:3px; }
  .seg button { padding:8px 5px; }
  main { padding:14px 12px 96px; gap:13px; }
  .ov-dash,.charts { gap:13px; }
  .card,.brief,.kpi { border-radius:16px; }
  .card { padding:15px; }
  .card-head h2 { font-size:15px; }
  .brief { padding:15px 16px; }
  .brief-head h2 { font-size:17px; }
  .brief p { font-size:12.5px; }
  .kpis { gap:9px; }
  .kpi { padding:13px; gap:4px; }
  .kpi .k-value { font-size:26px; }
  .kpi.hero .k-value { font-size:32px; }
  .kpi .k-note { font-size:11px; }
  .list-card { background:transparent; border:0; padding:0; box-shadow:none; }
  .row { border-radius:15px; box-shadow:0 2px 7px rgba(22,62,82,.035); }
  .ov-tabs { padding:4px; background:color-mix(in srgb,var(--series-1) 6%,var(--surface)); border-radius:12px; }
  .ov-tab.on { color:var(--series-1); background:var(--surface); box-shadow:0 1px 5px rgba(22,62,82,.07); }
  .bottomnav { border-top-color:var(--border); box-shadow:0 -4px 20px rgba(22,62,82,.035); }
  .login-card { padding:26px; border-radius:22px; }
  .login-card h1 { font-size:23px; }
}
@media(max-width:350px) {
  .brand-logo { width:140px; height:52.5px; }
  .topbar-actions { gap:4px; }
  .topbar-actions .ghost,.topbar-actions .sync-btn,#theme-toggle { width:32px; height:34px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; transition-duration:.01ms!important; } }

/* Field widths may flex within a row; field heights must not flex in a column. */
.bk-form > * { flex-shrink:0; }
.bk-form > input { flex:0 0 auto; }
.bk-form :is(input,select),.task-form :is(input,select) { height:40px; min-height:40px; }
.bk-form-row,.task-form-row { align-items:flex-start; }
.bk-form textarea,.task-form textarea { flex:0 0 auto; height:72px; min-height:72px; resize:vertical; }
.bk-modal-card { max-height:calc(100dvh - 40px); overflow-y:auto; }
@media(max-width:640px) {
  .bk-modal-card { max-height:90dvh; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
  .bk-form-row > input[type="text"] { flex-basis:140px; }
}

@media(max-width:640px) {
  #app { padding-bottom:var(--bottomnav-height,calc(66px + env(safe-area-inset-bottom))); }
  .bookings {
    height:calc(100dvh - var(--topbar-height,72px) - var(--bottomnav-height,calc(66px + env(safe-area-inset-bottom))) - var(--manual-status-height,0px));
    min-height:0;
  }
  .ov-tabs { top:var(--topbar-height,72px); }
}

@media(min-width:641px) and (max-width:780px) {
  #bk-add-btn { width:36px; height:36px; padding:0; justify-content:center; flex:none; }
  #bk-add-btn .sync-label,#logout span { display:none; }
  #logout { width:36px; padding:0; flex:none; }
  #logout .logout-icon { display:block; }
}

/* Keep the list and the selected recording in separate desktop columns. */
:root { --call-pane-width:clamp(420px,42vw,760px); }
html.call-modal-open { overflow:hidden; overscroll-behavior:none; }
#overview-view { container:call-workspace / inline-size; }
.row.is-selected {
  background:color-mix(in srgb,var(--series-1) 9%,var(--surface));
  box-shadow:inset 3px 0 var(--series-1);
}
.row.is-selected:hover { background:color-mix(in srgb,var(--series-1) 13%,var(--surface)); }
@media(min-width:961px) {
  body.call-pane-open :is(#overview-view,#tasks-view,#bookings-view,#clients-view,#manual-status) {
    margin-right:var(--call-pane-width);
  }
  body.call-pane-open .drawer {
    top:var(--topbar-height); width:var(--call-pane-width);
    box-shadow:none; border-left:1px solid var(--axis);
  }
  body.call-pane-open .drawer-backdrop { display:none; }
  body.call-pane-open .tasks-cal-wrap { top:calc(var(--topbar-height) + 12px); }
}

/* Customer history keeps clinic, grooming and phone evidence distinguishable. */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.crm-view { padding:24px 28px 64px; min-width:0; }
.crm-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
.crm-heading h1 { font-size:24px; letter-spacing:-.035em; }
.crm-heading p { margin:5px 0 0; font-size:13px; }
.crm-workspace { display:grid; grid-template-columns:minmax(280px,350px) minmax(0,1fr); gap:24px; align-items:start; }
.crm-directory,.crm-detail { min-width:0; }
.crm-directory { position:sticky; top:calc(var(--topbar-height) + 18px); }
#crm-search { width:100%; min-height:44px; padding:11px 14px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.crm-filters { display:flex; flex-wrap:wrap; gap:5px; margin:12px 0; }
.crm-filters button,.crm-timeline-filters button { border:1px solid transparent; border-radius:20px; padding:7px 11px; background:transparent; color:var(--text-2); font-size:12px; }
.crm-filters button.on,.crm-timeline-filters button.on { background:color-mix(in srgb,var(--series-1) 10%,var(--surface)); border-color:color-mix(in srgb,var(--series-1) 18%,var(--border)); color:var(--series-1); font-weight:650; }
.crm-list-caption { min-height:18px; margin:0 0 8px; }
.crm-client-list { display:grid; gap:8px; max-height:calc(100dvh - var(--topbar-height) - 240px); overflow-y:auto; scrollbar-gutter:stable; padding:2px; }
.crm-client-card { width:100%; display:grid; gap:7px; padding:15px; text-align:left; border:1px solid var(--border); border-radius:14px; background:var(--surface); color:var(--text-1); transition:border-color .15s; overflow-wrap:anywhere; }
.crm-client-card:hover { border-color:color-mix(in srgb,var(--series-1) 45%,var(--border)); }
.crm-client-card.on { border-color:var(--series-1); background:color-mix(in srgb,var(--series-1) 5%,var(--surface)); box-shadow:inset 3px 0 var(--series-1); }
.crm-client-card strong { font-size:14px; font-weight:650; }
.crm-card-phone { font-size:12px; color:var(--text-2); }
.crm-card-pets { font-size:12px; color:var(--text-2); }
.crm-card-last { font-size:11px; color:var(--muted); }
.crm-more { width:100%; margin-top:10px; }
.crm-detail { display:grid; gap:18px; outline:none; }
.crm-choose { padding:50px 28px; text-align:center; border:1px dashed var(--border); border-radius:18px; }
.crm-profile-head,.crm-section { padding:22px; border:1px solid var(--border); border-radius:18px; background:var(--surface); }

/* Exact task/booking opened from a conversation. Ordinary calendars stay intact. */
.workflow-target-view > :not(.wf-target) { display:none !important; }
.wf-target { min-width:0; width:100%; scroll-margin-top:calc(var(--topbar-height) + 18px); }
.wf-target-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.wf-target-head h2 { margin:0; font-size:22px; color:var(--text-1); }
.wf-target-head h2:focus { outline:none; }
.wf-target-navigation { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.wf-target-card { width:100%; box-sizing:border-box; border:2px solid var(--series-1) !important; padding:24px !important; background:var(--surface); box-shadow:0 0 0 4px color-mix(in srgb,var(--series-1) 7%,transparent); }
.wf-target-card .wf-card-head h4 { font-size:19px; line-height:1.4; }
.wf-target-card .wf-evidence { max-width:90ch; }
.wf-target-card .wf-detail,.wf-target-card blockquote { line-height:1.6; overflow-wrap:anywhere; }
.wf-target-error { color:var(--text-1); margin:18px 0; }
.wf-open-label { color:var(--series-1); font-size:12px; margin-top:4px; }
@media(max-width:640px) {
  .wf-target-head { align-items:flex-start; flex-direction:column; gap:12px; }
  .wf-target-head h2 { font-size:20px; }
  .wf-target-navigation { width:100%; gap:10px; }
  .wf-target-navigation button { min-height:42px; }
  .wf-target-card { padding:17px !important; }
  .wf-target-card .wf-card-head { flex-wrap:wrap; }
  .wf-target-card .wf-card-head h4 { font-size:17px; }
}
.crm-profile-head { display:grid; gap:12px; background:linear-gradient(135deg,color-mix(in srgb,var(--series-1) 5%,var(--surface)),var(--surface) 65%); }
.crm-person-heading { display:flex; gap:14px; align-items:flex-start; }
.crm-avatar { display:grid; place-items:center; flex:none; width:46px; height:46px; border-radius:15px; font-size:19px; font-weight:650; color:var(--series-1); background:color-mix(in srgb,var(--series-1) 11%,var(--surface)); }
.crm-person-main { min-width:0; }
.crm-person-main h2 { font-size:21px; line-height:1.3; overflow-wrap:anywhere; }
.crm-phone-link { display:inline-block; margin-top:5px; color:var(--text-2); font-size:13px; text-decoration:none; }
.crm-phone-link:hover { text-decoration:underline; }
.crm-source-badges { display:flex; flex-wrap:wrap; gap:6px; }
.crm-source-badge { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:7px; font-size:10.5px; font-weight:600; line-height:1.4; color:var(--text-2); background:var(--wash); }
.crm-source-badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }
.crm-source-vetmanager { color:var(--series-1); background:color-mix(in srgb,var(--series-1) 9%,var(--surface)); }
.crm-source-yclients { color:var(--ok-text); background:color-mix(in srgb,var(--series-3) 9%,var(--surface)); }
.crm-section h3 { font-size:15px; margin-bottom:14px; }
.crm-pets { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr)); gap:10px; }
.crm-pet { display:grid; gap:6px; align-content:start; padding:13px; border:1px solid var(--border); border-radius:12px; min-width:0; }
.crm-pet .crm-source-badge { justify-self:start; }
.crm-pet strong { font-size:14px; }
.crm-pet p { margin:4px 0 8px; color:var(--text-2); font-size:12px; overflow-wrap:anywhere; }
.crm-pet-note { color:var(--muted); }
.crm-source-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,265px),1fr)); gap:12px; }
.crm-source-summary { border:1px solid var(--border); border-radius:13px; padding:15px; min-width:0; }
.crm-source-summary h4 { margin:0 0 12px; font-size:13px; }
.crm-source-stats { display:grid; grid-template-columns:1fr 1fr; gap:14px 10px; margin:0; }
.crm-source-stats div { min-width:0; }
.crm-source-stats dt { font-size:11px; color:var(--muted); margin-bottom:3px; }
.crm-source-stats dd { margin:0; font-size:14px; font-weight:600; overflow-wrap:anywhere; }
.crm-source-note { margin:10px 0 0; color:var(--muted); font-size:11px; }
.crm-identity { font-size:12px; margin:7px 0 0; color:var(--text-2); }
.crm-upcoming-list { display:grid; gap:10px; }
.crm-upcoming { display:grid; grid-template-columns:52px minmax(0,1fr); gap:13px; padding:13px; background:color-mix(in srgb,var(--series-1) 4%,var(--surface)); border:1px solid var(--border); border-radius:12px; }
.crm-event-date { text-align:center; border-right:1px solid var(--border); padding-right:12px; color:var(--series-1); font-size:12px; }
.crm-event-date strong { display:block; font-size:21px; line-height:1.1; }
.crm-event-content { min-width:0; }
.crm-event-content h4 { font-size:13px; margin:0 0 4px; font-weight:650; overflow-wrap:anywhere; }
.crm-event-content p { margin:4px 0; font-size:12px; color:var(--text-2); overflow-wrap:anywhere; white-space:pre-line; }
.crm-event-meta { display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; margin-top:7px; font-size:11px; color:var(--muted); }
.crm-status-uncertain,.crm-compact-visits .crm-status-uncertain { color:var(--series-2); font-weight:600; }
.crm-origin-link { font-size:11px; color:var(--series-1); padding:0; background:none; border:0; text-decoration:underline; text-underline-offset:3px; }
.crm-timeline-filters { display:flex; flex-wrap:wrap; gap:4px; margin:-3px 0 18px; }
.crm-timeline { display:grid; gap:0; }
.crm-timeline-event { position:relative; padding:0 0 20px 20px; border-left:1px solid var(--border); margin-left:4px; }
.crm-timeline-event::before { content:''; position:absolute; left:-4px; top:5px; width:7px; height:7px; border-radius:50%; background:var(--series-1); box-shadow:0 0 0 3px var(--surface); }
.crm-timeline-event[data-source="yclients"]::before { background:var(--series-3); }
.crm-timeline-event[data-source="mango"]::before { background:var(--muted); }
.crm-timeline-event:last-child { padding-bottom:0; border-left-color:transparent; }
.crm-timeline-date { display:block; font-size:11px; color:var(--muted); margin-bottom:5px; }
.crm-timeline-more { display:block; margin:14px auto 0; }
.crm-empty { padding:22px 10px; text-align:center; color:var(--muted); font-size:13px; }
.crm-back { display:none; justify-self:start; min-height:42px; }
.crm-call-context { padding:14px; border:1px solid var(--border); border-radius:13px; display:grid; gap:10px; background:color-mix(in srgb,var(--series-1) 3%,var(--surface)); }
.crm-call-context h3 { margin:0; font-size:14px; }
.crm-call-context .crm-pets { gap:6px; }
.crm-call-context .crm-pet { padding:9px; background:var(--surface); }
.crm-call-context .crm-pet p { margin-bottom:4px; }
.crm-compact-visits { display:grid; gap:6px; }
.crm-compact-visits p { margin:0; color:var(--text-2); font-size:12px; }
.crm-call-open { justify-self:start; font-size:12px; min-height:36px; }
.client-block > .crm-call-context { border:0; border-bottom:1px solid var(--border); border-radius:10px 10px 0 0; }
.crm-event-services { margin-top:8px; font-size:12px; color:var(--text-2); }
.crm-event-services summary { cursor:pointer; padding:4px 0; color:var(--text-2); }
.crm-source-dialog { color:var(--text-1); background:var(--surface); width:min(600px,calc(100vw - 32px)); max-height:calc(100dvh - 48px); margin:auto; padding:0; border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); }
.crm-source-dialog::backdrop { background:rgba(10,25,34,.38); }
.crm-source-dialog-head { display:flex; align-items:center; gap:16px; padding:16px 20px; border-bottom:1px solid var(--border); }
.crm-source-dialog-head h2 { min-width:0; flex:1; font-size:16px; overflow-wrap:anywhere; }
.crm-source-dialog-head button { flex:none; min-width:38px; min-height:38px; }
.crm-source-dialog-body { display:grid; gap:14px; padding:20px; }
.crm-source-fields { display:grid; gap:12px; margin:0; }
.crm-source-fields dt { color:var(--muted); font-size:11px; margin-bottom:3px; }
.crm-source-fields dd { margin:0; font-size:13px; white-space:pre-line; overflow-wrap:anywhere; }
@media(min-width:641px) and (max-width:1120px) {
  .crm-view { padding:20px 18px 60px; }
  .crm-workspace { grid-template-columns:minmax(235px,30%) minmax(0,1fr); gap:16px; }
}
@media(min-width:961px) {
  body.call-pane-open .crm-workspace { grid-template-columns:minmax(0,1fr); }
  body.call-pane-open .crm-directory { position:static; }
  body.call-pane-open .crm-client-list { max-height:260px; }
}
@media(max-width:640px) {
  .crm-view { padding:18px 12px 28px; }
  .crm-heading { margin-bottom:16px; }
  .crm-heading h1 { font-size:22px; }
  .crm-heading p { font-size:12px; }
  .crm-workspace { display:block; }
  .crm-directory { position:static; }
  .crm-client-list { max-height:none; overflow:visible; padding:0; }
  .crm-client-card { min-height:115px; padding:15px; }
  .crm-filters { gap:5px; }
  .crm-filters button { min-height:40px; }
  .crm-workspace:not(.has-selection) .crm-detail { display:none; }
  .crm-workspace.has-selection .crm-directory { display:none; }
  .crm-detail { gap:13px; }
  .crm-back { display:block; }
  .crm-profile-head,.crm-section { padding:16px; border-radius:15px; }
  .crm-person-main h2 { font-size:19px; }
  .crm-pets { grid-template-columns:1fr; }
  .crm-source-cards { grid-template-columns:1fr; }
  .crm-timeline-filters button { min-height:40px; }
  .crm-origin-link { display:inline-flex; align-items:center; min-height:32px; }
  .crm-call-open { min-height:42px; }
}
@container call-workspace (max-width:900px) {
  .charts { grid-template-columns:minmax(0,1fr); }
  .kpis { grid-template-columns:repeat(auto-fit,minmax(148px,1fr)); }
  .kpi.hero .k-value { font-size:38px; }
  .row { grid-template-columns:92px minmax(0,1fr); row-gap:4px; }
  .row .dir,.row .who,.row .meta { grid-column:2; justify-content:flex-start; }
  .row .sum { grid-column:1 / -1; }
  .row .meta { flex-wrap:wrap; white-space:normal; }
  .filters input[type="search"] { min-width:0; flex:1 1 100%; }
  .card-head { flex-wrap:wrap; }
  .card-tools { flex-wrap:wrap; max-width:100%; }
  .legend { flex-wrap:wrap; }
}
@container call-workspace (max-width:640px) {
  .kpi.hero .k-value { font-size:32px; }
  .card-tools { margin-left:0; }
}
@media(max-width:640px) {
  .drawer { left:0; right:0; width:100%; max-width:100%; }
}

/* WhatsApp connections share the clinic's blue/green interface. */
.wa-nav-dot { width:7px; height:7px; border-radius:50%; background:var(--series-2); margin-left:5px; display:inline-block; }
.bn-tab .wa-nav-dot { position:absolute; top:7px; left:calc(50% + 13px); margin:0; }
.wa-banner { display:flex; align-items:center; gap:12px; margin:14px 24px 0; padding:12px 16px; border:1px solid color-mix(in srgb,var(--series-2) 35%,var(--border)); border-radius:12px; background:color-mix(in srgb,var(--series-2) 9%,var(--surface)); color:var(--text-1); font-size:13px; line-height:1.5; }
.wa-banner-symbol { display:grid; place-items:center; flex:none; width:24px; height:24px; border:1.5px solid var(--series-2); color:var(--series-2); border-radius:50%; font-weight:700; }
#wa-banner-text { flex:1; min-width:0; overflow-wrap:anywhere; }
.wa-banner button { flex:none; min-height:38px; }
.wa-view { padding:24px 24px 60px; }
.wa-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; }
.wa-heading h1 { margin:0; font-size:26px; }
.wa-heading p { margin:5px 0 0; font-size:13px; }
.wa-heading > button { min-height:40px; }
.wa-add-form { display:flex; flex-wrap:wrap; align-items:flex-end; gap:14px; padding:20px; margin-bottom:28px; border:1px solid var(--border); border-radius:16px; background:var(--surface); }
.wa-add-form > div { flex:1; max-width:420px; min-width:200px; }
.wa-add-form label { display:block; margin-bottom:8px; color:var(--text-2); font-size:12px; }
.wa-add-form input { width:100%; box-sizing:border-box; min-height:43px; padding:10px 12px; background:var(--page); border:1px solid var(--axis); color:var(--text-1); border-radius:9px; font:inherit; font-size:13px; }
.wa-add-form > button { min-height:43px; background:var(--series-1); color:var(--brand-on-accent); border-color:transparent; }
.wa-error { width:100%; margin:0; color:var(--critical); line-height:1.5; font-size:13px; overflow-wrap:anywhere; }
.wa-workspace { display:grid; grid-template-columns:minmax(240px,340px) minmax(0,1fr); align-items:start; gap:24px; }
.wa-workspace > div { min-width:0; }
.wa-section-title { margin:0 0 12px; font-size:16px; }
.wa-accounts { display:grid; gap:10px; }
.wa-account { display:flex; flex-direction:column; align-items:flex-start; gap:9px; width:100%; padding:17px; border:1px solid var(--border); border-radius:14px; background:var(--surface); color:var(--text-1); text-align:left; font:inherit; cursor:pointer; min-width:0; }
.wa-account:hover,.wa-account.on { border-color:var(--series-1); background:color-mix(in srgb,var(--series-1) 5%,var(--surface)); }
.wa-account.on { box-shadow:inset 3px 0 var(--series-1); }
.wa-account-name { font-size:15px; overflow-wrap:anywhere; }
.wa-phone { font-size:13px; font-variant-numeric:tabular-nums; }
.wa-status { display:inline-flex; align-items:center; width:fit-content; max-width:100%; padding:4px 8px; border-radius:6px; background:var(--wash); color:var(--text-2); font-size:11px; line-height:1.45; }
.wa-status[data-status="ready"] { color:var(--ok-text); background:color-mix(in srgb,var(--series-3) 10%,var(--surface)); }
.wa-status:is([data-status="qr"],[data-status="disconnected"],[data-status="auth_failure"],[data-status="error"]) { color:var(--text-1); background:color-mix(in srgb,var(--series-2) 14%,var(--surface)); }
.wa-detail { min-width:0; padding:24px; background:var(--surface); border:1px solid var(--border); border-radius:18px; scroll-margin-top:calc(var(--topbar-height) + 14px); }
.wa-detail:focus:not(:focus-visible) { outline:none; }
.wa-detail-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; }
.wa-detail-heading h2 { margin:0; font-size:21px; overflow-wrap:anywhere; }
.wa-detail-phone { margin:12px 0; color:var(--series-1); font-size:18px; font-variant-numeric:tabular-nums; }
.wa-empty { padding:14px 0; margin:0; font-size:13px; line-height:1.65; }
.wa-description { max-width:580px; margin:24px 0; font-size:14px; line-height:1.65; color:var(--text-2); }
.wa-qr-box { width:264px; height:264px; max-width:100%; box-sizing:border-box; margin:24px 0; padding:12px; display:grid; place-items:center; background:#fff; border:1px solid #dfebee; border-radius:12px; }
.wa-qr-box img { display:block; width:240px; height:240px; max-width:100%; object-fit:contain; }
.wa-qr-box p { text-align:center; color:#496575; font-size:13px; }
.wa-login-steps { padding-left:22px; margin:0; max-width:620px; font-size:14px; line-height:1.7; }
.wa-login-steps li { padding-left:4px; margin:9px 0; }
.wa-phone-tip { max-width:570px; margin:18px 0 0; font-size:12px; line-height:1.65; }
.wa-detail-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; padding-top:18px; border-top:1px solid var(--border); }
.wa-detail-actions button { min-height:42px; }
.wa-connected { margin:24px 0; padding:22px; border:1px solid color-mix(in srgb,var(--series-3) 25%,var(--border)); border-radius:12px; background:color-mix(in srgb,var(--series-3) 5%,var(--surface)); }
.wa-connected-icon { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; background:color-mix(in srgb,var(--series-3) 14%,var(--surface)); color:var(--ok-text); font-size:24px; }
.wa-connected h3 { margin:12px 0 8px; font-size:18px; }
.wa-connected p { margin:0; max-width:560px; font-size:13px; line-height:1.65; color:var(--text-2); }
@media(min-width:641px) and (max-width:1200px) {
  .topbar .brand-copy { display:none; }
  .topbar { gap:12px; }
  .tabs { gap:0; margin-left:0; }
  .tab { padding-inline:10px; }
  #process-latest .sync-label { display:none; }
}
@media(min-width:641px) and (max-width:780px) {
  .topbar { padding-inline:12px; gap:8px; }
  .topbar .brand-logo { width:125px; height:47px; }
  #logout span { display:none; }
  #logout .logout-icon { display:block; }
  .topbar-actions { gap:3px; }
  .tab { padding-inline:8px; font-size:12px; }
  .wa-workspace { grid-template-columns:minmax(200px,30%) minmax(0,1fr); gap:16px; }
  .wa-detail { padding:18px; }
}
@media(max-width:640px) {
  .bottomnav { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .bn-tab { min-width:0; padding-inline:1px; font-size:10px; }
  .wa-banner { margin:10px 12px 0; padding:12px; gap:9px; flex-wrap:wrap; font-size:12px; }
  #wa-banner-text { flex-basis:calc(100% - 35px); }
  .wa-banner button { margin-left:33px; }
  .wa-view { padding:20px 12px 30px; }
  .wa-heading { margin-bottom:18px; }
  .wa-heading h1 { font-size:24px; }
  .wa-heading p { font-size:12px; }
  .wa-add-form { padding:16px; margin-bottom:22px; gap:12px; }
  .wa-add-form > div { max-width:none; min-width:0; flex-basis:100%; }
  .wa-add-form > button { width:100%; }
  .wa-workspace { grid-template-columns:minmax(0,1fr); gap:22px; }
  .wa-detail { padding:16px; }
  .wa-detail-heading h2 { font-size:19px; }
  .wa-qr-box { margin:22px auto; }
  .wa-login-steps { font-size:13px; }
  .wa-connected { padding:16px; }
}

/* Aggregate updates stay inside their text blocks, keeping audio playback intact. */
.wa-section-switch { display:flex; gap:4px; width:fit-content; margin:0 0 18px; padding:4px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.wa-section-switch button { min-height:38px; padding:8px 15px; border:0; border-radius:8px; background:transparent; color:var(--text-2); font:inherit; font-size:13px; cursor:pointer; }
.wa-section-switch button.on { background:color-mix(in srgb,var(--series-1) 12%,var(--surface)); color:var(--series-1); font-weight:650; }
.wa-chat-filters { display:flex; gap:10px; align-items:center; margin-bottom:14px; }
.wa-search { flex:1; min-width:0; }
.wa-search input,.wa-account-filter select { width:100%; min-height:42px; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text-1); font:inherit; font-size:13px; }
.wa-account-filter { width:190px; flex:none; }
.wa-chat-workspace { display:grid; grid-template-columns:minmax(260px,330px) minmax(0,1fr); min-height:480px; height:calc(100dvh - var(--topbar-height) - 250px); max-height:900px; overflow:hidden; border:1px solid var(--border); border-radius:16px; background:var(--surface); }
.wa-chat-list-pane { min-width:0; overflow:auto; overscroll-behavior:contain; border-right:1px solid var(--border); scrollbar-gutter:stable; }
.wa-chat-list { display:flex; flex-direction:column; }
.wa-chats-more { display:block; margin:16px auto; min-height:38px; }
.wa-chat-card { flex:none; width:100%; min-width:0; padding:17px 16px; display:flex; flex-direction:column; gap:7px; border:0; border-bottom:1px solid var(--border); color:var(--text-1); background:transparent; text-align:left; font:inherit; cursor:pointer; }
.wa-chat-card:hover { background:var(--wash); }
.wa-chat-card.on { background:color-mix(in srgb,var(--series-1) 8%,var(--surface)); box-shadow:inset 3px 0 var(--series-1); }
.wa-chat-card-head { display:flex; justify-content:space-between; gap:10px; width:100%; align-items:baseline; }
.wa-chat-card-head strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
.wa-chat-card-head time { flex:none; font-size:10px; color:var(--text-2); font-variant-numeric:tabular-nums; }
.wa-source-label { display:block; font-size:11px; color:var(--series-1); line-height:1.5; overflow-wrap:anywhere; }
.wa-chat-preview { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; max-width:100%; color:var(--text-2); font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.wa-chat-empty,.wa-chat-placeholder { margin:0; padding:30px 24px; font-size:13px; line-height:1.65; color:var(--text-2); }
.wa-chat-placeholder { max-width:440px; margin:auto; text-align:center; }
.wa-chat-detail { min-width:0; min-height:0; display:flex; flex-direction:column; background:color-mix(in srgb,var(--series-1) 2%,var(--page)); }
.wa-chat-detail:focus:not(:focus-visible) { outline:none; }
.wa-chat-header { flex:none; display:flex; align-items:center; gap:14px; padding:16px 22px; background:var(--surface); border-bottom:1px solid var(--border); }
.wa-chat-person { min-width:0; flex:1; }
.wa-chat-person h2 { font-size:17px; line-height:1.4; margin:0; overflow-wrap:anywhere; }
.wa-chat-person p { margin:4px 0 0; }
.wa-chat-phone { color:var(--text-2); font-size:12px; }
.wa-chat-client { flex:none; }
.wa-chat-back { display:none; }
.wa-message-list { min-height:0; overflow:auto; overscroll-behavior:contain; flex:1; display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:22px; scrollbar-gutter:stable; }
.wa-message-list:focus-visible { outline:2px solid var(--series-1); outline-offset:-3px; }
.wa-chat-analysis { align-self:stretch; flex:none; margin:0 0 12px; padding:20px; border:1px solid color-mix(in srgb,var(--series-1) 25%,var(--border)); border-left:3px solid var(--series-1); border-radius:12px; background:var(--surface); }
.wa-chat-analysis h3 { font-size:15px; margin:0 0 10px; }
.wa-chat-analysis p,.wa-chat-analysis li { font-size:13px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.wa-chat-analysis p { margin:0 0 8px; }
.wa-chat-memory { margin-top:12px; font-size:12px; }
.wa-chat-memory summary { cursor:pointer; color:var(--text-2); padding:4px 0; }
.wa-chat-memory p { margin:10px 0 0; }
.wa-chat-memory ul { margin:10px 0 0; padding-left:20px; }
.wa-chat-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:9px; margin-top:14px; }
.wa-chat-action { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:5px; padding:12px; border:1px solid var(--border); border-radius:9px; background:var(--wash); color:var(--text-1); text-align:left; font:inherit; font-size:12px; cursor:pointer; }
.wa-chat-action strong { overflow-wrap:anywhere; line-height:1.5; }
.wa-chat-action:hover { border-color:var(--series-1); }
.wa-message-day { align-self:center; flex:none; color:var(--text-2); font-size:11px; padding:6px 12px; margin:10px 0 3px; border-radius:20px; background:var(--wash); }
.wa-message { flex:none; min-width:110px; max-width:min(84%,670px); padding:11px 14px 9px; border:1px solid var(--border); border-radius:13px 13px 13px 3px; background:var(--surface); color:var(--text-1); overflow-wrap:anywhere; }
.wa-message.is-outgoing { align-self:flex-end; background:color-mix(in srgb,var(--series-3) 9%,var(--surface)); border-color:color-mix(in srgb,var(--series-3) 15%,var(--border)); border-radius:13px 13px 3px 13px; }
.wa-message-sender { display:block; margin-bottom:5px; font-size:10px; color:var(--text-2); }
.wa-message-text { margin:0; font-size:14px; line-height:1.6; white-space:pre-wrap; }
.wa-message-meta { display:flex; justify-content:flex-end; gap:7px; margin-top:5px; font-size:10px; line-height:1.3; color:var(--text-2); }
.wa-message-attachment { display:flex; flex-direction:column; gap:6px; padding:5px 0; font-size:12px; }
.wa-message-attachment .muted { font-size:11px; }
.wa-message.has-media { width:min(84%,430px); }
.wa-message-media { min-width:0; margin:3px 0; }
.wa-audio-player { display:block; width:100%; min-width:0; height:42px; }
.wa-photo-link { display:block; max-width:100%; width:fit-content; border-radius:8px; overflow:hidden; line-height:0; }
.wa-photo-preview { display:block; width:auto; max-width:100%; max-height:360px; object-fit:contain; border-radius:8px; background:var(--wash); }
.wa-photo-link:focus-visible { outline:2px solid var(--series-1); outline-offset:3px; }
.wa-media-text { margin-top:8px; padding-top:10px; border-top:1px solid var(--border); }
.wa-media-text h4 { margin:0 0 6px; font-weight:600; }
.wa-derived-text { white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; line-height:1.65; margin:0; }
.wa-media-note,.wa-media-unavailable { margin:5px 0 0; color:var(--text-2); font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
.wa-fact-source { display:block; margin-top:3px; }
.wa-message.is-deleted .wa-message-text { font-style:italic; color:var(--text-2); }
.wa-message.is-highlighted { box-shadow:0 0 0 2px var(--series-1); }
.wa-load-older { align-self:center; flex:none; min-height:36px; margin:5px 0; }
.crm-wa-conversation { display:block; margin:10px 0; text-align:left; }
@media(min-width:641px) and (max-width:1000px) {
  .wa-chat-workspace { grid-template-columns:minmax(225px,34%) minmax(0,1fr); }
  .wa-message-list { padding:15px; }
  .wa-chat-header { padding:14px; gap:9px; }
  .wa-chat-person h2 { font-size:15px; }
  .wa-chat-client { font-size:11px; padding-inline:8px; }
}
@media(max-width:640px) {
  .wa-view.has-chat { padding:12px 10px 16px; }
  .wa-view.has-chat .wa-heading,.wa-view.has-chat .wa-section-switch,.wa-view.has-chat .wa-chat-filters { display:none; }
  .wa-section-switch { width:100%; box-sizing:border-box; }
  .wa-section-switch button { flex:1; min-height:40px; }
  .wa-chat-filters { flex-wrap:wrap; }
  .wa-search { flex-basis:100%; }
  .wa-account-filter { flex:1; width:auto; min-width:0; }
  .wa-chat-filters > button { min-height:40px; max-width:100%; overflow-wrap:anywhere; }
  .wa-chat-workspace { grid-template-columns:minmax(0,1fr); height:auto; min-height:340px; max-height:none; overflow:visible; }
  .wa-chat-list-pane { border-right:0; max-height:none; overflow:visible; }
  .wa-chat-detail { display:none; }
  .wa-chat-workspace.has-selection { height:calc(100dvh - var(--topbar-height) - 105px); min-height:320px; max-height:none; overflow:hidden; }
  .wa-chat-workspace.has-selection .wa-chat-list-pane { display:none; }
  .wa-chat-workspace.has-selection .wa-chat-detail { display:flex; }
  .wa-chat-card { padding:17px 14px; }
  .wa-chat-card-head strong { font-size:15px; }
  .wa-chat-preview { font-size:13px; }
  .wa-chat-header { flex-wrap:wrap; gap:10px; padding:12px; }
  .wa-chat-back { display:block; min-height:36px; }
  .wa-chat-header > .wa-chat-back { order:0; }
  .wa-chat-person { order:2; flex-basis:100%; }
  .wa-chat-person h2 { font-size:16px; }
  .wa-chat-client { margin-left:auto; order:1; min-height:36px; }
  .wa-message-list { padding:14px 10px; gap:9px; }
  .wa-message { max-width:91%; padding:10px 12px 8px; }
  .wa-message.has-media { width:91%; }
  .wa-photo-preview { max-height:300px; }
  .wa-chat-analysis { padding:15px; }
  .wa-chat-analysis p,.wa-chat-analysis li { font-size:12px; }
  .wa-chat-detail > .wa-chat-back { align-self:flex-start; margin:12px; }
}
.brief-head { flex-wrap:wrap; }
.brief-nav { flex-shrink:0; }
.transcript-roles > summary { cursor:pointer; font-size:12px; color:var(--text-2); padding:7px 0; }
.transcript-roles:not([open]) > :not(summary) { display:none; }
.insight-sources { margin-top:12px; font-size:12px; color:var(--text-2); }
.insight-sources summary { cursor:pointer; width:fit-content; padding:4px 0; }
.insight-source-list { display:flex; flex-wrap:wrap; gap:7px 13px; margin-top:7px; max-height:180px; overflow:auto; }
.insight-source-list .brief-link { padding:2px 0; background:none; border:0; text-align:left; font:inherit; cursor:pointer; }
.brief .insight-updated { margin-top:13px; font-size:11px; }
.cal-note { max-width:250px; margin:10px 0 0; font-size:10px; line-height:1.45; }
.cal-pop .cal-day { position:relative; }
.cal-pop .cal-day.has::after { content:''; position:absolute; width:3px; height:3px; border-radius:50%; background:currentColor; left:calc(50% - 1.5px); bottom:3px; }

/* Trial findings keep their evidence and review controls beside the calendar. */
.workflow-trial { min-width:0; margin:0 0 20px; padding:18px; background:var(--surface); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); scroll-margin-top:calc(var(--topbar-height) + 14px); }
.wf-head,.wf-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.wf-head > div,.wf-card-head h4 { min-width:0; }
.wf-head > button { flex-shrink:0; }
.wf-heading { margin:0; font-size:19px; }
.wf-status { margin:12px 0 5px; font-size:13px; font-weight:600; }
.wf-status.is-error { color:var(--critical); }
.wf-more { display:block; min-height:42px; margin:18px auto 2px; padding:9px 22px; }
.wf-more:disabled { opacity:.6; cursor:wait; }
.wf-detail-content > .muted { margin:12px 0; }
.wf-filters { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin:14px 0 7px; }
.wf-modes { display:flex; flex-wrap:wrap; gap:4px; margin-right:auto; }
.wf-modes .on { background:color-mix(in srgb,var(--series-1) 12%,var(--surface)); color:var(--series-1); border-color:color-mix(in srgb,var(--series-1) 30%,var(--border)); }
.wf-date-filter { display:flex; align-items:center; gap:7px; font-size:11px; color:var(--text-2); }
.wf-date-filter input { min-width:0; width:140px; min-height:34px; padding:5px 8px; border:1px solid var(--axis); border-radius:8px; background:var(--surface); color:var(--text-1); font:inherit; }
.wf-count { margin:8px 0; color:var(--muted); font-size:11px; }
.wf-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,380px),1fr)); align-items:start; gap:10px; max-height:580px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:2px; }
.wf-empty { margin:0; padding:18px 8px; font-size:13px; line-height:1.5; color:var(--text-2); }
.wf-card { min-width:0; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--surface); overflow-wrap:anywhere; }
.wf-card.is-history { background:var(--wash); }
.wf-card-head h4 { margin:0; font-size:14px; line-height:1.5; }
.wf-badge { flex-shrink:0; max-width:45%; padding:3px 7px; border-radius:6px; font-size:10px; background:var(--wash); color:var(--text-2); }
.wf-meta { display:flex; flex-wrap:wrap; align-items:center; gap:5px 10px; margin-top:9px; font-size:11px; color:var(--text-2); line-height:1.5; }
.wf-date { flex-basis:100%; color:var(--series-1); font-size:12px; }
.wf-detail { margin:10px 0; font-size:12px; line-height:1.65; color:var(--text-1); white-space:pre-wrap; }
.wf-original-date { font-size:11px; color:var(--text-2); margin:8px 0; }
.wf-warning { padding:7px 9px; border-left:2px solid var(--series-2); background:color-mix(in srgb,var(--series-2) 8%,var(--surface)); font-size:11px; line-height:1.6; margin:8px 0; border-radius:0 6px 6px 0; }
.wf-reviewed { color:var(--ok-text); font-size:11px; margin:8px 0; }
.wf-evidence { color:var(--text-2); margin:10px 0; font-size:11px; }
.wf-evidence summary { cursor:pointer; width:fit-content; padding:4px 0; }
.wf-evidence-entry { padding:6px 0; }
.wf-evidence blockquote { margin:4px 0 7px; padding:6px 10px; border-left:2px solid var(--axis); font-size:12px; line-height:1.65; white-space:pre-wrap; }
.wf-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-top:12px; }
.wf-actions button { min-height:32px; font-size:11px; }
.wf-calendar-count { display:block; align-self:flex-start; flex-shrink:0; border:1px solid color-mix(in srgb,var(--series-1) 25%,var(--border)); border-radius:6px; background:color-mix(in srgb,var(--series-1) 10%,var(--surface)); color:var(--series-1); padding:3px 6px; font:inherit; font-size:10px; cursor:pointer; margin:3px 0; }
.wf-calendar-count:hover { background:color-mix(in srgb,var(--series-1) 20%,var(--surface)); }
.bcal-day.wf-selected-day { outline:2px solid var(--series-1); outline-offset:1px; }
.wf-head-actions { display:flex; align-items:center; gap:6px; }
.wf-back-calendar { display:none; }
.wf-reload { min-width:34px; font-size:18px; }
.wf-navigation,.tasks-cal,.bcal { scroll-margin-top:calc(var(--topbar-height) + 10px); }
.wf-review-label { margin:8px 0 0; font-size:11px; color:var(--series-2); }
.wf-undated.on { color:var(--series-1); border-color:var(--series-1); }
@media(max-width:640px) {
  body.workflow-view #manual-status:not(.err) { display:none; }
  #tasks-view { padding:12px; }
  .tasks-head { align-items:center; gap:10px; margin-bottom:12px; }
  .tasks-head h2 { font-size:18px; }
  .tasks-head-actions .chip { display:none; }
  .tasks-head-actions button { min-height:40px; }
  .tasks-cal-wrap { position:static; margin-bottom:14px; gap:8px; }
  .tasks-cal { max-width:none; padding:10px; }
  .tasks-cal .cal-day { min-height:38px; height:auto; }
  .tasks-cal .cal-nav { width:40px; height:40px; }
  .tasks-quick { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tasks-quick .tq { min-height:40px; }
  .tasks-layout { display:none; }
  .workflow-trial { padding:0; border:0; background:transparent; box-shadow:none; border-radius:0; margin-bottom:14px; flex-shrink:0; overflow:visible; }
  .wf-navigation { position:sticky; top:var(--topbar-height); z-index:5; background:var(--page); padding:10px 0 7px; scroll-margin-top:var(--topbar-height); border-bottom:1px solid var(--border); margin-bottom:10px; }
  .wf-back-calendar { display:inline-flex; align-items:center; }
  .wf-head { align-items:center; gap:5px; }
  .wf-head-actions { gap:4px; flex-shrink:0; }
  .wf-head-actions button { min-height:40px; padding:6px 9px; }
  .wf-head-actions .wf-reload { width:36px; padding:4px; }
  .wf-heading { font-size:17px; }
  .wf-filters { gap:6px; margin:9px 0 0; }
  .wf-modes { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); flex-basis:100%; margin:0; }
  .wf-modes button { min-height:40px; padding:6px 3px; font-size:11px; }
  .wf-date-filter { display:none; }
  .wf-all-dates,.wf-undated { min-height:36px; }
  .wf-count { margin:7px 0 0; }
  .wf-list { max-height:none; overflow:visible; overscroll-behavior:auto; scrollbar-gutter:auto; padding:0; grid-template-columns:minmax(0,1fr); }
  .wf-card { padding:14px; }
  .wf-card-head { flex-direction:column; gap:5px; }
  .wf-badge { max-width:100%; }
  .wf-card-head h4 { font-size:14px; line-height:1.45; }
  .wf-meta { font-size:12px; }
  .wf-evidence summary { width:auto; min-height:40px; display:flex; align-items:center; gap:8px; font-size:12px; }
  .wf-evidence summary::before { content:'›'; font-size:18px; }
  .wf-evidence[open] summary::before { transform:rotate(90deg); }
  .wf-actions button { min-height:40px; }
  .wf-list .task { margin:0; }
  .wf-list .task-check { min-width:40px; height:40px; }
  .bookings:has(.workflow-trial) { height:auto; min-height:0; padding:12px; }
  .bookings-head { display:flex; margin:10px 0 2px; }
  .bookings-head .chip { min-height:40px; }
  .bookings:has(.workflow-trial) .bcal { flex:none; min-height:0; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:10px; }
  .bookings:has(.workflow-trial) .bcal-day { min-height:46px; }
  .bcal-body { grid-auto-rows:minmax(46px,auto); }
  .bcal-head { gap:6px; }
  .bcal-nav { width:40px; height:40px; }
  .bcal-today { display:block; padding:6px; min-height:40px; font-size:11px; }
  .bcal-count-m { min-width:16px; height:16px; font-size:10px; }
  .wf-calendar-count { align-self:center; padding:3px; font-size:9px; }
}

/* Вход, подтверждение почты и кабинет директора. */
.login { overflow-y:auto; overscroll-behavior:contain; align-items:start; padding-block:40px; }
.auth-card { max-width:440px; margin:auto; gap:20px; }
.auth-card .login-logo { margin-bottom:0; width:208px; height:78px; }
.auth-card h1 { font-size:24px; line-height:1.25; }
.auth-card #auth-description { margin:10px 0 0; line-height:1.6; }
.auth-form,.auth-field { display:grid; gap:8px; min-width:0; }
.auth-form { gap:16px; }
.auth-field label { color:var(--text-2); font-size:13px; font-weight:550; }
.auth-card :is(input,select),.staff-dialog textarea { width:100%; min-width:0; min-height:46px; border:1px solid var(--axis); border-radius:10px; background:var(--page); padding:11px 12px; color:var(--text-1); font:inherit; }
.auth-card select { text-overflow:ellipsis; }
.auth-field small { font-size:12px; }
.auth-password { position:relative; min-width:0; }
.auth-card .auth-password input { padding-right:54px; }
.auth-card .auth-password-toggle { position:absolute; right:1px; top:1px; bottom:1px; display:grid; place-items:center; width:44px; min-height:44px; padding:0; margin:0; border:0; border-radius:9px; background:transparent; color:var(--muted); box-shadow:none; }
.auth-card .auth-password-toggle:hover { color:var(--series-1); background:var(--wash); }
.auth-card .auth-password-toggle:focus-visible { outline:2px solid var(--series-1); outline-offset:2px; }
.auth-password-toggle .auth-eye-slash { display:none; }
.auth-password-toggle[aria-pressed="true"] .auth-eye-slash { display:inline; }
.auth-card :is(input,select):focus-visible,.staff-dialog textarea:focus-visible { outline:2px solid var(--series-1); outline-offset:2px; }
.auth-card .auth-note { margin:0; font-size:12px; line-height:1.6; color:var(--muted); }
.auth-card button[type="submit"] { min-height:46px; margin:0; font-size:14px; }
.auth-card .auth-link { background:transparent; color:var(--series-1); padding:8px 4px; font-size:13px; margin:0; min-height:40px; font-weight:550; box-shadow:none; }
.auth-card .auth-link:hover { text-decoration:underline; text-underline-offset:3px; background:var(--wash); }
.auth-footer { display:grid; gap:4px; padding-top:12px; border-top:1px solid var(--border); }
.auth-card .login-err { padding:10px 12px; border-radius:9px; background:color-mix(in srgb,var(--critical) 8%,var(--surface)); line-height:1.55; }
.auth-result { display:grid; justify-items:start; gap:12px; }
.auth-result-icon { display:grid; place-items:center; width:42px; height:42px; background:color-mix(in srgb,var(--series-3) 12%,var(--surface)); color:var(--series-3); border-radius:50%; font-size:23px; }
.auth-card #auth-result-text { margin:0; line-height:1.75; font-size:14px; }
.auth-card button:disabled,.staff-view button:disabled,.staff-dialog button:disabled { opacity:.55; cursor:default; }
.staff-account-button { position:relative; display:inline-flex; gap:7px; align-items:center; justify-content:center; }
.staff-account-button.on { color:var(--series-1); background:var(--wash); }
.staff-pending-badge { position:absolute; top:-4px; right:-3px; min-width:18px; height:18px; padding:1px 4px; display:grid; place-items:center; border-radius:10px; background:var(--series-1); color:var(--brand-on-accent); font-size:10px; font-weight:650; outline:2px solid var(--surface); }
.staff-view { padding:28px 24px 60px; margin:0 auto; max-width:1240px; }
.staff-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:24px; }
.staff-heading h1 { font-size:26px; }
.staff-eyebrow { font-size:11px; letter-spacing:.07em; text-transform:uppercase; color:var(--series-1); font-weight:650; margin:0 0 6px; }
.staff-heading .muted { margin:7px 0 0; }
.staff-heading > button { min-height:40px; }
.staff-notice { padding:14px 16px; border-radius:12px; background:color-mix(in srgb,var(--series-2) 10%,var(--surface)); border:1px solid color-mix(in srgb,var(--series-2) 25%,var(--border)); font-size:13px; line-height:1.6; }
.staff-tabs { display:flex; gap:5px; border-bottom:1px solid var(--border); margin-bottom:20px; }
.staff-tabs button { border:0; border-bottom:2px solid transparent; margin-bottom:-1px; background:transparent; color:var(--muted); padding:13px 15px; font-size:13px; font-weight:550; }
.staff-tabs button.on { color:var(--series-1); border-bottom-color:var(--series-1); }
#staff-request-count { background:var(--wash); padding:2px 6px; border-radius:6px; margin-left:4px; font-size:11px; }
.staff-state { color:var(--muted); font-size:14px; line-height:1.6; }
.staff-state:empty { display:none; }
.staff-users { display:grid; gap:12px; }
.staff-user { display:flex; align-items:start; gap:16px; padding:22px; border:1px solid var(--border); border-radius:16px; background:var(--surface); box-shadow:var(--shadow); }
.staff-avatar { display:grid; place-items:center; width:44px; height:44px; border-radius:13px; background:var(--wash); color:var(--series-1); font-weight:650; font-size:15px; flex:none; }
.staff-user-details { min-width:0; flex:1; }
.staff-user h2 { font-size:16px; overflow-wrap:anywhere; }
.staff-user-heading { display:flex; flex-wrap:wrap; gap:7px 10px; align-items:center; }
.staff-role { color:var(--series-1); background:var(--wash); padding:4px 8px; border-radius:6px; font-size:11px; font-weight:600; }
.staff-role-master { color:var(--ok-text); background:color-mix(in srgb,var(--series-3) 10%,var(--surface)); }
.staff-role-request,.staff-role-self { color:var(--muted); font-weight:500; }
.staff-protected { color:var(--muted); }
.staff-user-master { border-color:color-mix(in srgb,var(--series-3) 35%,var(--border)); }
.staff-user-highlight { border-color:var(--series-1); background:color-mix(in srgb,var(--series-1) 6%,var(--surface)); box-shadow:0 0 0 2px color-mix(in srgb,var(--series-1) 18%,transparent); scroll-margin-top:calc(var(--topbar-height,80px) + 20px); }
.staff-user:focus-visible { outline:2px solid var(--series-1); outline-offset:3px; }
.staff-user-details p { margin:4px 0; }
.staff-position { color:var(--text-2); font-size:13px; }
.staff-email { color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.staff-user-meta { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; margin:12px 0 8px; font-size:11px; }
.staff-status { padding:4px 8px; border-radius:6px; background:var(--wash); color:var(--muted); }
.staff-status-pending { color:var(--series-1); }
.staff-status-approved { color:var(--ok-text); background:color-mix(in srgb,var(--series-3) 9%,var(--surface)); }
.staff-status-rejected,.staff-status-disabled { color:var(--critical); background:color-mix(in srgb,var(--critical) 7%,var(--surface)); }
.staff-verified { color:var(--ok-text); }
.staff-unverified { color:var(--muted); }
.staff-date { color:var(--muted); font-size:11px; }
.staff-user-actions { display:flex; flex-wrap:wrap; justify-content:end; gap:8px; max-width:270px; }
.staff-user-actions button { min-height:40px; font-size:12px; }
.staff-user-actions small { text-align:right; line-height:1.6; }
.staff-primary { border:0; background:var(--series-1); color:var(--brand-on-accent); border-radius:9px; padding:10px 14px; font-weight:600; }
.staff-primary:hover:not(:disabled) { filter:brightness(.95); }
.staff-user-actions .staff-delete { color:var(--critical); }
.staff-primary.staff-delete-confirm { background:var(--critical); color:#fff; }
.staff-audit { border:1px solid var(--border); border-radius:14px; background:var(--surface); overflow:hidden; }
.staff-audit-row { display:flex; justify-content:space-between; gap:20px; padding:16px 20px; border-bottom:1px solid var(--border); }
.staff-audit-row:last-child { border-bottom:0; }
.staff-audit-row strong { font-size:13px; }
.staff-audit-row p { margin:5px 0 0; overflow-wrap:anywhere; }
.staff-audit-row time { flex:none; }
.staff-audit-reason { font-size:12px; color:var(--text-2); }
.staff-dialog { width:min(460px,calc(100% - 28px)); max-height:calc(100dvh - 40px); overflow:auto; border:1px solid var(--border); border-radius:18px; background:var(--surface); color:var(--text-1); padding:26px; box-shadow:var(--shadow); }
.staff-dialog::backdrop { background:rgba(9,28,40,.5); backdrop-filter:blur(3px); }
.staff-dialog h2 { font-size:20px; }
.staff-dialog p { margin:0; font-size:14px; line-height:1.65; overflow-wrap:anywhere; }
.staff-dialog textarea { resize:vertical; }
.staff-dialog-actions { display:flex; justify-content:flex-end; gap:8px; }
.staff-dialog-actions button { min-height:44px; }
@media(max-width:1340px) { .staff-account-label { display:none; } .topbar-actions #staff-open { width:36px; padding:0; } }
@media(max-width:640px) {
  .login { padding:20px 14px; }
  .auth-card { padding:24px 20px; gap:18px; }
  .auth-card :is(input,select) { font-size:16px; }
  .auth-card h1 { font-size:23px; }
  .auth-card .login-logo { width:190px; height:71px; }
  .staff-view { padding:22px 12px 32px; }
  .staff-heading { gap:10px; margin-bottom:20px; }
  .staff-heading h1 { font-size:23px; }
  .staff-heading > button { padding:8px 10px; font-size:12px; }
  .staff-tabs { gap:8px; display:flex; overflow-x:auto; }
  .staff-tabs button { flex:none; }
  .staff-tabs button { padding:12px 2px; font-size:12px; }
  #staff-request-count { padding:2px 4px; margin-left:2px; }
  .staff-user { display:grid; grid-template-columns:36px minmax(0,1fr); gap:12px; padding:16px; }
  .staff-avatar { width:36px; height:36px; border-radius:11px; font-size:12px; }
  .staff-user h2 { font-size:15px; }
  .staff-user-actions { grid-column:1/-1; max-width:none; justify-content:start; padding-top:12px; border-top:1px solid var(--border); }
  .staff-user-actions button { flex:1; min-height:44px; }
  .staff-user-actions small { flex-basis:100%; text-align:left; font-size:11px; }
  .staff-audit-row { flex-direction:column; gap:7px; padding:15px; }
  .staff-dialog { padding:22px; }
  .staff-dialog-actions { flex-wrap:wrap; }
  .staff-dialog-actions button { flex:1; }
  .staff-dialog textarea { font-size:16px; }
  .topbar:has(#staff-open:not([hidden])) .brand-logo { width:144px; height:54px; }
}
@media(max-width:374px) {
  .topbar:has(#staff-open:not([hidden])) .brand-logo { width:124px; height:46.5px; }
  .topbar:has(#staff-open:not([hidden])) .topbar-actions { gap:3px; }
  .topbar:has(#staff-open:not([hidden])) .topbar-actions :is(.ghost,.sync-btn,#theme-toggle) { width:30px; min-width:30px; }
}

/* Личный кабинет сотрудников. */
.profile-account-button { display:inline-flex; align-items:center; justify-content:center; gap:7px; white-space:nowrap; }
.profile-account-button.on { color:var(--series-1); background:var(--wash); }
.profile-view { padding:30px 24px 52px; max-width:1440px; margin:0 auto; }
.profile-heading { margin-bottom:24px; }
.profile-heading h1 { font-size:30px; line-height:1.2; }
.profile-layout { display:grid; grid-template-columns:minmax(240px,300px) minmax(0,1fr); align-items:start; gap:24px; }
.profile-sidebar,.profile-main { display:grid; gap:20px; min-width:0; }
.profile-preview { display:grid; gap:12px; }
.profile-preview label { font-size:14px; font-weight:600; line-height:1.5; }
.profile-preview select { width:100%; min-width:0; max-width:100%; padding:12px; color:var(--text-1); background:var(--page); border:1px solid var(--border); border-radius:10px; font:inherit; }
.profile-preview .profile-state { margin:0; }
.profile-preview select:focus-visible { outline:2px solid var(--series-1); outline-offset:3px; }
.profile-message .profile-retry { margin-top:12px; }
.profile-card { min-width:0; background:var(--surface); border:1px solid var(--border); border-radius:18px; padding:24px; }
.profile-identity-card { display:flex; flex-direction:column; align-items:flex-start; gap:13px; }
.profile-avatar { display:grid; place-items:center; width:56px; height:56px; border-radius:18px; background:color-mix(in srgb,var(--series-1) 12%,var(--surface)); color:var(--series-1); font-size:20px; font-weight:650; letter-spacing:.02em; }
.profile-identity-card h2 { font-size:19px; line-height:1.4; overflow-wrap:anywhere; }
.profile-identity-card p { margin:0; overflow-wrap:anywhere; line-height:1.6; }
.profile-position { font-size:13px; color:var(--text-2); }
.profile-email { font-size:13px; color:var(--muted); }
.profile-verified { display:flex; gap:7px; align-items:center; margin-top:4px; color:var(--series-3); font-size:11px; }
.profile-verified > span { width:17px; height:17px; display:grid; place-items:center; border-radius:50%; background:color-mix(in srgb,var(--series-3) 12%,transparent); }
.profile-password-card { padding:0; overflow:hidden; }
.profile-password-card summary { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:21px 22px; cursor:pointer; font-size:14px; font-weight:600; list-style:none; }
.profile-password-card summary::-webkit-details-marker { display:none; }
.profile-password-card[open] summary { border-bottom:1px solid var(--border); }
.profile-password-card[open] summary svg { transform:rotate(180deg); }
.profile-password-card form { padding:22px; gap:18px; }
.profile-card input,.profile-card textarea { width:100%; min-width:0; border:1px solid var(--border); background:var(--page); border-radius:10px; padding:11px 12px; color:var(--text-1); font:inherit; }
.profile-card textarea { resize:vertical; line-height:1.6; min-height:92px; max-height:260px; }
.profile-card .auth-password input { padding-right:46px; }
.profile-card :is(button,a,input,textarea,summary):focus-visible { outline:2px solid var(--series-1); outline-offset:3px; }
.profile-primary { min-height:43px; border:0; border-radius:10px; padding:11px 16px; background:var(--series-1); color:var(--brand-on-accent); font-weight:600; font-size:13px; }
.profile-primary:disabled { opacity:.55; cursor:default; }
.profile-primary:hover:not(:disabled) { filter:brightness(.96); }
.profile-success { margin:0; color:var(--series-3); font-size:13px; line-height:1.6; }
.profile-logout { justify-self:start; color:var(--muted); font-size:13px; border-color:transparent; }
.profile-card-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:19px; }
.profile-card-heading h2 { font-size:19px; line-height:1.4; }
.profile-state { color:var(--muted); font-size:13px; line-height:1.7; margin:12px 0; }
.profile-state:empty { display:none; }
.profile-documents { display:grid; gap:9px; }
.profile-document { display:flex; align-items:center; gap:15px; width:100%; text-align:left; padding:16px; border:1px solid var(--border); border-radius:12px; background:var(--page); color:var(--text-1); }
.profile-document:hover { border-color:color-mix(in srgb,var(--series-1) 45%,var(--border)); background:color-mix(in srgb,var(--series-1) 4%,var(--surface)); }
.profile-document-symbol { display:grid; place-items:center; flex:none; width:37px; height:42px; border:1px solid var(--border); background:var(--surface); border-radius:8px; font-size:23px; color:var(--series-1); }
.profile-document-caption { display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-width:0; overflow-wrap:anywhere; }
.profile-document-caption strong { font-size:13px; line-height:1.5; font-weight:550; }
.profile-document-caption > span:not(.profile-document-status) { color:var(--muted); font-size:12px; }
.profile-document-status { display:inline-flex; align-items:center; align-self:flex-start; padding:2px 7px; border-radius:6px; background:color-mix(in srgb,var(--warning) 13%,var(--surface)); color:var(--text-2); border:1px solid color-mix(in srgb,var(--warning) 25%,var(--border)); font-size:10px; line-height:1.6; font-weight:500; }
.profile-reader { scroll-margin-top:calc(var(--topbar-height) + 18px); }
.profile-reader-toolbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-bottom:17px; }
.profile-download { color:var(--series-1); font-size:12px; text-decoration:none; padding:8px 0; }
.profile-download:hover { text-decoration:underline; }
.profile-reader-titleline { display:flex; align-items:start; gap:10px; flex-wrap:wrap; }
.profile-reader-titleline h3 { font-size:17px; line-height:1.5; overflow-wrap:anywhere; flex:1 1 200px; }
.profile-reader-body { max-height:470px; overflow-y:auto; scrollbar-gutter:stable; margin-top:16px; padding-right:10px; overscroll-behavior:contain; }
.profile-document-section { margin-bottom:22px; padding:4px 12px 4px 0; border-radius:8px; outline:none; }
.profile-document-section h4 { margin:0 0 9px; font-size:13px; font-weight:650; line-height:1.6; }
.profile-document-section p { white-space:pre-wrap; font-size:13px; line-height:1.85; color:var(--text-2); margin:0; overflow-wrap:anywhere; }
.profile-section-highlight { padding:14px; border-left:3px solid var(--series-1); background:color-mix(in srgb,var(--series-1) 7%,var(--surface)); }
.profile-assistant-symbol { display:grid; place-items:center; width:34px; height:34px; flex:none; border-radius:11px; font-size:18px; font-weight:600; color:var(--series-3); background:color-mix(in srgb,var(--series-3) 10%,var(--surface)); }
.profile-chat-intro { padding:4px 0 19px; }
.profile-chat-intro p { margin:0 0 17px; max-width:65ch; font-size:13px; color:var(--text-2); line-height:1.8; }
.profile-question-examples { display:flex; flex-wrap:wrap; gap:8px; }
.profile-question-examples button { padding:8px 11px; border:1px solid var(--border); background:var(--page); color:var(--text-2); font-size:12px; border-radius:8px; text-align:left; }
.profile-question-examples button:hover:not(:disabled) { color:var(--series-1); border-color:var(--series-1); }
.profile-question-examples button:disabled { opacity:.6; cursor:default; }
.profile-question-form { display:grid; gap:10px; padding-top:18px; border-top:1px solid var(--border); }
.profile-question-label { font-size:12px; font-weight:550; color:var(--text-2); }
.profile-question-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; }
.profile-question-actions .login-err { margin:0; flex:1; }
.profile-question-actions > button { flex:none; display:flex; align-items:center; gap:15px; }
.profile-question-actions > button span { font-size:19px; line-height:1; }
.profile-chat { display:grid; gap:14px; max-height:500px; overflow-y:auto; scrollbar-gutter:stable; overscroll-behavior:contain; }
.profile-chat:empty { display:none; }
.profile-chat:not(:empty) { margin-bottom:20px; padding:1px 7px 4px 1px; }
.profile-message { min-width:0; border-radius:13px; padding:15px 18px; }
.profile-message-user { margin-left:40px; background:color-mix(in srgb,var(--series-1) 9%,var(--surface)); border:1px solid color-mix(in srgb,var(--series-1) 12%,var(--border)); }
.profile-message-assistant { margin-right:24px; background:var(--page); border:1px solid var(--border); }
.profile-message-label { display:block; font-size:10px; font-weight:650; color:var(--muted); margin-bottom:7px; }
.profile-message-text { white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; line-height:1.8; margin:0; }
.profile-message.is-error .profile-message-text { color:var(--critical); }
.profile-message.is-pending .profile-message-text { color:var(--muted); }
.profile-message.is-pending .profile-message-text::before { content:''; display:inline-block; width:10px; height:10px; border:2px solid var(--border); border-top-color:var(--series-1); border-radius:50%; margin-right:9px; animation:profile-thinking .9s linear infinite; }
.profile-answer-sources { display:flex; flex-wrap:wrap; gap:7px; margin-top:15px; padding-top:12px; border-top:1px solid var(--border); }
.profile-source-label { flex-basis:100%; color:var(--muted); font-size:10px; }
.profile-source { display:inline-flex; align-items:center; gap:7px; max-width:100%; text-align:left; border:1px solid var(--border); background:var(--surface); border-radius:7px; color:var(--series-1); padding:7px 10px; font-size:11px; overflow-wrap:anywhere; }
.profile-source:hover { border-color:var(--series-1); }
@keyframes profile-thinking { to { transform:rotate(360deg); } }
@media(max-width:1600px) { .profile-account-label { display:none; } .topbar-actions #profile-open { width:36px; padding:0; } }
@media(min-width:641px) and (max-width:950px) { .profile-layout { grid-template-columns:230px minmax(0,1fr); gap:16px; } .profile-card { padding:20px; } .profile-password-card { padding:0; } }
@media(max-width:640px) {
  .topbar-actions #logout { display:none; }
  .profile-view { padding:23px 12px 35px; }
  .profile-heading { margin-bottom:18px; }
  .profile-heading h1 { font-size:25px; }
  .profile-layout { grid-template-columns:minmax(0,1fr); gap:19px; }
  .profile-sidebar { gap:12px; }
  .profile-identity-card { display:grid; grid-template-columns:46px minmax(0,1fr); gap:5px 14px; }
  .profile-avatar { grid-row:1/4; width:46px; height:46px; border-radius:14px; font-size:16px; }
  .profile-identity-card h2 { font-size:16px; }
  .profile-position,.profile-email { grid-column:2; font-size:12px; }
  .profile-verified { grid-column:2; margin-top:7px; }
  .profile-card { padding:19px; border-radius:15px; }
  .profile-password-card { padding:0; }
  .profile-password-card summary { padding:17px 19px; }
  .profile-password-card form { padding:19px; }
  .profile-logout { padding:8px 10px; font-size:12px; }
  .profile-main { gap:16px; }
  .profile-card-heading { gap:10px; margin-bottom:16px; }
  .profile-card-heading h2 { font-size:18px; }
  .profile-card-heading > button { font-size:11px; padding:8px; }
  .profile-card :is(input,textarea) { font-size:16px; }
  .profile-question-actions { flex-wrap:wrap; }
  .profile-question-actions .login-err { flex-basis:100%; }
  .profile-question-actions > button { min-height:44px; }
  .profile-document { padding:12px; gap:11px; }
  .profile-document-caption strong { font-size:12px; }
  .profile-reader-body { max-height:60dvh; padding-right:4px; }
  .profile-reader-titleline h3 { font-size:15px; }
  .profile-message { padding:13px; }
  .profile-message-user { margin-left:20px; }
  .profile-message-assistant { margin-right:0; }
  .profile-chat { max-height:60dvh; }
}
/* Director's task review: proposals and their source evidence. */
.task-review-view { padding:24px; max-width:1440px; margin:0 auto; }
.task-review-view[hidden] { display:none; }
.reconciliation-job { margin:18px 0; border:1px solid var(--border); border-radius:14px; background:var(--surface); padding:18px; }
.reconciliation-job summary { display:flex; gap:16px; justify-content:space-between; flex-wrap:wrap; cursor:pointer; }
.reconciliation-job .task-review-list { margin-top:18px; }
#tasks-reconciliation-open { text-decoration:none; }
#tasks-reconciliation-open[hidden] { display:none; }
.task-review-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.task-review-heading h1 { margin:14px 0 8px; font-size:26px; }
.task-review-back,.task-review-source { color:var(--series-1); text-decoration:none; }
.task-review-note { padding:14px 16px; background:var(--surface); border:1px solid var(--border); border-radius:12px; }
.task-review-summary { display:flex; flex-wrap:wrap; gap:10px; margin:22px 0; align-items:center; }
.task-review-count { display:flex; flex-direction:column; align-items:flex-start; gap:7px; border:1px solid var(--border); border-radius:12px; padding:14px 18px; background:var(--surface); color:var(--text-1); cursor:pointer; }
.task-review-count strong { font-size:24px; }
.task-review-count span { font-size:13px; }
.task-review-count.on { border-color:var(--series-1); background:var(--wash); box-shadow:inset 3px 0 var(--series-1); }
.task-review-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:16px; }
.task-review-card { min-width:0; border:1px solid var(--border); border-radius:16px; padding:20px; background:var(--surface); overflow-wrap:anywhere; }
.task-review-card h2 { font-size:17px; line-height:1.5; margin:14px 0 8px; }
.task-review-card p { line-height:1.6; }
.task-review-card-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; font-size:12px; }
.task-review-badge { color:var(--series-1); border:1px solid var(--border); border-radius:20px; padding:5px 10px; }
.task-review-warning { color:var(--warn,#ba7b24); }
.task-review-evidence { list-style:none; padding:0; margin:18px 0; }
.task-review-evidence li + li { margin-top:16px; }
.task-review-source { background:none; border:0; padding:0; font:inherit; font-size:13px; cursor:pointer; text-align:left; }
.task-review-evidence blockquote { margin:8px 0 0; padding:4px 0 4px 12px; border-left:2px solid var(--border); font-size:13px; line-height:1.6; white-space:pre-wrap; }
.task-review-actions { display:flex; gap:10px; margin-top:20px; }
.task-review-actions a { text-decoration:none; }
.task-review-more { display:block; margin:24px auto; }
.task-review-more[hidden] { display:none; }
@media(max-width:760px) {
  .task-review-view { padding:16px 12px 100px; }
  .task-review-heading { align-items:flex-start; flex-direction:column; gap:8px; }
  .task-review-heading h1 { font-size:23px; }
  .task-review-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .task-review-count { padding:12px; min-width:0; }
  .task-review-list { grid-template-columns:minmax(0,1fr); }
  .task-review-card { padding:16px; }
}

/* Director activity: compact desktop rows become readable mobile cards. */
.activity-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.activity-toolbar h2 { font-size:18px; margin:0; }
.activity-toolbar label { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted); min-width:0; }
.activity-toolbar select { max-width:320px; min-width:100px; min-height:40px; border:1px solid var(--border); border-radius:9px; background:var(--surface); color:var(--text-1); padding:8px 10px; }
.activity-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:20px; }
.activity-metric { border:1px solid var(--border); background:var(--surface); border-radius:14px; padding:18px; display:grid; gap:6px; }
.activity-metric strong { font-size:28px; font-variant-numeric:tabular-nums; color:var(--series-1); }
.activity-metric span { color:var(--muted); font-size:12px; }
.activity-users { display:grid; gap:10px; }
.activity-user { display:grid; grid-template-columns:minmax(180px,1.5fr) repeat(2,minmax(135px,1fr)) 80px minmax(100px,1fr) auto; gap:14px; align-items:center; padding:18px; border:1px solid var(--border); border-radius:14px; background:var(--surface); font-size:12px; }
.activity-person { display:grid; gap:5px; overflow-wrap:anywhere; min-width:0; }
.activity-person strong { font-size:14px; }
.activity-cell { display:grid; gap:7px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.activity-label { color:var(--muted); font-size:11px; }
.activity-online { color:var(--ok-text); font-size:11px; }
.activity-online::before { content:'●'; margin-right:5px; font-size:9px; }
.activity-user > button { min-height:40px; font-size:11px; padding:8px; }
.activity-history-heading { margin-top:32px; scroll-margin-top:calc(var(--topbar-height,80px) + 18px); }
.activity-pagination { display:flex; justify-content:center; padding:16px; }
.activity-empty { padding:18px; }
@media(max-width:1100px) {
  .activity-user { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .activity-person { grid-column:1 / -1; }
  .activity-user > button { justify-self:start; }
}
@media(max-width:640px) {
  .activity-metrics { gap:6px; }
  .activity-metric { padding:12px 9px; }
  .activity-metric strong { font-size:24px; }
  .activity-metric span { font-size:11px; line-height:1.4; }
  .activity-user { padding:16px; gap:16px 12px; }
  .activity-toolbar label { width:100%; justify-content:space-between; }
  .activity-toolbar select { max-width:75%; font-size:16px; }
}
