/* Portal additions on top of ../admin/app.css (shared tokens and components). */

/* ---------- Side menu ----------
   Phones/tablets: slides in over the page from the left (☰), with a dimmed backdrop.
   Wide screens (>= 1024px): sits beside the page; ☰ hides it to give the page full width (remembered). */
:root { --topbar-h: 57px; --nav-w: 248px; }
.topbar { justify-content: flex-start; }
.topbar .who { margin-left: auto; }
.menu-btn { width: 40px; height: 40px; flex: none; display: inline-grid; place-content: center; gap: 4px; padding: 0; border-radius: 10px;
  background: transparent; border: 1px solid var(--line); }
.menu-btn[hidden] { display: none; }
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
body.nav-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .menu-btn span:nth-child(2) { opacity: 0; }
body.nav-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.drawer { position: fixed; z-index: 30; top: var(--topbar-h); left: 0; bottom: 0; width: var(--nav-w); max-width: 86vw; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); padding: 12px 10px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
body:not(.has-nav) .drawer, body.auth-mode .drawer { display: none; }
body.nav-open .drawer { transform: none; box-shadow: 12px 0 40px rgba(16,24,40,.18); }
.scrim { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 25; background: rgba(16,24,40,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) {
  body.has-nav:not(.nav-collapsed):not(.auth-mode) .drawer { transform: none; box-shadow: none; }
  body.has-nav:not(.nav-collapsed):not(.auth-mode) .page { margin-left: max(var(--nav-w), calc((100vw - 1140px) / 2)); }
  .scrim { display: none; }
}
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.nav-head { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 4px 10px; }
.drawer a, .nav-logout { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 500; background: none; border: none; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.drawer a:hover, .nav-logout:hover { background: var(--code-bg); text-decoration: none; }
.drawer a.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 650; }
.drawer svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-foot { margin-top: auto; }
.nav-logout { color: var(--bad); }
.nav-who { font-size: 12px; color: var(--muted); padding: 6px 10px 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .who-email { display: none; } }

/* ---------- Company line: name + traffic light + "Live · synced 2 min ago" (tap for details) ---------- */
.company-line { margin: 0 0 12px; }
.company-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.company-name { margin: 0; font-size: 20px; }
.company-select { font-size: 17px; font-weight: 650; padding: 6px 30px 6px 10px; max-width: 100%; }
.sync-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.sync-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sync-chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: live 2s ease-in-out infinite; }
.sync-chip.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.sync-chip.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.sync-chip.warn { color: var(--warn); } .sync-chip.bad { color: var(--bad); }
@keyframes live { 50% { box-shadow: 0 0 0 5px var(--ok-bg); } }
.sync-detail { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line); background: var(--panel); }
.sync-detail[hidden] { display: none; }
.sync-detail.warn { background: var(--warn-bg); } .sync-detail.bad { background: var(--bad-bg); }
@media (prefers-reduced-motion: reduce) { .sync-chip.ok .dot { animation: none; } .drawer, .scrim { transition: none; } }
.status-panel { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.status-panel.ok   { border-left: 4px solid var(--ok); }
.status-panel.warn { border-left: 4px solid var(--warn); background: var(--warn-bg); }
.status-panel.bad  { border-left: 4px solid var(--bad); background: var(--bad-bg); }
.status-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.status-panel .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-panel.ok .dot { background: var(--ok); }
.status-panel.warn .dot { background: var(--warn); }
.status-panel.bad .dot { background: var(--bad); }
.status-times { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.status-times strong { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .tabs { flex-wrap: wrap; } }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }

/* Trial Balance: Particulars wraps, Debit/Credit stay on one line; on phones the three columns share the width. */
.tb-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.tb-table td.num, .tb-table th.num { white-space: nowrap; width: 1%; }
@media (max-width: 600px) {
  .table-wrap.fit { margin: 0 -6px; }
  .tb-table { table-layout: fixed; font-size: 12.5px; }
  .tb-table th:first-child { width: auto; }
  .tb-table th.num, .tb-table tbody:only-child td.num { width: 31%; }   /* Day Book tables have no header row */
  .tb-table th, .tb-table td { padding: 8px 5px; }
  .tb-table th { font-size: 10.5px; letter-spacing: .2px; }
  .tb-table td.indent { padding-left: 12px; }
  .tb-table td.num { letter-spacing: -.2px; }
  .tb-table td:first-child { line-height: 1.3; }
}
tr.group td { font-weight: 600; background: var(--code-bg); }
tr.subtotal td { font-weight: 600; color: var(--muted); }
tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
td.indent { padding-left: 24px; }

.voucher { border-bottom: 1px solid var(--line); padding: 10px 0; }
.voucher-head { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.voucher-head strong { min-width: 90px; }
.voucher table { margin-top: 6px; }
.voucher td { border-bottom: none; padding: 3px 8px; }

.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }

/* ---------- Reports: headline tiles, charts ---------- */
/* Categorical series colours in fixed order (validated palette; dark mode has its own steps). Chart chrome uses ink. */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --chart-grid: #e1e0d9; --chart-axis: #c3c2b7; --chart-ink: #52514e; --chart-muted: #898781;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --chart-grid: #2c2c2a; --chart-axis: #383835; --chart-ink: #c3c2b7; --chart-muted: #898781;
  }
}
.s1 { fill: var(--s1); background: var(--s1); } .s2 { fill: var(--s2); background: var(--s2); }
.s3 { fill: var(--s3); background: var(--s3); } .s4 { fill: var(--s4); background: var(--s4); }
.s5 { fill: var(--s5); background: var(--s5); } .s6 { fill: var(--s6); background: var(--s6); }
.s7 { fill: var(--s7); background: var(--s7); } .s8 { fill: var(--s8); background: var(--s8); }

