:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e4e3df;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --accent: #0e7c66;
  --accent-soft: #e2f3ee;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --good: #1a7f37;
  --warn: #b26a00;
  --bad: #c62828;
  --warn-bg: #fff4e0;
  --bad-bg: #fdecec;
  --info-bg: #e8f0fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --line: #2f2f2c;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #34c3a2;
    --accent-soft: #15302a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --good: #4cc26b;
    --warn: #e0a243;
    --bad: #ef6b6b;
    --warn-bg: #2e2412;
    --bad-bg: #321717;
    --info-bg: #16233a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface-1: #1a1a19; --surface-2: #232321; --line: #2f2f2c;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
  --accent: #34c3a2; --accent-soft: #15302a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --good: #4cc26b; --warn: #e0a243; --bad: #ef6b6b; --warn-bg: #2e2412; --bad-bg: #321717; --info-bg: #16233a;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 40px; text-align: center; color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.sec { color: var(--text-secondary); }
.small { font-size: 13px; }
.ar { unicode-bidi: plaintext; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface-1);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 18px; }
.brand img { width: 28px; height: 28px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-secondary); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--text-primary); }
.nav .ico { width: 20px; text-align: center; }
.side .foot { margin-top: 18px; padding: 10px 12px; font-size: 12px; color: var(--text-muted); }
main { padding: 24px 28px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-secondary); font-weight: 600; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.cardhead h2 { margin: 0; }

/* mobile */
.topbar { display: none; }
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    display: block; position: sticky; top: 0; z-index: 5; background: var(--surface-1);
    border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top);
  }
  .topbar .row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 4px; }
  .tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px 12px 10px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a {
    flex: none; padding: 6px 12px; border-radius: 999px; text-decoration: none;
    color: var(--text-secondary); background: var(--surface-2); font-size: 14px; white-space: nowrap;
  }
  .tabs a.on { background: var(--accent); color: #fff; }
  main { padding: 16px 16px 48px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g4.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  h1 { font-size: 21px; }
  .chart text { font-size: 19px; }
  .hero { font-size: 36px; }
}

/* ---------- figures */
.hero { font-size: 44px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.tile .label { font-size: 13px; color: var(--text-secondary); }
.tile .value { font-size: 24px; font-weight: 650; margin-top: 2px; }
.tile .delta { font-size: 13px; margin-top: 2px; color: var(--text-secondary); }
.up-bad { color: var(--bad); } .down-good { color: var(--good); }
.meter { height: 10px; border-radius: 999px; background: var(--info-bg); overflow: hidden; margin: 8px 0 4px; }
.meter > i { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }

/* ---------- lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .amt { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.good { background: var(--accent-soft); color: var(--good); }
.flag { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.flag.warn { background: var(--warn-bg); } .flag.bad { background: var(--bad-bg); } .flag.info { background: var(--info-bg); }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--text-muted); padding: 10px 0; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls input, .controls select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); min-width: 0;
}
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.seg button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 600;
  background: var(--accent); color: #fff;
}
.btn.ghost { background: var(--surface-2); color: var(--text-primary); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.toggle:first-of-type { border-top: 0; }
.toggle input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.toggle input[type=number] { width: 120px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-1); text-align: right; }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { max-width: 420px; width: 100%; padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }
.codes span { background: var(--surface-2); padding: 8px; border-radius: 8px; text-align: center; }
.err { color: var(--bad); min-height: 20px; margin-top: 8px; font-size: 14px; }

/* ---------- charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { opacity: .82; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); margin: 2px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.hbar .track { height: 14px; position: relative; }
.hbar .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--text-primary); color: var(--surface-1);
  padding: 6px 9px; border-radius: 8px; font-size: 12px; line-height: 1.35; max-width: 240px; white-space: pre-line;
}
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 10px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface-1); }
.note { background: var(--info-bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text-secondary); }

/* ================= friendlier v2: section colours, status indicators, bullets ================= */
:root {
  --c-overview: #0e7c66; --c-spending: #2a78d6; --c-cashflow: #4a3aa7; --c-bills: #c98500;
  --c-properties: #1baf7a; --c-vehicles: #eb6834; --c-health: #e0457b; --c-household: #008300;
  --c-invest: #0e8a9a; --c-settings: #6b6a65; --c-security: #c62828; --c-explore: #7a3fd1; --c-merchants: #b5476b; --c-report: #2f6fb0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-overview: #34c3a2; --c-spending: #3987e5; --c-cashflow: #9085e9; --c-bills: #e0a243;
    --c-properties: #2bc490; --c-vehicles: #f07a45; --c-health: #ef7aa3; --c-household: #4cc26b;
    --c-invest: #3cc4d4; --c-settings: #a3a29b; --c-security: #ef6b6b; --c-explore: #a98af0; --c-merchants: #e07a9b; --c-report: #6aa7e8;
  }
}
:root[data-theme="dark"] {
  --c-overview: #34c3a2; --c-spending: #3987e5; --c-cashflow: #9085e9; --c-bills: #e0a243;
  --c-properties: #2bc490; --c-vehicles: #f07a45; --c-health: #ef7aa3; --c-household: #4cc26b;
  --c-invest: #3cc4d4; --c-settings: #a3a29b; --c-security: #ef6b6b; --c-explore: #a98af0; --c-merchants: #e07a9b; --c-report: #6aa7e8;
}
.chip { --c: var(--accent); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-size: 17px; flex: none; }
.chip.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }
.chip.lg { width: 46px; height: 46px; border-radius: 14px; font-size: 22px; }
.nav a .chip { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }
.nav a.on { background: color-mix(in srgb, var(--c) 12%, transparent); }
.nav a.on .label-t { font-weight: 650; color: var(--text-primary); }
.tabs a.on { background: var(--c, var(--accent)); }
.pagehead { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.pagehead h1 { margin: 0; }
.pagehead .bar { height: 4px; width: 46px; border-radius: 4px; background: var(--c); margin-top: 6px; }

/* tiles with icon + tone */
.tile { display: flex; gap: 12px; align-items: flex-start; position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, transparent); }
.tile .tbody { min-width: 0; }
.tone-good { --c: var(--good); } .tone-warn { --c: var(--warn); } .tone-bad { --c: var(--bad); } .tone-info { --c: var(--series-1); }
.delta.good { color: var(--good); } .delta.bad { color: var(--bad); }

