/* odvice design system — «Odi-first». A calm, warm workspace: a side panel with five plain-language
   areas, an Odi bar on top that understands requests, rounded cards and pill buttons. Brand colours from
   Odvice/02 Brand: navy for text and primary actions, gold only where Odi (AI) is involved. */
:root {
  --bg: #F5F3EE; --surface: #FFFFFF; --surface-2: #F8F7F3; --surface-3: #EFECE4; --text: #14213A; --muted: #687387; --line: #E6E2D8;
  --accent: #13294B; --accent-soft: #E7ECF5; --on-accent: #FFFFFF; --spark: #B07D0E; --gold: #F2C14E; --gold-soft: #FBF1D6;
  --good: #1B7F55; --good-soft: #E3F3EA; --bad: #C2413A; --bad-soft: #FBEAE8;
  --warn: #9A5B00; --warn-soft: #FDF3DC; --zero: #94a3b8;
  --shadow: 0 1px 2px rgba(20,33,58,.04), 0 6px 24px rgba(20,33,58,.05);
  --radius: 18px; --radius-sm: 12px; --side: 252px;
  --s1: #13294B; --s2: #2E6BD6; --s3: #0F9B8E; --s4: #D9480F; --s5: #8B5CF6; --s6: #DB2777; --s7: #0E7490;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1324; --surface: #121D33; --surface-2: #17243E; --surface-3: #1D2C49; --text: #EEF2F8; --muted: #9AA7BD; --line: #24365A;
    --accent: #F2C14E; --accent-soft: #2A3247; --on-accent: #13294B; --spark: #F2C14E; --gold: #F2C14E; --gold-soft: #2E2A1E;
    --good: #5CC995; --good-soft: #12332B; --bad: #F08A82; --bad-soft: #3A2230;
    --warn: #F5C451; --warn-soft: #2C2614; --zero: #7C89A0; --shadow: none;
    --s1: #EEF2F8; --s2: #6EA2FF; --s3: #2DD4BF; --s4: #FB923C; --s5: #A78BFA; --s6: #F472B6; --s7: #22D3EE;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1324; --surface: #121D33; --surface-2: #17243E; --surface-3: #1D2C49; --text: #EEF2F8; --muted: #9AA7BD; --line: #24365A;
  --accent: #F2C14E; --accent-soft: #2A3247; --on-accent: #13294B; --spark: #F2C14E; --gold: #F2C14E; --gold-soft: #2E2A1E;
  --good: #5CC995; --good-soft: #12332B; --bad: #F08A82; --bad-soft: #3A2230;
  --warn: #F5C451; --warn-soft: #2C2614; --zero: #7C89A0; --shadow: none;
  --s1: #EEF2F8; --s2: #6EA2FF; --s3: #2DD4BF; --s4: #FB923C; --s5: #A78BFA; --s6: #F472B6; --s7: #22D3EE;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 "Plus Jakarta Sans", "IBM Plex Sans Arabic", system-ui, sans-serif; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.logo { display: block; flex: none; line-height: 0; }
.logo img { height: 26px; width: auto; display: block; }
/* The four-point spark marks AI moments only (brand rule); shape from the logo. */
.ai-spark::before { content: ""; display: inline-block; width: .85em; height: .85em; margin-inline-end: .35em; vertical-align: -.05em; background: var(--spark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='606 318 148 148'%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='606 318 148 148'%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; color: var(--muted); }
.chip:empty { display: none; }

/* ---- App frame (shell.js): side panel + Odi bar ---- */
body.framed { padding-inline-start: var(--side); }
#side { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: var(--side); background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; z-index: 45; }
#side .brand { display: flex; align-items: center; gap: 8px; padding: 18px 18px 10px; }
#side .orgbtn { margin: 4px 12px 10px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--text); text-align: start; width: calc(100% - 24px); }
#side .orgbtn .av { width: 30px; height: 30px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
#side .orgbtn .nm { font-weight: 700; font-size: 13.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#side .orgbtn .cc { font-size: 11.5px; color: var(--muted); }
#side nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; }
#side .sec { margin-top: 2px; }
#side .sec > a, #side .sec > button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 12px; color: var(--text); text-decoration: none; font: inherit; font-size: 14.5px; font-weight: 600; background: none; border: none; cursor: pointer; text-align: start; }
#side .sec > a:hover, #side .sec > button:hover { background: var(--surface-2); }
#side .sec.on > a, #side .sec.on > button { background: var(--accent-soft); color: var(--accent); }
#side .ico { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; }
#side .ico svg { width: 20px; height: 20px; }
#side .sub { display: none; margin: 2px 0 6px; padding-inline-start: 31px; }
#side .sec.open .sub { display: grid; }
#side .sub a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 13.5px; }
#side .sub a:hover { color: var(--text); background: var(--surface-2); }
#side .sub a.on { color: var(--text); font-weight: 700; background: var(--surface-2); }
#side .cnt { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
#side .cnt.soft { background: var(--surface-3); color: var(--muted); }
#side .label { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 14px 12px 4px; letter-spacing: .02em; }
#side .foot { border-top: 1px solid var(--line); padding: 10px 12px 14px; display: grid; gap: 8px; }
#side .foot .row2 { display: flex; gap: 6px; align-items: center; }
#side .mode { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 13px; cursor: pointer; border: 1px solid var(--line); color: var(--text); font-family: inherit; }
#side .mode .sw { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative; flex: none; transition: background .15s; }
#side .mode .sw::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
#side .mode.on .sw { background: var(--accent); }
#side .mode.on .sw::after { inset-inline-start: 16px; }
.iconbtn { width: 36px; height: 36px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; font-size: 15px; text-decoration: none; position: relative; padding: 0; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 18px; height: 18px; }
/* Top: the Odi bar */
header#shell { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border: none; }
#shell .burger { display: none; }
#shell .ask { flex: 1; max-width: 820px; position: relative; margin-inline-end: auto; }
/* The top bar lines up with the page content below it: the Odi bar starts where the cards start and
   «New» and the bell end where the content ends (pages are 1320px wide, the planning page 1500px). */
header#shell { --page-max: 1320px; padding-inline: max(32px, calc((100% - var(--page-max)) / 2 + 32px)); }
body:has(> main) header#shell { --page-max: 1500px; }
/* Planning page: the bar spans the cards column exactly; «New» and the bell sit over Odi's chat column. */
@media (min-width: 1101px) {
  body:has(> main) header#shell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 20px; }
  body:has(> main) #shell .ask { grid-column: 1; grid-row: 1; max-width: none; margin: 0; }
  body:has(> main) #shell .newmenu, body:has(> main) #shell .bell { grid-column: 2; grid-row: 1; justify-self: end; }
  body:has(> main) #shell .newmenu { margin-inline-end: 46px; }
}
@media (min-width: 1101px) and (max-width: 1400px) { body:has(> main) header#shell { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (min-width: 901px) and (max-width: 1100px) { body:has(> main) header#shell { padding-inline: 16px; } }
#shell .ask .box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 16px; box-shadow: var(--shadow); }
:root[dir="rtl"] #shell .ask .box, html[dir="rtl"] #shell .ask .box { padding: 6px 16px 6px 8px; }
#shell .ask .box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
#shell .ask .spark { width: 18px; height: 18px; flex: none; background: var(--spark); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='606 318 148 148'%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='606 318 148 148'%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z'/%3E%3C/svg%3E") center / contain no-repeat; }
#shell .ask input { border: none; background: transparent; padding: 6px 0; font-size: 15px; outline: none; flex: 1; min-width: 0; }
#shell .ask input:focus { outline: none; }
#shell .ask kbd { font: inherit; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
#shell .ask .mic { width: 34px; height: 34px; font-size: 15px; }
#shell .suggest-pop { position: absolute; top: calc(100% + 8px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(20,33,58,.16); padding: 8px; display: none; max-height: 70vh; overflow-y: auto; }
#shell .ask.open .suggest-pop { display: block; }
#shell .suggest-pop .grp { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
#shell .suggest-pop a, #shell .suggest-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 12px; color: var(--text); text-decoration: none; background: none; border: none; font: inherit; font-size: 14px; cursor: pointer; text-align: start; }
#shell .suggest-pop a:hover, #shell .suggest-pop button:hover, #shell .suggest-pop .sel { background: var(--surface-2); }
#shell .suggest-pop .k { margin-inline-start: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
#shell .suggest-pop .ai { background: var(--gold-soft); }
#shell .newbtn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--accent); color: var(--on-accent); border: none; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
#shell .menu { position: relative; }
#shell .drop { display: none; position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 250px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(20,33,58,.16); padding: 6px; z-index: 50; }
#shell .menu.open .drop { display: block; }
#shell .drop a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
#shell .drop a:hover { background: var(--surface-2); }
#shell .drop .mdiv { padding: 8px 10px 4px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
#shell .drop .note-warn { box-shadow: inset 3px 0 0 var(--bad); }
#shell .drop .note-info { box-shadow: inset 3px 0 0 var(--gold); }
#shell .bell .drop { min-width: 330px; }
.badge-dot { position: absolute; top: -5px; inset-inline-end: -5px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; text-align: center; }
/* Org switcher popover (from the side panel) */
.orgpop { position: fixed; z-index: 55; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(20,33,58,.18); padding: 6px; min-width: 250px; }
.orgpop a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.orgpop a:hover { background: var(--surface-2); }
.orgpop .k { margin-inline-start: auto; font-size: 11.5px; color: var(--muted); }
.orgpop .mdiv { padding: 8px 10px 4px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
/* Mobile: the side panel becomes a drawer; five areas move to a bottom bar. */
#tabbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(11,19,36,.45); z-index: 44; display: none; }
@media (max-width: 900px) {
  body.framed { padding-inline-start: 0; padding-bottom: 72px; }
  #side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  html[dir="rtl"] #side { transform: translateX(100%); }
  body.drawer #side { transform: none !important; }
  body.drawer .scrim { display: block; }
  #shell .burger { display: inline-grid; }
  header#shell { padding: 10px 12px; }
  #shell .ask kbd, #shell .newbtn span.t { display: none; }
  #shell .newbtn { width: 40px; padding: 0; justify-content: center; }
  #tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 42; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  #tabbar a.on { color: var(--accent); font-weight: 700; }
  #tabbar svg { width: 22px; height: 22px; }
}

/* ---- Page structure ---- */
.pagehead { padding: 18px 32px 6px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; max-width: 1320px; margin: 0 auto; }
.pagehead h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.pagehead .crumbs { font-size: 13px; color: var(--muted); font-weight: 600; }
.pagehead .crumbs a { color: var(--muted); text-decoration: none; }
.pagehead .grow, .grow { flex: 1; }
.pagehead .actions { margin: 0; }
/* Tabs are a segmented control, not underlined tabs. */
.pagetabs { display: flex; gap: 4px; padding: 4px; margin: 12px auto 0; width: fit-content; max-width: calc(100% - 64px); overflow-x: auto; background: var(--surface-3); border-radius: 999px; margin-inline-start: max(32px, calc((100% - 1320px) / 2 + 32px)); }
.pagetabs button, .pagetabs a { font: inherit; font-size: 13.5px; padding: 6px 14px; border: none; background: none; color: var(--muted); cursor: pointer; text-decoration: none; white-space: nowrap; border-radius: 999px; font-weight: 600; }
.pagetabs [aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(20,33,58,.1); }
.pagetabs .count { font-size: 11.5px; color: var(--muted); margin-inline-start: 6px; background: var(--surface-3); border-radius: 999px; padding: 0 6px; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 32px 56px; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 8px 32px 40px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 1100px) { main { grid-template-columns: 1fr; padding: 12px 16px; } }
@media (max-width: 900px) { .wrap { padding: 12px 14px 40px; } .pagehead { padding: 12px 14px 0; } .pagehead h1 { font-size: 22px; } .pagetabs { margin-inline-start: 14px; max-width: calc(100% - 28px); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 16.5px; font-weight: 700; }
.card .sub, p.sub { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.stack { display: grid; gap: 20px; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.err { color: var(--bad); font-size: 13px; }
.source { font-size: 13.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.source b { color: var(--text); }

/* ---- Buttons and forms ---- */
.btn { font: inherit; font-size: 14px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; line-height: 1.4; }
.btn:hover { background: var(--surface-2); }
.btn.primary, .btn.navy { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover, .btn.navy:hover { filter: brightness(1.12); }
.btn.green { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ai-spark, .btn.odi { background: var(--gold-soft); border-color: transparent; color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 12px; font-size: 12.5px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btns { display: flex; gap: 8px; }
.link { border: none; background: none; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 0; font-weight: 600; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; font-size: 14px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 12px; }
.actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.mic { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-size: 17px; }
.mic:hover { border-color: var(--accent); }
.mic.rec { background: var(--bad); border-color: var(--bad); color: #fff; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(194,65,58,.45); } 50% { box-shadow: 0 0 0 8px rgba(194,65,58,0); } }
.with-mic { display: flex; gap: 8px; align-items: start; }
.with-mic textarea { flex: 1; }
.lang { display: inline-flex; border-radius: 999px; overflow: hidden; background: var(--surface-3); padding: 2px; }
.lang button { font: inherit; font-size: 12.5px; padding: 3px 10px; border: none; background: none; color: var(--muted); cursor: pointer; border-radius: 999px; font-weight: 600; }
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.modal { position: fixed; inset: 0; background: rgba(11,19,36,.5); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal .box { background: var(--surface); border-radius: 22px; padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 12px; font-size: 19px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 11px 20px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 70; }
.toast.show { opacity: 1; }
@media (max-width: 900px) { .toast { bottom: 88px; } }

/* ---- Numbers, tables, reports ---- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.kpi .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi.bad .v { color: var(--bad); } .kpi.good .v { color: var(--good); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; background: var(--surface); }
.table th { text-align: start; color: var(--muted); font-weight: 700; font-size: 12px; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table .r { text-align: end; } .table .muted { color: var(--muted); font-size: 12.5px; }
.card[style*="padding:0"] { overflow: hidden; }
.lock { font-size: 12px; opacity: .6; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; max-width: 920px; margin: 0 auto; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 800; }
.sheet .meta { color: var(--muted); font-size: 13.5px; margin: 2px 0 18px; }
.rep { width: 100%; border-collapse: collapse; font-size: 14px; }
.rep th { text-align: end; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep th:first-child { text-align: start; }
.rep td { padding: 6px 8px; }
.rep td.v { text-align: end; white-space: nowrap; }
.rep tr.sec td { font-weight: 800; padding-top: 18px; color: var(--muted); font-size: 12.5px; }
.rep tr.line td:first-child { padding-inline-start: 18px; }
.rep tr.line:hover td { background: var(--surface-2); }
.rep tr.total td { font-weight: 700; border-top: 1px solid var(--line); }
.rep tr.grand td { font-weight: 800; background: var(--surface-2); }
.rep tr.grand td:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.rep tr.grand td:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.rep .code { color: var(--muted); font-size: 12px; margin-inline-end: 6px; }
.controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; max-width: 920px; margin: 0 auto 16px; }
.controls .field { min-width: 150px; }
.check { margin-top: 14px; font-size: 13px; }
.check.ok { color: var(--good); } .check.bad { color: var(--bad); }
.tile { min-width: 0; overflow: hidden; }

/* ---- Planning page (index.html) ---- */
.scen { display: flex; gap: 8px; flex-wrap: wrap; }
.scen button { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.scen-combine { margin-top: 10px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: none; padding: 0; cursor: pointer; }
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { text-decoration: underline; }
.comb-box { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.comb-box .note { margin: 0; }
.comb-box label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.comb-box .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.comb-box .row-btns { display: flex; gap: 8px; margin-top: 4px; }
.scen-deleted details { margin-top: 10px; font-size: 13px; color: var(--muted); }
.scen-deleted summary { cursor: pointer; width: fit-content; }
.scen-deleted details > div { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); color: var(--text); }
.scen-deleted details > div span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scen button:hover { border-color: var(--accent); }
.scen button { max-width: 100%; }
.scen .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.scen button:has(.x) { padding-inline-end: 6px; }
.scen .x { flex: none; width: 22px; height: 22px; margin-inline-start: 2px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); opacity: .7; transition: background .15s, color .15s, opacity .15s; }
.scen .x svg { width: 12px; height: 12px; }
.scen button:hover .x { opacity: 1; }
.scen .x:hover { background: var(--bad-soft); color: var(--bad); }
.scen button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.dashed { background: transparent !important; border: 2px dashed currentColor; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; direction: ltr; }
.axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.grid line { stroke: var(--line); }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 190px; display: none; z-index: 5; }
.tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-inline-start: 4px; }
.torn-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.torn-row .lab { color: var(--text); }
.torn-bar { position: relative; height: 22px; direction: ltr; }
.torn-bar .seg { position: absolute; top: 2px; height: 18px; border-radius: 6px; }
.torn-bar .base { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }
.torn-bar .lbl { position: absolute; top: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.low { background: var(--warn-soft); color: var(--warn); } .badge.full { background: var(--good-soft); color: var(--good); }
.probs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.probs .p { padding: 6px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.probs .p b { font-size: 15px; }
.refused { padding: 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.chat { display: flex; flex-direction: column; height: calc(100vh - 110px); position: sticky; top: 74px; padding: 0; overflow: hidden; }
@media (max-width: 1100px) { .chat { height: 720px; position: static; } }
.chat-head { padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--gold-soft); }
.chat-head h2 { margin: 0; font-size: 16px; }
.chat-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chat-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 18px; font-size: 14px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-start; background: var(--accent); color: var(--on-accent); border-end-start-radius: 6px; }
.msg.ai { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--line); border-end-end-radius: 6px; }
.msg.ai p { margin: 0 0 8px; } .msg.ai p:last-child { margin: 0; }
.msg.ai ul { margin: 4px 0 8px; padding-inline-start: 18px; }
.msg.ai table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 6px 0 10px; display: block; overflow-x: auto; }
.msg.ai th, .msg.ai td { border: 1px solid var(--line); padding: 4px 6px; text-align: start; }
.msg.ai th { background: var(--surface); }
.meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.meta .ok { color: var(--good); } .meta .warn { color: var(--warn); }
.typing { align-self: flex-end; color: var(--muted); font-size: 13px; }
.props { padding: 0 16px; display: grid; gap: 10px; }
.prop { border: 1px solid var(--gold); background: var(--gold-soft); border-radius: 16px; padding: 12px; }
.prop .t { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.prop ul { margin: 6px 0; padding-inline-start: 18px; font-size: 13px; }
.prop .delta { display: flex; gap: 12px; font-size: 13px; margin: 6px 0 10px; flex-wrap: wrap; }
.prop .why { font-size: 12.5px; color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; font: inherit; font-size: 14px; padding: 10px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); min-height: 44px; max-height: 140px; }
.past-h { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.past-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msgs .past { display: flex; flex-direction: column; gap: 3px; text-align: start; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; }
.msgs .past:hover { border-color: var(--gold); }
.msgs .past span { font-size: 12px; color: var(--muted); }
.msg.note { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 4px 12px; }
.msg.note .note-act { margin-inline-start: 8px; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); background: none; border: none; padding: 0; cursor: pointer; }
.msg.note .note-act:hover { text-decoration: underline; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.suggest button { font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; text-align: start; }
.suggest button:hover { color: var(--text); border-color: var(--gold); }
.audit { font-size: 12.5px; color: var(--muted); margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }

/* ---- Search (shared modal) ---- */
.search-box { max-width: 640px; }
.search-box input { width: 100%; font-size: 16px; padding: 12px 14px; }
.search-results { margin-top: 10px; max-height: 60vh; overflow: auto; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 10px; color: var(--text); text-decoration: none; }
.search-results a:hover { background: var(--surface-2); }
.search-results .muted { margin-inline-start: auto; font-size: 13px; }

/* ---- Today (home) ---- */
.today-hi { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin: 6px 0 2px; }
.today-sub { color: var(--muted); margin: 0 0 18px; }
.big3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .big3 { grid-template-columns: 1fr; } }
.big3 .card { padding: 18px 20px; text-decoration: none; color: inherit; display: block; transition: transform .12s ease, box-shadow .12s ease; }
.big3 .card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(20,33,58,.08); }
.big3 .k { font-size: 13px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.big3 .v { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.big3 .v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-inline-start: 4px; }
.big3 .s { font-size: 13px; color: var(--muted); margin-top: 6px; }
.big3 .s.bad { color: var(--bad); font-weight: 600; }
.ico-round { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; flex: none; }
.ico-round svg { width: 16px; height: 16px; }
.runway { margin-top: 14px; display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: var(--radius); background: var(--gold-soft); }
.runway b { font-size: 15.5px; }
.todo { display: grid; gap: 0; }
.todo a, .todo .it { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.todo > :last-child { border-bottom: none; }
.todo .c { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.todo .c.warn { border-color: var(--bad); } .todo .c.info { border-color: var(--gold); }
.todo .go { margin-inline-start: auto; }
.quick4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .quick4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quick4 a { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
.quick4 a:hover { border-color: var(--accent); }
.quick4 a.ai { background: var(--gold-soft); border-color: transparent; }
.quick4 svg { width: 22px; height: 22px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
@media (max-width: 1000px) { .today-grid { grid-template-columns: 1fr; } }
.flow { display: flex; align-items: end; gap: 12px; height: 140px; margin-top: 8px; direction: ltr; }
.flow .m { flex: 1; display: grid; gap: 4px; justify-items: center; }
.flow .pair { display: flex; gap: 4px; align-items: end; height: 118px; }
.flow .pair i { width: 12px; border-radius: 6px 6px 2px 2px; display: block; }
.flow .lbl { font-size: 11px; color: var(--muted); }
.feed .it { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed .it:last-child { border-bottom: none; }
.feed .amt { margin-inline-start: auto; font-weight: 700; white-space: nowrap; }
.table td.num, .table td:first-child b { white-space: nowrap; }
.btn { white-space: nowrap; }
/* Side panel footer: keep the switch and the small buttons inside the panel's width. */
#side .foot { grid-template-columns: minmax(0, 1fr); }
#side .foot .mode { width: 100%; }
#side .foot .row2 { gap: 4px; flex-wrap: wrap; }
#side .foot .iconbtn { width: 32px; height: 32px; border-radius: 10px; }
#side .foot .iconbtn svg { width: 16px; height: 16px; }
#side .foot .lang button { padding: 3px 8px; }
/* Sortable headers (TableSort in shell.js) */
.table th[data-dir]:hover { color: var(--text); }
.table th[data-dir="asc"]::after { content: " ↑"; color: var(--accent); }
.table th[data-dir="desc"]::after { content: " ↓"; color: var(--accent); }
/* KPI boxes: as many per row as fit (min 160px each), so labels and values never squeeze into a column. */
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi .k { line-height: 1.35; }
.kpi .v { font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
@media (max-width: 1400px) { main { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 1100px) { main { grid-template-columns: 1fr; } }
.composer { align-items: flex-end; }
.composer textarea { line-height: 1.45; overflow-y: auto; }
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Odi's mark: the open O with the gold spark from the odvice logo (not a bare star). It marks every
   AI moment — the Odi bar, Odi's pages and buttons. Navy O on light, white O on dark. */
:root { --odi-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='288 300 482 482'%3E%3Cpath d='M729 496 A200 200 0 1 1 567 334' fill='none' stroke='%2313294B' stroke-width='70' stroke-linecap='round'/%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z' fill='%23B07D0E'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --odi-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='288 300 482 482'%3E%3Cpath d='M729 496 A200 200 0 1 1 567 334' fill='none' stroke='%23EEF2F8' stroke-width='70' stroke-linecap='round'/%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z' fill='%23F2C14E'/%3E%3C/svg%3E"); } }
:root[data-theme="dark"] { --odi-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='288 300 482 482'%3E%3Cpath d='M729 496 A200 200 0 1 1 567 334' fill='none' stroke='%23EEF2F8' stroke-width='70' stroke-linecap='round'/%3E%3Cpath d='M680 318 Q689 383 754 392 Q689 401 680 466 Q671 401 606 392 Q671 383 680 318 Z' fill='%23F2C14E'/%3E%3C/svg%3E"); }
.ai-spark::before { -webkit-mask: none; mask: none; background: var(--odi-mark) center / contain no-repeat; width: 1.15em; height: 1.15em; vertical-align: -.2em; margin-inline-end: .4em; }
#shell .ask .spark { -webkit-mask: none; mask: none; background: var(--odi-mark) center / contain no-repeat; width: 22px; height: 22px; }
.mic-bubble { position: fixed; z-index: 80; max-width: 340px; background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.mic-bubble.err { background: var(--bad); color: #fff; }
.mic.busy { opacity: .6; cursor: progress; animation: micpulse 1.2s ease-in-out infinite; }
.msg.user { white-space: pre-wrap; }
.mic svg { width: 18px; height: 18px; }
.mic.rec svg { stroke: #fff; }
#side .sub a > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Subscription banner under the top bar (trial, payment problem, read-only, Odi allowance). */
.billbar { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 24px 6px; padding: 8px 14px; border-radius: 14px; font-size: 14px; background: var(--accent-soft); color: var(--text); }
.billbar.warn { background: var(--warn-soft); color: var(--warn); }
.billbar.bad { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 900px) { .billbar { margin: 0 12px 6px; } }
.btn.gold { background: var(--gold); color: #13294B; border-color: var(--gold); font-weight: 800; }
.btn.gold:hover { filter: brightness(1.04); }