.report-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; }
.report-head h2 { margin: 0; }
.report-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.export-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.export-btns a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--text); background: var(--panel); }
.export-btns a:hover { text-decoration: none; border-color: var(--accent); }
.export-btns .fmt { font-size: 10px; font-weight: 700; letter-spacing: .3px; padding: 1px 5px; border-radius: 4px; color: #fff; }
.export-btns .fmt.xlsx { background: #1d6f42; } .export-btns .fmt.pdf { background: #c0392b; }

/* Report header: a brand-gradient band with the title, company, period and the biggest move. */
.report-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px; margin: 4px 0 14px; border-radius: 16px; color: #fff;
  background: radial-gradient(600px 240px at 0% 0%, var(--brand-3) 0%, transparent 70%), linear-gradient(135deg, var(--brand-1), var(--brand-2)); }
.report-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  border: 30px solid rgba(255,255,255,.08); pointer-events: none; }
.report-hero > * { position: relative; z-index: 1; }
.report-hero h2 { margin: 0; font-size: 22px; letter-spacing: .2px; }
.report-hero .sub { opacity: .85; font-size: 13px; margin-top: 4px; }
.hero-line { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 13px; font-weight: 600; }
.report-hero .export-btns a { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; backdrop-filter: blur(4px); }
.report-hero .export-btns a:hover { background: rgba(255,255,255,.24); border-color: #fff; }

/* Headline tiles: icon, animated number, change vs last year, and a sparkline of the months along the bottom. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 16px; }
@media (max-width: 420px) {
  .kpis { gap: 10px; }
  .kpi { padding: 12px 12px 0; min-height: 120px; }
  .kpi .value { font-size: 22px; }
  .kpi .spark { width: calc(100% + 24px); margin: auto -12px 0; }}
.kpi { --tint: var(--s1); position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 14px 0; display: flex; flex-direction: column; min-height: 132px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
  transition: transform .18s ease, box-shadow .18s ease; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.08); }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tint); opacity: .85; }
.kpi.tint1 { --tint: var(--s1); } .kpi.tint2 { --tint: var(--s2); } .kpi.tint3 { --tint: var(--s3); }
.kpi.tint4 { --tint: var(--s4); } .kpi.tint5 { --tint: var(--s5); } .kpi.tint7 { --tint: var(--s7); }
.kpis .kpi:nth-child(2) { animation-delay: 50ms; } .kpis .kpi:nth-child(3) { animation-delay: 100ms; }
.kpis .kpi:nth-child(4) { animation-delay: 150ms; } .kpis .kpi:nth-child(5) { animation-delay: 200ms; } .kpis .kpi:nth-child(6) { animation-delay: 250ms; }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); }
.kpi-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi .exact { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-change { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 6px; font-size: 12px; }
.kpi-change .basis { color: var(--muted); }
.badge-change { padding: 1px 7px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-change.good { background: var(--ok-bg); color: var(--ok); }
.badge-change.bad { background: var(--bad-bg); color: var(--bad); }
.badge-change.neutral { background: var(--code-bg); color: var(--muted); }
.kpi .spark { display: block; width: calc(100% + 28px); height: 38px; margin: auto -14px 0; padding-top: 8px; }
.spark-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ls1 { stroke: var(--s1); } .ls2 { stroke: var(--s2); } .ls3 { stroke: var(--s3); } .ls4 { stroke: var(--s4); }
.ls5 { stroke: var(--s5); } .ls6 { stroke: var(--s6); } .ls7 { stroke: var(--s7); } .ls8 { stroke: var(--s8); }
.gs1 stop { stop-color: var(--s1); } .gs2 stop { stop-color: var(--s2); } .gs3 stop { stop-color: var(--s3); } .gs4 stop { stop-color: var(--s4); }
.gs5 stop { stop-color: var(--s5); } .gs6 stop { stop-color: var(--s6); } .gs7 stop { stop-color: var(--s7); } .gs8 stop { stop-color: var(--s8); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 14px; margin-bottom: 16px; }
.chart-card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: box-shadow .18s ease; animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.chart-card:hover { box-shadow: 0 10px 28px rgba(16,24,40,.08); }
.chart-card figcaption { font-weight: 650; font-size: 15px; margin-bottom: 10px; }
/* Columns grow up from the baseline, areas draw in, slices fade round; all off for reduced motion. */
.chart-svg .col { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-up .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.area-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; animation: draw 1.1s ease-out both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.area-fill { animation: fade .9s ease-out .2s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.area-dot { fill: var(--panel); stroke-width: 2; opacity: 0; transition: opacity .15s, r .15s; }
.area-dot.on { opacity: 1; r: 5; }
.crosshair { stroke: var(--chart-axis); stroke-dasharray: 3 3; }
.avg-line { stroke: var(--chart-muted); stroke-dasharray: 4 4; stroke-width: 1; }
.avg-text { fill: var(--chart-muted); font-size: 11px; }
.peak-tag rect { fill: var(--text); }
.peak-tag .peak-text { fill: var(--panel); font-size: 11px; font-weight: 700; }
.peak-tag { animation: fade .4s ease-out .6s both; }
.donut .slice { transform-box: view-box; transform-origin: 90px 90px; transition: transform .15s ease; animation: pop .6s cubic-bezier(.2,.8,.2,1) both; }
.donut .slice:hover { transform: scale(1.04); }
@keyframes pop { from { opacity: 0; transform: scale(.85) rotate(-20deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .kpi, .chart-card, .chart-svg .col, .area-line, .area-fill, .peak-tag, .donut .slice { animation: none; }
  .bar-fill { transition: none; }
}
.chart-box { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--chart-muted); font-size: 11px; }
.chart-svg .label { fill: var(--chart-ink); font-size: 12px; }
.chart-svg .value { fill: var(--chart-ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-svg .hit:hover { fill: var(--text); fill-opacity: .04; }
/* Ranking bars as page elements: readable at any width. */
.bar-list { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; align-items: center; gap: 10px; font-size: 13px; padding: 2px 0;
  border-radius: 6px; }
.bar-row:hover { background: var(--code-bg); }
.bar-label { color: var(--chart-ink); display: flex; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-rank { flex: none; order: -1; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--code-bg); color: var(--muted); }
.bar-rank.top { background: color-mix(in srgb, var(--s1) 16%, transparent); color: var(--s1); }
.bar-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar-fill { display: block; height: 14px; border-radius: 0 7px 7px 0; flex: none; max-width: calc(100% - 64px);
  background: linear-gradient(90deg, color-mix(in srgb, var(--s1) 55%, transparent), var(--s1));
  transition: width .7s cubic-bezier(.2,.8,.2,1); }
.bar-value { color: var(--chart-ink); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.bar-detail { color: var(--muted); font-size: 12px; white-space: nowrap; }
.bar-detail::before { content: "· "; }
.bar-track { flex-wrap: wrap; row-gap: 2px; }
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 1fr; gap: 2px; padding: 3px 0; }
  .bar-label { justify-content: flex-start; }
  .bar-name { white-space: normal; }
}
.chart-svg[width] { width: 100%; max-width: 100%; }
/* Donut (parts of one whole): ring beside its legend; stacked on narrow screens. */
.donut-wrap { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.donut { flex: none; width: 180px; height: 180px; }
.donut .ring { fill: none; }
.donut .ring.s1 { stroke: var(--s1); } .donut .ring.s2 { stroke: var(--s2); } .donut .ring.empty { stroke: var(--chart-grid); }
.donut .donut-total { fill: var(--text); font-size: 26px; font-weight: 700; }
.donut .tick { fill: var(--chart-muted); font-size: 11px; }
.donut-wrap .chart-legend { margin: 0; flex: 1; min-width: 180px; }
@media (max-width: 520px) { .donut-wrap { justify-content: center; } }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--chart-ink); margin-top: 6px; }
.chart-legend.split { flex-direction: column; font-size: 13px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); white-space: nowrap; }
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }

.report-table { margin-top: 8px; }
.report-table h3 { font-size: 15px; margin: 18px 0 8px; }
.report-table td.num, .report-table th.num { font-variant-numeric: tabular-nums; }
.report-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.report-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
/* Month-by-month tables: a soft bar behind each amount (per column, in its series colour), best month bold. */
.bar-cell { position: relative; z-index: 0; }
.bar-cell::before { content: ""; position: absolute; z-index: -1; right: 6px; top: 22%; bottom: 22%; width: calc(var(--w) * .9); max-width: calc(100% - 12px);
  border-radius: 4px; background: color-mix(in srgb, var(--bar) 18%, transparent); }
.bar-cell.neg::before { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.bar-cell.best { font-weight: 700; }
.bar-cell.best::before { background: color-mix(in srgb, var(--bar) 32%, transparent); }
.bc1 { --bar: var(--s1); } .bc2 { --bar: var(--s2); } .bc3 { --bar: var(--s3); } .bc4 { --bar: var(--s4); }
.bc5 { --bar: var(--s5); } .bc6 { --bar: var(--s6); } .bc7 { --bar: var(--s7); } .bc8 { --bar: var(--s8); }
.more-rows { margin-top: 8px; }
.tabs a.sep { margin-left: 8px; border-left: 1px solid var(--line); padding-left: 14px; }

/* ---------- Ask SakhaSync (mobile first: chat with the input bar at the bottom) ---------- */
.ask-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - 190px); }
.ask-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.ask-head h2 { margin: 0; }
.ask-plan { font-size: 13px; color: var(--muted); flex: 1; }
.ask-log { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.ask-msg { max-width: min(88%, 640px); padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.45; word-wrap: break-word; }
.ask-msg p { margin: 0 0 6px; } .ask-msg p:last-child { margin-bottom: 0; }
.ask-msg ul { margin: 4px 0 6px; padding-left: 20px; } .ask-msg li { margin: 2px 0; }
.ask-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.ask-msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ask-msg.thinking { display: flex; align-items: center; gap: 10px; }
/* Under each answer: the period its figures cover, and Listen. */
.ask-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ask-period { font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 3px 9px; border-radius: 999px; }
.ask-listen { margin-left: auto; font-size: 12px; padding: 4px 10px; min-height: 30px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); }
.ask-voice { font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.ask-voice.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.dots { display: inline-flex; gap: 4px; } .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: ask-dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ask-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ask-welcome { text-align: center; padding: 12px 4px; }
.ask-welcome h2 { margin: 6px 0 4px; font-size: 20px; }
.ask-spark { width: 48px; height: 48px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3)); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: 14px;
  text-align: left; min-height: 40px; }