/* summary strip */
.strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.strip a { display: inline-flex; gap: 8px; align-items: center; padding: 7px 12px 7px 8px; border-radius: 999px; text-decoration: none;
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--line); font-size: 14px; box-shadow: var(--shadow); }
.strip a b { font-variant-numeric: tabular-nums; }
.strip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* severity rows */
.list li.sev { border-top: 0; margin: 6px 0; padding: 10px 12px; border-radius: 12px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface-1)); }
.list li.sev:first-child { margin-top: 0; }
.sev.bad { --c: var(--bad); } .sev.warn { --c: var(--warn); } .sev.info { --c: var(--series-1); } .sev.good { --c: var(--good); }

/* bullets */
.bul { list-style: none; margin: 0; padding: 0; }
.bul li { position: relative; padding: 8px 0 8px 22px; border-top: 1px dashed var(--line); display: flex; gap: 10px; align-items: baseline; }
.bul li:first-child { border-top: 0; }
.bul li::before { content: ""; position: absolute; left: 4px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); }
.bul li .grow { flex: 1; min-width: 0; }

/* countdown pills */
.pill.soon { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.pill.near { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.pill.later { background: var(--accent-soft); color: var(--good); font-weight: 600; }
.pill.past { background: var(--surface-2); color: var(--text-muted); }
.legend-s { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.legend-s span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--c); }

/* money direction */
.in { color: var(--good); } .out { color: var(--text-primary); }

/* category rows */
.cat { display: grid; grid-template-columns: 30px minmax(80px, 32%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.cat .track { height: 12px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.cat .track i { position: absolute; inset: 0 auto 0 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.cat .pct { color: var(--text-muted); font-size: 12px; margin-left: 6px; }

/* section cards with coloured top edge */
.card.accent { border-top: 3px solid var(--c); }
.cardhead .left { display: flex; gap: 10px; align-items: center; }
.big { font-size: 28px; font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--text-secondary); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.tile .tbody { flex: 1; }
.tile .value { font-size: clamp(18px, 1.9vw, 24px); overflow-wrap: anywhere; }
@media (max-width: 860px) { .tile .value { font-size: 20px; } .tile .chip { width: 30px; height: 30px; font-size: 15px; } }
.grid > .card, .grid > .grid { margin-top: 0 !important; }

/* ask & explore */
.askrow { display: flex; gap: 8px; }
.askrow input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px; border: 2px solid color-mix(in srgb, var(--c-explore) 40%, var(--line)); border-radius: 12px; background: var(--surface-1); }
.askrow input:focus { outline: none; border-color: var(--c-explore); }
.askrow .btn { background: var(--c-explore); }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sugg .pill { border: 0; cursor: pointer; font-size: 13px; padding: 4px 10px; background: color-mix(in srgb, var(--c-explore) 12%, transparent); color: var(--text-primary); }
.cardchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cchip { display: flex; gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface-1); }
.cchip .tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; color: #fff; flex: none; }
.cchip.on { border-color: var(--c-explore); background: color-mix(in srgb, var(--c-explore) 8%, var(--surface-1)); }
.cchip.on .tick { background: var(--c-explore); border-color: var(--c-explore); }
.answer .big { font-size: 22px; }
@media (max-width: 860px) { .answer .big { font-size: 19px; } .askrow .btn { padding: 10px 12px; } }

/* merchants & cards */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cardbox { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 6px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c-merchants) 10%, var(--surface-1)), var(--surface-1)); }
.cardtop { display: flex; justify-content: space-between; font-weight: 650; }
.cardtop .bank { color: var(--text-secondary); }
.cname { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); font-weight: 600; }
.rawlist { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.rawlist .pill { font-size: 11px; }
.editbox { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 8px; background: var(--surface-2); border-radius: 10px; }
.editbox input, .editbox select, .mergebar input, .mergebar select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-1); }
.mergebar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--c-merchants) 10%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--c-merchants) 35%, var(--line)); }
a.fix { text-decoration: none; opacity: .45; font-size: 12px; } a.fix:hover { opacity: 1; }
.mergebar[hidden] { display: none; }

