/* Kansara's shared interface, adapted from Asphira's ui.css and colors.css.
   Kept after the legacy layout and page rules so their data contracts survive. */
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2');
}
:root, :root[data-theme="light"] {
  --bg: #f6f6f4; --panel: #fff; --panel2: #efefeb; --line: #e5e5e0; --line2: #eeeee9;
  --ink: #242424; --dim: #666862; --dimmer: #666862; --faint: #73756e; --warm: #242424;
  --good: #367447; --good-soft: #eaf4e9; --good-line: #bfd8be;
  --bad: #a53d3b; --bad-soft: #fbedeb; --bad-line: #e9c2be;
  --flag: #90621c; --flag-soft: #faf0db; --flag-line: #e7d3ac;
  --working: #236b8e; --working-soft: #e9f3f8;
  --plum: #77528d; --plum-soft: #f3ebf7;
  --rose: #9c4f68; --rose-soft: #faedf1;
  --teal: #287564; --teal-soft: #e8f4ef;
  --scrim: #24242455; --veil: #ffffffcc; --chart-grid: #e5e5e0;
}
:root[data-theme="dark"] {
  --bg: #222426; --panel: #2d2f31; --panel2: #363935; --line: #424541; --line2: #3b3e3b;
  --ink: #efefeb; --dim: #b1b3ac; --dimmer: #b1b3ac; --faint: #a5a8a0; --warm: #efefeb;
  --good: #a5d3a3; --good-soft: #2f4031; --good-line: #4b6550;
  --bad: #f0aba5; --bad-soft: #482f30; --bad-line: #76504e;
  --flag: #e2bb76; --flag-soft: #443a28; --flag-line: #6a5940;
  --working: #8ec9e3; --working-soft: #263d46;
  --plum: #d5b4ea; --plum-soft: #3c3045;
  --rose: #e8adc0; --rose-soft: #47313b;
  --teal: #92d1bb; --teal-soft: #293f38;
  --scrim: #11131580; --veil: #2d2f31cc; --chart-grid: #424541;
}
:root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sans: var(--font); --serif: var(--font);
  --acc: var(--ink); --acc-soft: var(--panel2); --acc-line: var(--line);
  --info: var(--working); --info-bg: var(--working-soft);
  --purple: var(--plum); --purple-bg: var(--plum-soft);
  --r-xs: 6px; --r-sm: 10px; --r: 16px; --r-lg: 20px; --pill: 6px;
  --sidebar-w: 240px; --shell-max: 1480px;
}
body { min-height: 100dvh; font-size: 14px; }
button, input, textarea, select { font-family: var(--font); }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--working); outline-offset: 3px; box-shadow: none;
}
.skip-link { position: fixed; top: 8px; left: 16px; transform: translateY(-150%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; }
.skip-link:focus { transform: translateY(0); }
.main { padding: 32px 36px 100px; }
.main-area, .view, .card, .card-head, .og-head > div { min-width: 0; }
.view.active { animation: kansara-in .18s ease-out both; }
@keyframes kansara-in { from { opacity: 0; } to { opacity: 1; } }

/* Persistent navigation; the same quiet grouping as Asphira's desktop rail. */
.sidebar { background: var(--bg); overflow: hidden; }
.sidebar-logo { padding: 28px 20px 22px; }
.sidebar-logo-row { align-items: center; gap: 11px; }
.sidebar-logo-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: 11px; font: 650 21px/1 var(--font); letter-spacing: -1px;
  color: var(--plum); background: var(--plum-soft); }
.sidebar-logo-text { font: 650 18px/1.25 var(--font); letter-spacing: -.5px; }
.sidebar-logo-sub { font: 400 11px/1.4 var(--font); letter-spacing: 0; text-transform: none; margin-top: 3px; }
.sidebar-find { margin: 0 14px 15px; width: calc(100% - 28px); min-height: 40px; border-radius: 10px;
  background: var(--panel); padding: 9px 12px; font-size: 13px; }
.sidebar-find::placeholder { color: var(--dim); }
.sidebar-nav { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 24px; }
.sidebar-section-header, .sidebar-subheader { font: 550 11px/1.5 var(--font); letter-spacing: 0;
  text-transform: none; padding: 18px 10px 7px; color: var(--dim); }
