:root {
  font: 14px/1.45 Inter, system-ui, sans-serif;
  color: #172f38; background: #f5f7f8;
  --bg: #f5f7f8; --ink: #172f38; --muted: #637780;
  --accent: #12586a; --line: #dfe7e9; --soft: #e6f2f1; --amber: #fff3e4;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0,1fr); }
h1,h2,h3,p { margin: 0; }
h1,h2,h3,strong { font-weight: 600; }
h1 { font-size: 32px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
a { color: inherit; text-decoration: none; }
input,select,button { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
small { display: block; color: var(--muted); font-size: 11px; }
aside { display: flex; flex-direction: column; background: white; padding: 29px 12px 24px; }
.brand { color: var(--accent); font-size: 23px; font-weight: 700; }
.brand, aside > small, .label { margin-inline: 12px; }
aside > small { margin-top: 3px; }
.label { margin-top: 43px; margin-bottom: 16px; color: var(--muted); font-size: 10px; font-weight: 600; }
nav { display: grid; gap: 8px; }
nav a { min-height: 43px; display: flex; gap: 11px; align-items: center; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-size: 13px; }
nav a:hover, nav a[aria-current] { background: var(--soft); color: var(--accent); }
nav a[aria-current] { font-weight: 600; }
nav img, header img { display: block; flex: none; }
nav b { margin-left: auto; color: var(--accent); }
.privacy { margin: 61px 12px 28px; padding-top: 29px; border-top: 1px solid var(--line); font-size: 12px; }
.privacy small { margin-top: 8px; max-width: 156px; font-size: 12px; }
.profile { margin: auto 4px 0; background: var(--bg); padding: 13px 14px; min-height: 74px; border-radius: 12px; font-size: 13px; }
.profile small { margin-top: 6px; font-size: 10px; }
header { min-height: 80px; display: flex; gap: 36px; align-items: center; padding: 0 7.5% 0 40px; background: white; color: var(--muted); font-size: 13px; }
#search { margin-left: auto; display: flex; gap: 10px; align-items: center; width: min(340px,48%); padding: 0 12px; min-height: 40px; border-radius: 8px; background: var(--bg); }
#search input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 12px; }
#search input::placeholder { color: var(--muted); }
.plain { border: 0; background: none; padding: 4px; color: inherit; }
main { min-height: 1020px; padding: 31px 40px 80px; }
.subtitle { margin-top: 3px; color: var(--muted); }
.intro,.alert,.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.intro { margin: 26px 0 24px; }
.date { margin-bottom: 10px; color: var(--accent); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.greeting { font-size: 29px; margin-bottom: 4px; }
.intro p:last-child { color: var(--muted); font-size: 15px; }
.button { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--accent); font-size: 13px; font-weight: 600; text-align: left; }
.button:hover { border-color: var(--accent); }
.primary { min-width: 190px; color: white; background: var(--accent); border-color: var(--accent); }
.alert { min-height: 100px; margin-bottom: 24px; padding: 16px 24px 16px 22px; border-radius: 12px; background: var(--amber); }
.alert h2 { color: #9a581a; font-size: 15px; margin-bottom: 10px; }
.alert .button { min-width: 183px; }
.dashboard { display: grid; grid-template-columns: minmax(0,1.76fr) minmax(0,1fr); gap: 24px; }
.column { display: grid; gap: 24px; align-content: start; min-width: 0; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 19px 22px; }
.card-head { margin-bottom: 17px; }
.card-head small { margin-right: 28px; font-size: 12px; }
.actions,.agenda { min-height: 286px; }
.task { display: grid; grid-template-columns: 24px minmax(0,1fr) minmax(100px,28%); align-items: center; gap: 10px; min-height: 70px; }
.task + .task { border-top: 1px solid var(--line); }
.task input { margin: 0; width: 17px; height: 17px; accent-color: var(--accent); }
.task label { cursor: pointer; }
.task label small { margin-top: 5px; }
.task input:checked + label { text-decoration: line-through; color: var(--muted); }
.badge { padding: 5px 9px; border-radius: 6px; font-size: 11px; background: var(--soft); color: #267767; }
.badge.deadline { background: var(--amber); color: #9a581a; }
.badge.high { background: #fff0ee; color: #ad4145; }
.event-row { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 12px; margin-bottom: 16px; }
.event-row time { color: var(--muted); padding-top: 10px; font-size: 13px; }
.event { display: block; min-height: 72px; background: var(--soft); padding: 11px 13px; border-radius: 8px; font-size: 13px; }
.event.warm { background: var(--amber); }
.event small,.upcoming small { margin-top: 5px; }
.triage h2 { font-size: 18px; margin-bottom: 12px; }
.triage-links,.shortcuts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.triage-links a { background: var(--bg); color: var(--accent); padding: 8px 14px; border-radius: 8px; }
.triage-links small { font-size: 10px; margin-top: 2px; }
.shortcut-section h3 { margin: 3px 0 16px; }
.shortcuts { grid-template-columns: 1fr .92fr 1.04fr; }
.horizon h2 { margin-bottom: 13px; }
.upcoming { display: flex; align-items: center; gap: 13px; min-height: 48px; margin-bottom: 14px; font-size: 12px; }
.upcoming:last-child { margin-bottom: 0; }
.day { display: grid; place-content: center; text-align: center; width: 43px; min-height: 48px; flex: none; border-radius: 7px; background: var(--bg); color: var(--accent); font-size: 17px; }
.day small { margin: 0; font-size: 9px; }
.view { margin-top: 28px; max-width: 900px; }
.empty { padding-block: 18px; color: var(--muted); }
dialog { width: min(420px,calc(100% - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 24px; color: var(--ink); }
dialog::backdrop { background: #172f3866; }
dialog form,dialog label { display: grid; gap: 12px; }
dialog label { gap: 5px; }
dialog input,dialog select { border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--ink); }
.dialog-actions { display: flex; justify-content: end; gap: 8px; }
.dialog-actions .primary { min-width: auto; }
#status { position: fixed; bottom: 20px; right: 20px; padding: 10px 14px; border-radius: 8px; color: white; background: var(--accent); }
@media (max-width: 1150px) { main,header { padding-left: 24px; padding-right: 24px; } .shortcuts { grid-template-columns: 1fr; } }
@media (max-width: 950px) { .dashboard { grid-template-columns: minmax(0,1fr); } header { gap: 14px; } }
@media (max-width: 700px) {
  body { display: block; } aside { padding: 14px 12px; }
  .label,.privacy,.profile,#crumb { display: none; }
  nav { display: flex; overflow-x: auto; margin-top: 10px; } nav a { white-space: nowrap; }
  header { min-height: 58px; } #search { width: auto; flex: 1; }
  main { min-height: 0; padding: 20px 16px 44px; }
  .intro,.alert { flex-wrap: wrap; }
  .task { grid-template-columns: 22px minmax(0,1fr) minmax(72px,25%); gap: 6px; }
  .card { padding-inline: 14px; }
}
.brand-mobile { display: none; }
.expense-tabs, .expense-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 22px; }
.expense-tabs [aria-current] { background: var(--soft); border-color: var(--soft); }
.expense-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.expense-summary .card { min-height: 130px; padding: 16px 20px; }
.expense-summary strong { display: block; margin-block: 8px; color: var(--accent); font-size: 28px; }
.expense-warning, .expense-summary .expense-warning { color: #9a581a; }
.expense-period { cursor: default; }
.expense-table { overflow-x: auto; padding: 0 17px 19px; }
.expense-table table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
.expense-table th, .expense-table td { min-height: 65px; padding: 23px 10px 23px 0; border-bottom: 1px solid var(--line); }
.expense-table thead th { color: var(--muted); font-weight: 600; text-transform: uppercase; }
.expense-table tbody th { font-weight: 500; }
.expense-table tbody tr:nth-child(2) { background: var(--soft); }
.expense-amount { white-space: nowrap; }
.expense-category { color: var(--accent); }
.expense-note { margin-top: 24px; padding: 16px 22px; border-radius: 12px; background: var(--soft); color: var(--accent); }
.expense-note p { margin-block: 8px; }
.subscription-list { margin: 14px 0 0; padding: 0; list-style: none; }
.subscription-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 14px; padding-block: 12px; border-top: 1px solid var(--line); }
.subscription-row strong { overflow-wrap: anywhere; }
#removeSubscription[hidden] { display: none; }

.expense-summary { grid-template-columns: 1fr; gap: 8px; }
.expense-summary .card { min-height: 0; }
.expense-table { padding: 0; border: 0; background: transparent; overflow: visible; }
.expense-table table, .expense-table tbody { display: block; }
.expense-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.expense-table tbody tr { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.expense-table tbody :is(th,td) { min-height: 0; padding: 0; border: 0; }
.expense-table tbody th { grid-area: 1 / 1 / 2 / -1; font-size: 14px; font-weight: 600; }
.expense-table td:nth-child(1), .expense-table td:nth-child(4) { color: var(--muted); }
.expense-table td:nth-child(3) { grid-area: 3 / 1; color: var(--accent); font-size: 14px; font-weight: 600; }
.expense-table td:nth-child(7) { color: var(--muted); }

body { position: relative; display: block; width: min(100%, 430px); margin-inline: auto; }
aside { min-height: 88px; padding: 22px 16px 14px; }
.brand, aside small { margin-inline: 4px; }
.brand-mobile { display: block; }
header { position: absolute; top: 24px; right: 16px; padding: 0; min-height: 0; }
:is(.brand-tagline, aside nav, #search, #help, #crumb, .label, .privacy, .profile) { display: none; }
body[data-module="search"] header { position: static; padding: 10px 20px; }
body[data-module="search"] #search { display: flex; width: 100%; }
main { min-height: 0; padding: 24px 20px calc(88px + env(safe-area-inset-bottom)); }
#status { bottom: 76px; }
.module-heading { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--tile-bg, #e9f1f3); color: var(--tile-ink, #274c59); }
.module-heading h1 { font-size: 24px; line-height: 1.2; }
.view { margin-top: 14px; }
.view h2 { margin-bottom: 10px; }
.view .card-head { flex-wrap: wrap; margin-bottom: 10px; }
.view .card-head h2 { margin-bottom: 0; }
.view .primary, body[data-module="expenses"] .primary { min-width: 0; }
.task { grid-template-columns: 22px minmax(0,1fr) minmax(72px,25%); gap: 6px; }
.module-card p + small { margin-top: 4px; }
.module-list { margin: 0 0 12px; padding: 0; list-style: none; }
.module-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
body[data-module="expenses"] .card-head { flex-wrap: wrap; }
.mobile-home { display: grid; gap: 18px; }
.mobile-home h1 { font-size: 15px; line-height: 1.25; }
.mobile-home h1::first-letter { text-transform: uppercase; }
.home-greeting { margin-top: 6px; color: var(--muted); }
.home-urgent { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 10px 12px; border: 1px solid #f1d7b5; border-radius: 14px; background: var(--amber); color: #85440f; font-weight: 600; }
.home-urgent-icon, .home-urgent-count { display: grid; place-items: center; min-width: 32px; min-height: 32px; border-radius: 999px; }
.home-urgent-icon { background: white; }
.home-urgent-count { padding-inline: 8px; background: #85440f; color: white; }
.home-agent { gap: 7px; min-height: 44px; }
.voice-status { color: var(--muted); font-size: 12px; }
.voice-status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.agent-orb { display: flex; align-items: center; justify-content: center; gap: 2px; width: 23px; height: 23px; border-radius: 50%; color: white; }
.agent-orb i { display: block; width: 2px; height: 10px; border-radius: 2px; background: currentColor; transform: scaleY(.5); }
.agent-orb i:nth-child(3) { height: 17px; }
.agent-orb i:nth-child(even) { height: 13px; }
.home-agent[data-voice-state="speaking"] .agent-orb i { animation: agent-wave .7s ease-in-out infinite alternate; }
.home-agent[data-voice-state="speaking"] .agent-orb i:nth-child(2n) { animation-delay: -.3s; }
.home-agent[data-voice-state="speaking"] .agent-orb i:nth-child(3) { animation-delay: -.55s; }
.home-agent.voice-pulse .agent-orb { background: #ffffff33; }
.home-summaries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
[data-module="inbox"] { --tile-bg: #e0f2ec; --tile-ink: #185849; }
[data-module="cases"] { --tile-bg: #ece7fa; --tile-ink: #513980; }
[data-module="tasks"] { --tile-bg: #e1edfc; --tile-ink: #244e80; }
[data-module="calendar"] { --tile-bg: #f9e6ef; --tile-ink: #783650; }
[data-module="expenses"] { --tile-bg: #f8ebd2; --tile-ink: #784809; }
[data-module="docs"] { --tile-bg: #e5efd9; --tile-ink: #3e5729; }
.home-summaries [data-module="admin"] { grid-column: 1 / -1; }
.home-summaries a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon . arrow" "copy copy copy";
  align-content: start;
  align-items: center;
  gap: 9px 10px;
  height: 100%;
  min-height: 108px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--tile-bg, #e9f1f3);
  color: var(--tile-ink, #274c59);
}
.home-summaries a:hover { border-color: currentColor; }
.home-summaries a:active { background: white; }
.home-tile-icon { grid-area: icon; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #fffc; }
.home-tile-arrow { grid-area: arrow; font-size: 17px; }
.home-tile-copy { grid-area: copy; min-width: 0; overflow-wrap: anywhere; }
.home-tile-copy small { margin-top: 3px; color: inherit; }
.home-summaries [data-module="admin"] a { grid-template-areas: "icon copy arrow"; min-height: 0; }
@media (max-width: 300px) {
  .home-summaries { grid-template-columns: 1fr; }
}
.mobile-nav { position: fixed; z-index: 1; bottom: 0; inset-inline: 0; margin: 0 auto; overflow: visible; width: min(100%, 430px); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; background: white; border-top: 1px solid var(--line); padding-top: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.home-heading { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 10px; }
.home-heading > div { align-self: center; }
.home-heading .primary { min-width: 0; justify-content: center; text-align: center; }
.mobile-nav > a, .mobile-nav summary { display: grid; place-items: center; gap: 4px; min-height: 44px; padding: 4px; color: var(--muted); font-size: 11px; cursor: pointer; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav details > div { position: absolute; bottom: 100%; right: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: white; }

@keyframes agent-wave {
  from { transform: scaleY(.4); }
  to { transform: scaleY(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .home-agent[data-voice-state="speaking"] .agent-orb i { animation: none; transform: scaleY(1); }
}