.chip:hover { border-color: var(--accent); }
.ask-recent { text-align: left; max-width: 560px; margin: 8px auto 0; }
.ask-recent h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.ask-recent .recent { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 10px 2px; color: var(--text); font-size: 14px; min-height: 44px; }
.ask-bar { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 6px;
  border-top: 1px solid var(--line); }
.ask-lang { justify-self: start; font-size: 13px; padding: 4px 8px; }
.ask-input { display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 6px 6px 6px 14px; }
.ask-input:focus-within { border-color: var(--accent); }
.ask-input textarea { flex: 1; border: none; outline: none; resize: none; background: transparent; color: var(--text); font: inherit;
  font-size: 16px; padding: 8px 0; max-height: 120px; }
.ask-mic, .ask-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; font-size: 18px; display: grid; place-items: center; }
.ask-mic { background: var(--code-bg); }
.ask-mic.listening { background: var(--bad); color: #fff; animation: ask-pulse 1.2s infinite; }
@keyframes ask-pulse { 0% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .5); } 100% { box-shadow: 0 0 0 12px rgba(180, 35, 24, 0); } }
.ask-send { background: var(--accent); color: var(--accent-text); }
.ask-send:disabled { opacity: .5; }
.ask-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; padding: 12px 18px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(29, 63, 184, .35); }
.ask-fab:hover { text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .dots i, .ask-mic.listening { animation: none; } }