.sidebar-subhead { font: 400 11px/1.5 var(--font); letter-spacing: 0; text-transform: none; }
.sidebar-item { gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: 9px; margin: 2px 0;
  font-size: 13px; line-height: 1.4; }
.sidebar-item::before { display: none; }
.sidebar-item.active { background: var(--panel2); color: var(--ink); }
.sidebar-item .wd-icon { color: var(--dim); }
.sidebar-item.active .wd-icon { color: var(--ink); }
.wd-icon { width: 19px; height: 19px; flex: none; display: inline-block; vertical-align: middle; }
.sidebar-foot { font: 400 11px/1.5 var(--font); letter-spacing: 0; padding: 12px 16px; }
.theme-toggle { min-height: 36px; border: 0; background: var(--panel2); border-radius: 9px;
  font: 500 12px/1.4 var(--font); letter-spacing: 0; text-transform: none; padding: 8px 12px; }
.topbar { height: 58px; padding: 0 36px; background: var(--bg); border-bottom-color: var(--line); gap: 12px; }
.topbar .crumb { font: 400 12px/1.4 var(--font); letter-spacing: 0; }
.topbar .crumb b { font-weight: 550; }
.session-cost { font: 400 11px/1.4 var(--font); letter-spacing: 0; }
.health-badge { border: 0; border-radius: 6px; font: 500 11px/1.4 var(--font); letter-spacing: 0; }
.health-badge.ok { background: var(--good-soft); }
.health-badge.err { background: var(--bad-soft); }
.health-badge.warn { background: var(--flag-soft); }
.mobile-nav, .sidebar-close { display: none; }

/* A readable type hierarchy replaces the former report/terminal treatment. */
.og-head, .view-head, .rpt-head { margin-bottom: 26px; align-items: flex-start; gap: 16px; }
.og-title, .section-title, .rpt-title { font: 650 30px/1.15 var(--font); letter-spacing: -1.1px; }
.og-sub, .section-sub, .rpt-sub { font-size: 14px; line-height: 1.65; margin-top: 9px; max-width: 74ch; }
.og-stamp { margin-left: auto; padding-top: 7px; font: 400 11px/1.5 var(--font); white-space: normal; letter-spacing: 0; }
.og-section { margin-top: 30px; }
.og-section-head { border: 0; padding-top: 0; margin-bottom: 14px; }
.og-section-head h2, .rpt-group-head h2 { font: 600 17px/1.4 var(--font); letter-spacing: -.3px; }
.og-section-head .why, .rpt-group-head .why { font-size: 12px; }
.panel-label, .eyebrow, .field-label, .og-card h3, .og-brief h4, .tdy-group, .pl-stage h3,
.kpi-label, .tdy-brief-line .k { font-family: var(--font); font-size: 12px; font-weight: 550;
  letter-spacing: 0; text-transform: none; }