/* page actions (export) */
.pagehead .grow { flex: 1; min-width: 0; }
.pageactions { display: flex; gap: 6px; flex-wrap: wrap; align-self: flex-start; }
@media (max-width: 860px) { .pagehead { flex-wrap: wrap; } .pageactions { width: 100%; } }

/* print / PDF */
@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; color: #000; }
  .side, .topbar, .pageactions, .askrow, .sugg, .controls, .seg, #mseg, .mergebar, .btn, a.fix, .tip, .legend-s { display: none !important; }
  .shell { display: block; }
  main { padding: 0 !important; max-width: none; }
  main::before { content: "Hayati · حياتي — " attr(data-printed); display: block; font-size: 11px; color: #555; margin-bottom: 8px; }
  .card { box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; border-color: #ccc; }
  .card:has(> .seg:only-child), .card:has(> .askrow) { display: none !important; }
  .grid { break-inside: auto; }
  .card.accent { border-top-width: 3px; }
  .list li.sev { break-inside: avoid; }
  .chart text { fill: #444; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* right-to-left (Arabic) */
[dir="rtl"] body { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] th { text-align: right; letter-spacing: 0; text-transform: none; }
[dir="rtl"] td.r, [dir="rtl"] th.r { text-align: left; }
[dir="rtl"] .tile::before { left: auto; right: 0; }
[dir="rtl"] .list li.sev { border-left: 0; border-right: 4px solid var(--c); }
[dir="rtl"] .bul li { padding: 8px 22px 8px 0; }
[dir="rtl"] .bul li::before { left: auto; right: 4px; }
[dir="rtl"] .timeline { padding: 0 14px 0 0; border-left: 0; border-right: 2px solid var(--line); }
[dir="rtl"] .timeline li { padding: 0 10px 12px 0; }
[dir="rtl"] .timeline li::before { left: auto; right: -20px; }
[dir="rtl"] .hbar .track i, [dir="rtl"] .cat .track i { left: auto; right: 0; border-radius: 4px 0 0 4px; }
[dir="rtl"] .cat .pct { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .chart { direction: ltr; }
[dir="rtl"] .cchip { text-align: right; }
[dir="rtl"] .num, [dir="rtl"] .amt { unicode-bidi: plaintext; }
[dir="rtl"] .tip { direction: rtl; text-align: right; }
@media print { [dir="rtl"] main::before { direction: rtl; } }
.cardbox select.cmerge { padding: 6px 8px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-1); font-size: 13px; }
.cardbox .csep { margin-top: 6px; }

/* theme switch */
.themebtn { min-width: 40px; }
.seg.themeseg button { font-size: 14px; }
/* PDFs are always light, whatever the screen theme */
@media print {
  :root:root:root {
    color-scheme: light; --bg: #fff; --surface-1: #fff; --surface-2: #f0efec; --line: #dddcd8;
    --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #7a7974; --accent: #0e7c66; --accent-soft: #e2f3ee;
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --good: #1a7f37; --warn: #b26a00;
    --bad: #c62828; --warn-bg: #fff4e0; --bad-bg: #fdecec; --info-bg: #e8f0fb;
  }
}
