:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: oklch(0.25 0.01 130);
  background: oklch(0.965 0.012 85);
  --background: oklch(0.965 0.012 85);
  --sidebar: oklch(0.97 0.012 85);
  --primary: oklch(0.58 0.05 145);
  --primary-soft: oklch(0.94 0.018 145);
  --muted: oklch(0.5 0.012 130);
  --line: oklch(0.9 0.015 120);
  --danger: #a64235;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px;
  color: inherit; background: white; cursor: pointer; font-size: 12px; font-weight: 500;
}
button:hover { background: var(--primary-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
button svg, .brand svg, .search svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.primary { background: var(--primary); border-color: var(--primary); color: white; }
.primary:hover { background: oklch(0.52 0.05 145); }
.small { font-size: 11px; padding: 6px 9px; }
.ghost { border-color: transparent; background: transparent; }
.danger { color: var(--danger); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: 224px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--sidebar); z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 8px; min-height: 77px; padding: 20px;
  border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; font-size: 23px; font-weight: 650; letter-spacing: -.7px; line-height: 1.2;
}
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.brand-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--primary); color: white; font-size: 23px; font-weight: 600; letter-spacing: -.6px; }
#tabs { flex: 1; padding: 16px 12px; }
#tabs button { width: 100%; justify-content: flex-start; gap: 12px; margin-bottom: 4px; padding: 10px 12px; border: 0; background: transparent; color: var(--muted); font-size: 14px; text-align: left; white-space: nowrap; }
#tabs button:hover { background: var(--primary-soft); }
#tabs button.active { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.sidebar-footer { display: flex; gap: 10px; align-items: center; padding: 16px; border-top: 1px solid var(--line); font-size: 12px; flex-wrap: wrap; }
.sidebar-footer strong { font-weight: 500; }
.sidebar-footer small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.workspace-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; color: var(--primary); background: white; font-weight: 600; }
main { margin-left: 224px; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; min-height: 77px; border-bottom: 1px solid var(--line); }
h1 { font-size: 18px; font-weight: 600; line-height: 1.4; margin: 0; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 13px; font-weight: 600; }
p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.page-header p { font-size: 12px; margin: 4px 0 0; }
.workspace-body { padding: 18px 24px; }
.toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.toolbar label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.toolbar select { min-width: 130px; }
.toolbar .field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.month-picker { position: relative; display: flex; color: oklch(0.25 0.01 130); }
.month-picker > button { border-radius: 0; padding: 8px 9px; min-height: 34px; }
.month-picker > button + button { margin-left: -1px; }
.month-picker > button:first-child { border-radius: 6px 0 0 6px; }
.month-picker > #month-next { border-radius: 0 6px 6px 0; }
.month-picker > button svg { width: 14px; height: 14px; }
.month-button { min-width: 122px; justify-content: flex-start; gap: 8px; font-weight: 500; }
.month-button svg { color: var(--muted); }
.month-button[aria-expanded="true"] { background: var(--primary-soft); }
.month-popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 272px; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 36px oklch(0.3 0.02 130 / .16); font-size: 12px; }
.month-popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-popover-head strong { font-size: 13px; font-weight: 600; }
.month-popover-head button { padding: 6px; border-color: transparent; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.month-cell { position: relative; padding: 9px 0 12px; border-color: transparent; font-weight: 500; }
.month-cell.has-invoices::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary); }
.month-cell.selected, .month-cell.selected:hover { background: var(--primary); border-color: var(--primary); color: white; }
.month-cell.selected::after { background: white; }
.month-cell.today:not(.selected) { border-color: var(--line); }
.month-cell:disabled { opacity: .3; background: transparent; }
.month-popover-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.month-legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.month-legend::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.month-popover-foot button { padding: 5px 9px; font-size: 11px; }
input, select, textarea { color: inherit; background: white; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; max-width: 100%; min-width: 0; font-size: 12px; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { accent-color: var(--primary); }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin-bottom: 16px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head p { font-size: 12px; margin-bottom: 0; max-width: 860px; }
.section-head > div { min-width: 0; }
.section-head > button { flex-shrink: 0; }
.recurring-summary { border-left: 3px solid var(--primary); padding: 16px 20px; }
#recurring-scope { font-size: 11px; margin-bottom: 0; }
.recurring-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 12px 0; }
.recurring-metrics span { color: var(--muted); font-size: 11px; }
.recurring-metrics strong { display: block; margin-top: 3px; font-size: clamp(24px, 2.2vw, 30px); font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.recurring-summary p:last-child { margin-bottom: 0; }
.reporting-basis { margin-top: 12px; }
.reporting-basis summary { font-size: 11px; }
.reporting-basis p { margin: 8px 0 0; font-size: 12px; }
.settings-panel > summary { font-size: 14px; font-weight: 600; }
.settings-panel:not([open]) > summary { margin-bottom: 0; }
.settings-panel[open] > summary { margin-bottom: 12px; }
.explanation { font-size: 11px; max-width: 1100px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-card { min-width: 0; justify-content: space-between; gap: 12px; text-align: left; padding: 12px; font-weight: 400; border-radius: 7px; }
.summary-card > span:first-child { min-width: 0; }
.summary-card span span { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin: 3px 0; font-size: 21px; font-weight: 600; color: var(--primary); }
.summary-card small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.summary-card .card-hint { font-size: 11px; color: var(--muted); }
.summary-card.selected { background: color-mix(in oklab, var(--primary) 5%, white); border-color: var(--primary); box-shadow: 0 0 0 1px color-mix(in oklab, var(--primary) 20%, transparent); }
.summary-card[data-attention=overdue] strong { color: var(--danger); }
.summary-card[data-attention=unknown] strong { color: #876425; }
.register-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: white; color: var(--muted); }
.search input { border: 0; background: transparent; width: 215px; padding-left: 0; }
#row-count { margin-left: auto; font-size: 11px; color: var(--muted); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: white; max-height: 65vh; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 85px; }
th { position: sticky; top: 0; z-index: 1; background: #fcfcf9; color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
td { max-width: 350px; line-height: 1.5; }
td strong { font-weight: 500; }
.sourced-value small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in oklab, var(--primary) 3%, white); }
#billing-table th, #billing-table td { padding: 9px 10px; }
#billing-table th:nth-child(2) { min-width: 172px; }
#billing-table th:nth-child(5) { min-width: 235px; }
#billing-table td:nth-child(3), #billing-table td:nth-child(4), #billing-table td:nth-child(8) { white-space: nowrap; }
#billing-table td:nth-child(11), #billing-table td:nth-child(12), #billing-table th:nth-child(11), #billing-table th:nth-child(12) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#billing-table td:last-child { min-width: 185px; }
#billing-table th:last-child, #billing-table td:last-child { position: sticky; right: 0; background: white; box-shadow: -1px 0 var(--line); }
#billing-table th:last-child { z-index: 2; background: #fcfcf9; }
.cell-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.5; margin: 0; min-width: 215px; max-width: 245px; }
.module-pills { display: flex; gap: 4px; flex-wrap: wrap; min-width: 100px; max-width: 160px; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; font-size: 10px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.badge.sage { background: var(--primary-soft); color: oklch(0.4 0.04 145); border-color: transparent; }
.badge.warning-badge { background: #faf1df; color: #876425; border-color: #e9d8b5; }
.sort-button { border: 0; background: transparent; padding: 0; font-size: 11px; color: var(--muted); }
.sort-button::after { content: ""; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 4px solid currentColor; margin-left: 4px; }
th[aria-sort=descending] .sort-button::after { transform: rotate(180deg); }
.table-note { font-size: 10px; margin: 8px 0 14px; }
.tab-count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 600; text-align: center; }
.draft-readiness small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; max-width: 260px; }
#drafts-table .actions { gap: 6px; flex-wrap: nowrap; }
#drafts-table td:nth-child(3), #drafts-table td:nth-child(4), #drafts-table .actions button { white-space: nowrap; }
.dialog-actions #save-draft { order: 1; }
.dialog-actions #save, .dialog-actions #raise-draft { order: 2; }
.empty { padding: 30px 16px; text-align: center; background: white; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; }
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.view-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 16px; color: var(--muted); }
.view-tabs button.active { border-bottom-color: var(--primary); color: var(--primary); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart { width: 100%; height: auto; min-height: 170px; max-height: 280px; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart text.value { fill: oklch(0.35 0.03 145); font-size: 10px; }
.chart rect.bar { fill: var(--primary); }
.chart rect.bar.negative { fill: oklch(0.7 0.11 55); }
.fy-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.fy-bar h2 { margin: 0 0 4px; }
.fy-bar p { margin: 0; font-size: 12px; color: var(--muted); }
.fy-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.fy-controls label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: var(--background); }
.segmented button { border: 0; background: transparent; padding: 7px 12px; border-radius: 5px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: white; color: oklch(0.25 0.01 130); box-shadow: 0 1px 2px oklch(0.3 0.02 130 / .12); }
.chart-note { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.chart rect.missing { fill: var(--primary-soft); stroke: var(--line); stroke-dasharray: 3 3; }
.chart line { stroke: var(--line); }
.panel > .table-wrap, .panel > div > .table-wrap { margin-top: 12px; }
details { border-top: 1px solid var(--line); padding: 14px 0 4px; margin-top: 14px; }
summary { cursor: pointer; font-size: 12px; font-weight: 500; margin-bottom: 10px; }
.coverage p { font-size: 11px; }
.coverage label { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; font-size: 12px; }
.warning { background: #fcf5e7; color: #876425; padding: 10px 12px; border: 1px solid #eee1c7; border-radius: 6px; font-size: 11px; }
.error { background: #fcf0eb; color: var(--danger); padding: 12px; border-radius: 6px; font-size: 12px; }
#notice { background: var(--primary-soft); color: oklch(0.35 0.04 145); border: 1px solid var(--line); padding: 12px 16px; border-radius: 7px; margin-bottom: 16px; font-size: 12px; }
#notice.error { background: #fcf0eb; color: var(--danger); }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 12px; font-size: 10px; color: var(--muted); }
.chat { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; max-width: 1240px; margin: 0 auto; }
.chat-main { min-width: 0; display: flex; flex-direction: column; min-height: calc(100dvh - 150px); }
.chat-sidebar { position: sticky; top: 18px; display: flex; flex-direction: column; max-height: calc(100dvh - 130px); background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.chat-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.chat-sidebar-head h2 { margin: 0; font-size: 13px; }
#chat-threads { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#chat-threads li { position: relative; display: flex; align-items: stretch; border-radius: 7px; }
#chat-threads li:hover, #chat-threads li.active { background: var(--primary-soft); }
#chat-threads li.active .chat-thread span { color: var(--primary); font-weight: 600; }
.chat-thread { flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 30px 8px 10px; border: 0; background: transparent; text-align: left; font-weight: 400; }
.chat-thread:hover { background: transparent; }
.chat-thread span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.chat-thread small { color: var(--muted); font-size: 10px; }
.chat-thread-delete { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; opacity: 0; }
#chat-threads li:hover .chat-thread-delete, #chat-threads li.active .chat-thread-delete, .chat-thread-delete:focus-visible { opacity: 1; }
.chat-thread-delete:hover { color: var(--danger); background: white; }
.chat-threads-empty { padding: 12px 8px; color: var(--muted); font-size: 12px; }
.chat-welcome { text-align: center; padding: 56px 12px 36px; }
.chat-mark { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 12px; color: white; background: var(--primary); font-size: 24px; }
.chat-welcome h2 { font-size: 23px; font-weight: 500; }
.chat-prompts { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
#chat-messages { flex: 1; }
.chat-message { margin: 14px 0; padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.chat-message > strong { display: block; margin-bottom: 8px; font-size: 11px; color: var(--primary); }
.chat-message > div { white-space: pre-wrap; font-size: 13px; line-height: 1.7; }
.chat-user { width: fit-content; max-width: 80%; margin-left: auto; padding: 10px 14px; background: var(--primary-soft); border-color: transparent; }
.chat-message > small { display: block; color: var(--muted); font-size: 10px; margin-top: 14px; }
.chat-source { margin: 12px 0 0; padding: 10px 12px; background: #fcfcf9; border: 1px solid var(--line); border-radius: 6px; }
.chat-source summary { font-size: 12px; color: var(--primary); }
.chat-source p, .chat-source a { font-size: 11px; margin-top: 8px; }
.chat-source a { color: var(--primary); }
.chat-evidence { overflow: auto; max-height: 320px; white-space: pre-wrap; font-size: 11px; line-height: 1.5; }
.chat-source summary span { color: var(--muted); font-weight: 400; }
.source-body { margin-top: 10px; }
.source-figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 16px; margin: 0 0 10px; }
.source-figures dt { font-size: 10px; color: var(--muted); }
.source-figures dd { margin: 2px 0 0; font-size: 12px; font-weight: 500; }
.source-section { margin: 12px 0 0; }
.source-section h4 { margin: 0 0 6px; font-size: 11px; font-weight: 600; color: oklch(0.35 0.03 145); }
.source-section p { font-size: 11px; line-height: 1.5; margin: 0; white-space: pre-wrap; }
.source-table { overflow-x: auto; }
.source-table table { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.source-table th, .source-table td { padding: 5px 8px; min-width: 0; white-space: nowrap; }
.source-table small { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }
.source-figures dd small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
.source-account { margin-top: 6px; }
.source-account > strong { display: block; font-size: 12px; margin-bottom: 6px; }
.source-raw { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.source-raw summary { font-size: 11px; color: var(--muted); }
.change-review { margin: 14px 0 4px; padding: 14px 16px; border: 1px solid var(--primary); border-radius: 8px; background: #fcfcf9; white-space: normal; }
.change-review[data-status=applied] { border-color: var(--line); }
.change-review:not([data-status=pending]):not([data-status=applied]) { border-color: #e9d8b5; }
.change-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.change-review h3 { margin: 0; font-size: 14px; }
.change-operation { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.change-operation h4 { margin: 0; font-size: 13px; }
.change-operation h5 { margin: 14px 0 6px; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.change-subtitle { margin: 2px 0 8px; color: var(--muted); font-size: 12px; }
.change-review .table-wrap { margin-top: 6px; max-height: none; }
.change-review th[scope=row] { position: static; width: 32%; color: inherit; background: transparent; font-size: 12px; white-space: normal; }
.change-review td { white-space: pre-wrap; }
.change-review td:last-child { color: var(--muted); font-size: 11px; }
.change-lines td { white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
.change-lines td:last-child { white-space: normal; min-width: 190px; }
.change-review .change-lines th[scope=row] { width: auto; min-width: 170px; }
.change-notes { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.change-review-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.change-review-actions small { flex: 1; min-width: 200px; color: var(--muted); font-size: 11px; }
.change-review-actions p { margin: 0; font-size: 12px; }
.change-review-actions a { color: var(--primary); font-size: 12px; }
.chat-working { padding: 8px 0; color: var(--primary); }
.chat-composer { position: sticky; bottom: 12px; padding: 10px 12px; margin-top: 12px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px #26332714; }
.chat-composer textarea { display: block; width: 100%; border: 0; padding: 6px 2px; min-height: 52px; max-height: 200px; resize: none; }
.chat-composer textarea:focus-visible { outline: none; }
.chat-composer:focus-within { border-color: var(--primary); }
.chat-composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.chat-model-picker { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.chat-model-picker select { padding: 5px 8px; font-size: 11px; }
.chat-hint { flex: 1; min-width: 0; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-privacy { font-size: 10px; line-height: 1.6; margin: 8px 2px 0; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1000px) {
  .chat { grid-template-columns: 1fr; }
  .chat-sidebar { position: static; order: -1; max-height: 210px; }
  .chat-main { min-height: 0; }
}
#chat-error { padding: 12px; background: #fcf0eb; border-radius: 6px; }
.report-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; color: oklch(0.35 0.04 145); background: var(--primary-soft); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(850px, 94vw); max-height: 92dvh; color: inherit; background: white; box-shadow: 0 16px 70px #26332726; }
dialog::backdrop { background: #20271f50; }
dialog label { display: flex; flex-direction: column; gap: 6px; margin: 9px 0; font-size: 11px; color: var(--muted); }
dialog input, dialog select, dialog textarea { width: 100%; }
dialog p { font-size: 12px; }
dialog ul { font-size: 12px; line-height: 1.7; max-height: 240px; overflow: auto; }
dialog .check { flex-direction: row; align-items: flex-start; line-height: 1.5; }
dialog .check input { width: auto; flex-shrink: 0; }
.dialog-heading { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.dialog-heading h2 { font-size: 18px; }
.form-section-title { margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: -24px; background: white; border-top: 1px solid var(--line); margin-top: 20px; padding: 16px 0 0; }
.component { border: 1px solid var(--line); border-radius: 7px; padding: 12px; margin: 12px 0; background: #fcfcf9; }
.component .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(580px, 100vw); height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; border-left: 1px solid var(--line); padding: 24px; }
dialog.drawer .section-head { align-items: flex-start; }
/* Sign-in is a full page: it covers the app until the session is known, and keeps open forms underneath. */
body.checking-session > .app-sidebar, body.checking-session > main { visibility: hidden; }
#login-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 24px; border: 0; border-radius: 0; box-shadow: none; background: var(--background); }
#login-dialog[open] { display: grid; place-items: center; }
#login-dialog::backdrop { background: var(--background); }
.login-card { width: min(380px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 16px 50px #2633271a; }
#login-dialog .login-brand { min-height: 0; padding: 0 0 22px; margin-bottom: 22px; border: 0; border-bottom: 1px solid var(--line); }
#login-form h1 { margin-bottom: 4px; }
#login-form label { font-size: 12px; margin: 14px 0; }
#login-form input { padding: 10px 12px; font-size: 14px; }
#login-form .primary { width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 13px; }
#login-error { margin: 12px 0 0; }
.login-note { margin: 18px 0 0; font-size: 12px; text-align: center; }
@media (max-width: 1100px) {
  .page-header { align-items: flex-start; flex-wrap: wrap; }
  .section-head { flex-wrap: wrap; }
  .stats { gap: 8px; }
  .summary-card { gap: 8px; padding: 10px; }
  .summary-card .card-hint { display: none; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-sidebar { position: static; width: 100%; }
  .brand { border-bottom: 0; min-height: auto; padding: 14px 16px; }
  .sidebar-footer { position: absolute; right: 12px; top: 13px; padding: 0; border: 0; background: var(--sidebar); }
  .sidebar-footer > .workspace-avatar, .sidebar-footer > div { display: none; }
  #tabs { display: flex; gap: 4px; padding: 0 10px 10px; overflow-x: auto; flex: none; }
  #tabs button { width: auto; flex-shrink: 0; padding: 9px 10px; font-size: 12px; margin: 0; gap: 6px; }
  main { margin-left: 0; }
  .page-header { padding: 16px; }
  .workspace-body { padding: 16px; }
  .recurring-summary { padding: 16px; }
  .toolbar { gap: 10px; }
  .toolbar select { min-width: 95px; }
  .toolbar label, .toolbar .field { flex: 1; }
  .month-button { flex: 1; }
  .stats { grid-template-columns: 1fr; }
  .summary-card { padding: 10px 12px; }
  .summary-card > span:first-child { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; width: 100%; }
  .summary-card span span { align-self: center; }
  .summary-card strong { margin: 0; grid-row: 1 / 3; grid-column: 2; align-self: center; }
  .summary-card small { grid-row: 2; }
  .recurring-metrics { gap: 12px; }
  .recurring-metrics strong { font-size: 22px; }
  .search { flex: 1; min-width: 180px; }
  .search input { width: 100%; }
  #row-count { margin-left: 0; }
  .panel { padding: 16px; }
  .chart { min-width: 480px; }
  div:has(> .chart) { overflow-x: auto; }
  .form-grid, .component .form-grid { grid-template-columns: 1fr; }
  dialog, dialog.drawer { padding: 18px; }
  .dialog-actions { bottom: -18px; }
}
@media (max-width: 430px) {
  .recurring-metrics { grid-template-columns: 1fr; gap: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms, border-color 120ms; }
}
.fx-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.fx-form label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.fx-form input { width: 130px; }
.fx-form .explanation { margin: 0; align-self: center; }

/* Overview insights and purposeful loading states. */
.insight-strip { margin-bottom: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: #f2f5ef; }
.insight-heading { display: flex; align-items: center; gap: 12px; font-weight: 600; margin-bottom: 14px; }
.insight-list { display: flex; flex-direction: column; gap: 16px; }
.insight-list article { display: flex; align-items: flex-start; gap: 12px; }
.insight-list p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.download-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; flex-shrink: 0; }
.download-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#analytics, #reports, #billing, #accounts { position: relative; min-height: 300px; }
.page-skeleton { position: absolute; inset: 0; z-index: 3; background: #fafbf7; padding: 18px; min-height: 360px; }
.skeleton-cards { display: flex; gap: 16px; margin-bottom: 24px; }
.skeleton-cards span { height: 70px; flex: 1; border-radius: 8px; }
.skeleton-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.skeleton-plot { display: flex; gap: 12px; align-items: flex-end; height: 200px; padding: 30px 16px 0; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.skeleton-plot span { flex: 1; border-radius: 4px 4px 0 0; }
.skeleton-row { height: 32px; margin: 14px 0; border-radius: 5px; }
.skeleton-cards span, .skeleton-row, .skeleton-plot span { background: linear-gradient(100deg,#e7ece3 25%,#f4f6f0 50%,#e7ece3 75%); background-size: 200% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .page-enter { animation: page-enter 240ms ease-out; }
  .page-enter .panel { animation: page-enter 300ms ease-out; }
  .skeleton-cards span, .skeleton-row, .skeleton-plot span { animation: shimmer 1.3s linear infinite; }
  .chart .bar { transform-box: fill-box; transform-origin: center bottom; animation: bar-grow 350ms ease-out; }
}
@keyframes page-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes bar-grow { from { transform: scaleY(.05); } to { transform: scaleY(1); } }
@media (max-width: 760px) { .skeleton-charts { grid-template-columns: 1fr; } }

.license-bar-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(70px, 1fr) 64px; align-items: center; gap: 12px; margin: 20px 0; font-size: 12px; }
.license-label { overflow-wrap: anywhere; }
.license-track { height: 14px; border-radius: 4px; background: #eef1e9; overflow: hidden; }
.license-fill { height: 100%; background: #71876d; border-radius: 4px; }
.license-bar-row strong { text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .license-fill { animation: bar-grow-x 350ms ease-out; transform-origin: left; } }
@keyframes bar-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.insight-star { color: #71876d; font-size: 21px; line-height: 1.2; }
.report-disclosure > summary { font-size: 15px; font-weight: 600; cursor: pointer; }
.report-disclosure .section-head { margin-top: 16px; }

.insight-disclosure > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.insight-disclosure > summary .insight-star { margin-right: 6px; }
.insight-disclosure[open] > summary { margin-bottom: 18px; }
.insight-list[hidden] { display: none; }
.insight-progress { color: #71876d; padding: 12px 0; font-size: 13px; }
@media (prefers-reduced-motion: no-preference) { .insight-progress { animation: insight-pulse 900ms ease-in-out infinite alternate; } }
@keyframes insight-pulse { from { opacity: .5; } to { opacity: 1; } }

/* Compact Insights disclosure; expand only when there is content to read. */
.insight-disclosure { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; width: 100%; max-width: 100%; box-sizing: border-box; }
.insight-disclosure > summary { font-size: 13px; line-height: 20px; white-space: nowrap; }
.insight-disclosure > summary .insight-star { font-size: 16px; margin-right: 4px; }
.insight-disclosure[open] { width: 100%; padding: 14px 16px; }
.insight-disclosure[open] > summary { margin-bottom: 12px; }
.insight-disclosure .insight-list { gap: 12px; }
.insight-disclosure .insight-list strong { font-size: 13px; }
.insight-disclosure .insight-list p { margin-top: 4px; font-size: 12px; line-height: 1.5; }
.insight-disclosure .insight-progress { padding: 4px 0; margin: 0; }

.insight-disclosure:not([open]) { padding: 5px 12px; }
.insight-disclosure > summary { text-align: center; list-style: none; line-height: 18px; }
.insight-disclosure > summary::-webkit-details-marker { display: none; }
.insight-disclosure > summary::after { content: '\2304'; display: inline-block; margin-left: 8px; color: var(--muted); }
.insight-disclosure[open] > summary::after { content: '\2303'; }

/* Left-aligned, vertically centred compact Insights label. */
.insight-disclosure > summary { text-align: left; display: flex; align-items: center; gap: 6px; min-height: 18px; }
.insight-disclosure > summary .insight-star { margin-right: 0; line-height: 18px; }
.insight-disclosure > summary::after { margin-left: auto; }

/* Detailed reports use light disclosure rows instead of individual cards. */
#reports > details.panel { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 14px 0; margin: 0; }
#reports > details.panel > summary { font-size: 14px; font-weight: 500; }
#reports > details.panel[open] { padding-bottom: 20px; }