/* Settings > Alerts */
.alerts .alert-company { max-width: 360px; margin-bottom: 12px; }
.rules { display: grid; gap: 4px; }
.rule { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; cursor: pointer; }
.rule > input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.rule-text { display: grid; gap: 4px; line-height: 1.9; }
.rule-text strong { line-height: 1.3; }
.rule-text > span { color: var(--muted); }
.rule .num-in { width: 84px; padding: 4px 8px; display: inline-block; }
.rule .tiers-in { width: 110px; padding: 4px 8px; display: inline-block; }
.rule:has(> input:not(:checked)) .rule-text { opacity: .55; }
.rules button { justify-self: start; margin-top: 12px; }
.recipient { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 10px; }
.recipient-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; overflow-wrap: anywhere; }
.recipient-head .badge { margin-left: auto; }
.recipient-when { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.recipient-when label { display: grid; gap: 4px; }
.recipient-when select[hidden] { display: none; }
.recipient-when label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; min-height: 40px; }
.recipient-when label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.recipient-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
@media (max-width: 520px) { .recipient-when > label:not(.check) { flex: 1 1 100%; } }

/* Settings */
.subtabs { display: flex; gap: 6px; margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); white-space: nowrap; background: var(--panel); }
.subtabs a:hover { text-decoration: none; color: var(--text); }
.subtabs a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.who a.settings-link { font-size: 20px; line-height: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.notice.warn button { margin-left: auto; }
.small-print { font-size: 13px; margin: 8px 0 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
h3 { font-size: 15px; margin: 18px 0 10px; }
.settings-form { max-width: 420px; }
.data-company { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 10px; }
.data-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.data-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.data-row label { flex: 1 1 220px; max-width: 360px; }
.data-row select { width: 100%; }
button.danger-outline { color: var(--bad); border-color: var(--bad); background: transparent; }
.erase-box { margin-top: 10px; padding: 12px; border: 1px solid var(--bad); border-radius: 10px; background: var(--bad-bg); display: grid; gap: 10px; }
.erase-box[hidden] { display: none; }
.erase-box p { margin: 0; }
.erase-box input { width: 100%; max-width: 360px; }
.erase-box button.danger { justify-self: start; background: var(--bad); color: #fff; border-color: var(--bad); }
.erased { border-top: 1px solid var(--line); padding-top: 12px; }

/* Partner (CA) access */
.client-note { font-size: 13px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.checks-head { flex: 1 1 100%; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.partner { border-top: 1px solid var(--line); padding: 12px 0; display: grid; gap: 6px; justify-items: start; }
.partner-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; overflow-wrap: anywhere; }
.partner-past summary, .remind-bills summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.client-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* Statements (P&L, Balance Sheet), ledger links, chart taps */
.report-table.statement tr.group td { font-weight: 600; background: var(--panel-2, rgba(127,127,127,.06)); }
.report-table.statement td.indent { padding-left: 22px; }
a.ledger-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.ledger-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.chart-hint { float: right; font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.chart-card.can-pick .hit.pick, .bar-row.pick { cursor: pointer; }
.bar-row.pick:hover .bar-name, .bar-row.pick:focus-visible .bar-name { color: var(--accent); text-decoration: underline; }
.back-link { display: inline-block; margin: 0 0 8px; font-size: 14px; }
@media (max-width: 600px) {
  .tb-table.ledger-table th.num, .tb-table.ledger-table tbody td.num { width: 24%; }
  .tb-table.ledger-table td:first-child { font-size: 12px; }
}

/* Payment reminders: one card per customer, actions as big buttons for thumbs */
.remind-list { display: grid; gap: 10px; }
.remind-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.remind-card[hidden] { display: none; }
.remind-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.remind-head strong { overflow-wrap: anywhere; }
.remind-amt { font-weight: 700; font-size: 17px; white-space: nowrap; }
.remind-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.remind-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.remind-actions button { min-height: 38px; }
button.wa { background: #25d366; border-color: #25d366; color: #fff; font-weight: 600; }
.remind-email { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.remind-email[hidden] { display: none; }
.remind-email input, .remind-email textarea { width: 100%; }
.remind-bills .table-wrap { margin-top: 4px; }
td.late { color: var(--bad); }
input[type="search"] { width: 100%; max-width: 360px; margin: 0 0 10px; }
@media (max-width: 520px) { .remind-actions button { flex: 1 1 auto; } }

@media print {
  .ask-fab { display: none !important; }
  .export-btns, .more-rows { display: none !important; }
  .chart-card, .kpi { break-inside: avoid; }
}

@media print {
  .no-print, .tabs, .filters, .topbar { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: none; padding: 0; }
}