.og-clock, .og-target, .tdy-sub, .tdy-summary, .card-meta, .sh-dim, .sh-note {
  font-family: var(--font); font-size: 11px; line-height: 1.55; letter-spacing: 0; text-transform: none;
}
.og-note { font-size: 13px; line-height: 1.65; }
.kpi-value, .og-vital .v, .pl-stage .pl-n, .pl-group-pct { font-family: var(--font); font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.8px; }
.kpi-card { padding: 18px; }
.kpi-sub { line-height: 1.55; }
.card { padding: 20px; }
.card-head { margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; }
.card, .og-card, .og-tw, .og-brief, .og-river, .og-vitals { border-radius: 16px; border-color: var(--line); }
.og-card { padding: 20px; }
.og-brief { padding: 22px; border-left-width: 1px; }
.og-brief .lede { font: 550 18px/1.6 var(--font); letter-spacing: -.2px; }
.og-brief ul { font-size: 13px; line-height: 1.75; }
.og-brief .meta { font-family: var(--font); font-size: 11px; line-height: 1.65; letter-spacing: 0; }
.og-brief h4 { margin-bottom: 10px; }
.og-vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; }
.og-vital { padding: 18px 20px; }
.og-vital:nth-child(4n + 1) { border-left: 0; }
.og-vital:nth-child(n + 5) { border-top: 1px solid var(--line2); }
.og-vital:nth-child(-n + 4) { border-bottom: 0; }
.og-vital .k { font: 500 12px/1.4 var(--font); letter-spacing: 0; text-transform: none; margin-bottom: 12px; }
.og-vital .v { font-size: 28px; line-height: 1.2; }
.og-vital .d, .og-vital .n { font: 400 11px/1.55 var(--font); }
.og-vital .d { margin-top: 10px; }
.og-vital .v.small { font-size: 24px; }
.og-rivers { gap: 10px; }
.og-river { padding: 16px; }
.og-river .state, .og-river .last { font-family: var(--font); font-size: 11px; letter-spacing: 0; text-transform: none; }
.og-river .state { border-radius: 5px; padding: 2px 6px; background: var(--panel2); }
.og-river.alive .state { color: var(--good); background: var(--good-soft); }
.og-river.late .state { color: var(--flag); background: var(--flag-soft); }
.og-river.dry .state, .og-river.blocked .state { color: var(--bad); background: var(--bad-soft); }
.og-flag { border-radius: 10px; border-left-width: 1px; padding: 14px 16px; line-height: 1.6; }
.tdy-brief-lines { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 4px 18px; margin: 12px 0; }
.tdy-brief-line { padding: 14px 0; }
.tdy-brief-line .k { color: var(--rose); background: var(--rose-soft); border-radius: 6px; padding: 4px 7px; justify-self: start; }
.tdy-brief-line + .tdy-brief-line .k { color: var(--teal); background: var(--teal-soft); }
.tdy-brief-line .when { font-family: var(--font); font-size: 11px; }
.tdy-brief-actions { gap: 8px 16px; line-height: 1.6; }
.tdy-brief-actions a { text-decoration: underline; text-underline-offset: 3px; }

/* Controls share Kansara's 10px corners and quiet selected surfaces. */
.btn, .step-btn { min-height: 38px; font-weight: 550; border-radius: 10px; }
.btn-sm { min-height: 34px; font-size: 12px; }
.btn:hover, .step-btn:hover:not(:disabled) { background: var(--panel2); border-color: var(--line); }
.btn-primary:hover { background: var(--ink); color: var(--bg); opacity: .88; }
.input, .select-input, .library-search, .rpt-search, textarea.input { border-radius: 10px; min-height: 40px; }
.period-row, .pl-pills { background: var(--panel2); border: 0; padding: 3px; border-radius: 11px; gap: 2px; }
.period-btn { border: 0; border-radius: 8px; font-family: var(--font); font-size: 12px;
  text-transform: none; letter-spacing: 0; min-height: 32px; padding: 6px 10px; }
.period-btn.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px #00000009; }
.og-tag, .badge, .sh-state, .rpt-tag { border: 0; border-radius: 6px; font: 500 11px/1.5 var(--font);
  letter-spacing: 0; text-transform: none; padding: 3px 7px; background: var(--panel2); }
.og-tag.good, .sh-state.alive { color: var(--good); background: var(--good-soft); }
.og-tag.bad, .sh-state.blocked, .sh-state.dry { color: var(--bad); background: var(--bad-soft); }
.og-tag.flag, .sh-state.late { color: var(--flag); background: var(--flag-soft); }
.og-tw th, .tbl th, .data-table th { font-family: var(--font); font-size: 11px;
  letter-spacing: 0; text-transform: none; padding: 12px; font-weight: 550; }
.og-tw td, .tbl td { padding: 12px; line-height: 1.55; }
.og-tw td.n, .og-tw th.n { font-family: var(--font); font-variant-numeric: tabular-nums; }
.view div:has(> table.ig-table), .view div:has(> table.table-dense) { overflow-x: auto; max-width: 100%; }
.og-empty, .empty-state, .rpt-empty { padding: 32px 20px; line-height: 1.7; }

/* Reports are grouped lists with identity labels, matching Kansara's inbox. */
.rpt-tools { gap: 7px; margin-bottom: 30px; }
.rpt-filter { font: 500 12px/1.4 var(--font); letter-spacing: 0; text-transform: none;
  border-radius: 9px; min-height: 36px; background: var(--panel); border-color: var(--line); }
.rpt-search { padding: 10px 12px; }
.rpt-group { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; margin-bottom: 24px; }
.rpt-group-head { padding: 18px 20px; border: 0; margin: 0; flex-wrap: wrap; gap: 8px 12px; background: var(--bg); }
.rpt-group-head .n { font: 500 12px/1.4 var(--font); padding: 3px 8px; border-radius: 6px; background: var(--panel2); color: var(--dim); }
.rpt-row { padding: 20px; gap: 16px; grid-template-columns: 90px minmax(0, 1fr) auto; }
.rpt-row:hover { background: color-mix(in srgb, var(--panel2) 50%, var(--panel)); }
.rpt-row-date, .rpt-row-open { font-family: var(--font); font-size: 11px; letter-spacing: 0; text-transform: none; }
.rpt-row-title { font: 600 15px/1.5 var(--font); }
.rpt-row-blurb { line-height: 1.65; }
.rpt-tag { color: var(--plum); background: var(--plum-soft); }
.rdr-title, .rdr-md h1, .rdr-md h2, .rdr-md h3 { font-family: var(--font); font-weight: 600; }
.rdr-md { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.rdr-frame, .rdr-nav { border-radius: 10px; }
.pl-table-head h3 { font: 600 15px/1.5 var(--font); }
#ci-root .ci-niche, #ci-root .ci-src, #ci-root .ci-cell-sub, #ci-root .ci-rule, #ci-root .ci-h3,
#ch-root .ch-honest { font-family: var(--font); font-size: 11px; letter-spacing: 0; text-transform: none; line-height: 1.55; }
#ch-root .ch-mile { border-radius: 16px; }
#ch-root .ch-mile .og-tag { justify-self: start; }
#ch-root .ch-lede { font: 550 18px/1.6 var(--font); }
.sh-summary, .sh-msg, .sh-unit { font-family: var(--font); }
.modal, .pj-modal-box, .chat-popup { border-radius: 20px; }
.modal-title { font: 600 22px/1.4 var(--font); }
#chat-fab { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 3px 14px #0000000a; }
.chat-popup { border-color: var(--line); box-shadow: 0 12px 48px #0000001c; }

/* Sign in uses the same local font, palette and controls as the workspace. */
.wd-login { display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px; }
.login-card .sidebar-logo-mark { width: 44px; height: 44px; margin-bottom: 28px; }
.login-eyebrow { color: var(--dim); font-size: 12px; margin-bottom: 8px; }
.login-card h1 { font: 650 28px/1.2 var(--font); letter-spacing: -.9px; }
.login-description { color: var(--dim); font-size: 14px; line-height: 1.65; margin: 14px 0 26px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 46px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font: 550 14px/1.5 var(--font); padding: 10px 14px; }
.google-btn:hover { background: var(--bg); text-decoration: none; }
.google-btn svg { width: 18px; height: 18px; flex: none; }
.login-note { color: var(--dim); font-size: 12px; margin-top: 20px; line-height: 1.6; }
.login-card .error { background: var(--bad-soft); color: var(--bad); padding: 12px; border-radius: 10px;
  margin-bottom: 20px; font-size: 13px; line-height: 1.6; }

@media (max-width: 1100px) {
  .main { padding: 26px 24px 100px; }
  .topbar { padding: 0 24px; }
  .og-vital { padding: 16px; }
  .og-rivers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .main { padding: 24px 20px calc(104px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 20px; height: 52px; }
  .topbar .session-cost { display: none; }
  .sidebar { width: min(320px, 90vw); min-width: 0; z-index: 120; visibility: hidden;
    transition: transform .2s var(--ease), visibility .2s; background: var(--panel); }
  .sidebar.open { visibility: visible; }
  .sidebar-logo { padding: 24px 18px 18px; }
  .sidebar-logo-row { padding-right: 35px; }
  .sidebar-find { min-height: 44px; }
  .sidebar-item { min-height: 44px; }
  .sidebar-section-header, .sidebar-subheader { min-height: 44px; display: flex; align-items: center; }
  .sidebar-close { position: absolute; top: 20px; right: 10px; display: grid; place-items: center;
    width: 40px; height: 44px; border: 0; border-radius: 10px; background: var(--panel2); color: var(--ink); cursor: pointer; }
  .sidebar-backdrop { z-index: 110; }
  body.nav-open { overflow: hidden; }
  .mobile-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 80; display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--panel); border-top: 1px solid var(--line);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); }
  .mobile-nav button { display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center;
    border: 0; background: transparent; color: var(--dim); font: 500 10px/1.4 var(--font); border-radius: 9px;
    min-width: 0; min-height: 48px; padding: 4px; cursor: pointer; }
  .mobile-nav button .wd-icon { width: 23px; height: 23px; padding: 1px; }
  .mobile-nav button[aria-current="page"], .mobile-nav button[aria-expanded="true"] { color: var(--ink); background: var(--panel2); }
  .og-title, .section-title, .rpt-title { font-size: 28px; }
  .og-sub, .section-sub, .rpt-sub { font-size: 13px; }
  .og-stamp { margin-left: 0; padding-top: 0; }
  .og-head { gap: 8px; }
  .og-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .og-vital:nth-child(odd) { border-left: 0; }
  .og-vital:nth-child(n + 3) { border-top: 1px solid var(--line2); }
  .og-vital .k { white-space: normal; min-height: 2.8em; }
  .og-vital .v { font-size: 26px; }
  .og-vital .v.small { font-size: 22px; }
  .og-rivers, .og-grid2, .og-grid3, .pl-row-cards { grid-template-columns: minmax(0, 1fr) !important; }
  .og-section-head .why, .rpt-group-head .why { margin-left: 0; text-align: left; flex-basis: 100%; }
  .og-brief, .og-card, .card { padding: 18px; }
  .og-brief .cols { gap: 22px; }
  .og-brief .lede { font-size: 16px; }
  .tdy-brief-line { grid-template-columns: 1fr; gap: 7px; }
  .tdy-brief-line .when { white-space: normal; }
  .tdy-decide ul { columns: 1; }
  .rpt-search { width: 100%; min-width: 0; margin: 5px 0 0; font-size: 16px; }
  .rpt-group-head { padding: 16px; }
  .rpt-row { padding: 18px 16px; grid-template-columns: 1fr; gap: 6px; }
  .rpt-row-date { padding: 0; }
  .rpt-row-open { justify-self: end; }
  .rdr-md { padding: 20px; }
  .rdr-meta { white-space: normal; }
  .sh-field { grid-template-columns: 1fr; }
  .sh-field .sh-why { grid-column: 1; }
  .sh-input .input { width: min(140px, 100%); }
  :is(.btn, .btn-sm, .step-btn, .period-btn, .rpt-filter, .theme-toggle, .input, .select-input) { min-height: 44px; }
  :is(input, select, textarea) { font-size: 16px; }
  #pmx-era-pills, .pl-pills { display: flex; max-width: 100%; white-space: nowrap !important;
    flex-wrap: nowrap; overflow-x: auto; padding: 4px; scrollbar-width: thin; }
  #pmx-era-pills .period-btn, .pl-pills .period-btn { flex: none; font-size: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .card-row, .view-head { max-width: 100%; }
  #chat-fab { bottom: calc(82px + env(safe-area-inset-bottom)); right: 16px; }
  .chat-popup { bottom: calc(80px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 150px); }
  #ch-root .ch-mile li { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .main { padding-inline: 14px; }
  .topbar { padding-inline: 14px; }
  .og-vital { padding: 14px 12px; }
  .og-river { grid-template-columns: 8px minmax(0, 1fr); }
  .og-river .state { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important;
    transition: none !important; scroll-behavior: auto !important; }
}

/* The app mark shares the source used by browser and Home Screen icons. */
img.sidebar-logo-mark { display: block; object-fit: contain; overflow: hidden; }
