/* Split — one plain look, light and dark. Tokens first; every text colour is ≥ 4.5:1 on every surface it sits on. */
:root {
  --bg: #f4f6f3; --panel: #ffffff; --panel-2: #eef2ee; --ink: #18201c; --ink-2: #4a5550; --line: #dde3de;
  --accent: #12704f; --accent-strong: #12704f; --on-accent: #ffffff; --accent-text: #0f6647; --accent-soft: #dff1e8;
  --good: #0d6b45; --bad: #b23c17; --bad-soft: #fbe8e1; --focus: #12704f; --shadow: 0 1px 2px rgba(20,30,25,.06), 0 4px 16px rgba(20,30,25,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar Text", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121513; --panel: #1b1f1c; --panel-2: #232925; --ink: #eef2ef; --ink-2: #a9b3ad; --line: #2e3530;
  --accent: #3fbf8f; --accent-strong: #2fae7f; --on-accent: #06231a; --accent-text: #62d3a7; --accent-soft: #19362b;
  --good: #62d3a7; --bad: #ff9575; --bad-soft: #3a221b; --focus: #62d3a7; --shadow: none; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #121513; --panel: #1b1f1c; --panel-2: #232925; --ink: #eef2ef; --ink-2: #a9b3ad; --line: #2e3530;
  --accent: #3fbf8f; --accent-strong: #2fae7f; --on-accent: #06231a; --accent-text: #62d3a7; --accent-soft: #19362b;
  --good: #62d3a7; --bad: #ff9575; --bad-soft: #3a221b; --focus: #62d3a7; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
:lang(my) body, :lang(my) { line-height: 1.7; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.good { color: var(--good); } .bad { color: var(--bad); }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 19px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-size: 20px; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: var(--panel-2); }
main { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(env(safe-area-inset-bottom) + 96px); }

/* pieces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.fab { position: fixed; right: max(16px, calc(50vw - 304px)); bottom: calc(env(safe-area-inset-bottom) + 18px); z-index: 15; min-height: 52px; padding: 0 20px;
  border-radius: 26px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 16px; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.in { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.in:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
input[type="date"].in { -webkit-appearance: none; appearance: none; }
.in.code { font-family: var(--mono); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.in.amount { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.amount-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip.icon { width: 44px; padding: 0; font-size: 20px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions .grow { flex: 1; }
.hint { font-size: 14px; color: var(--ink-2); margin: 0; }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 0; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 2px 8px; }
.section-h h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.empty { text-align: center; padding: 36px 18px; color: var(--ink-2); }
.empty .big { font-size: 44px; display: block; margin-bottom: 6px; }
.loading { text-align: center; padding: 40px; color: var(--ink-2); }

/* sign in */
.auth { max-width: 420px; margin: 6vh auto 0; display: grid; gap: 18px; }
.auth .logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto; display: block; }
.auth h1 { margin: 0; text-align: center; font-size: 26px; }
.auth .tag { text-align: center; margin: -10px 0 0; }
.auth .card { padding: 18px; }
.code-box { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: .06em; text-align: center; padding: 16px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text); user-select: all; word-break: break-all; }

/* lists */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; border: 0; border-top: 1px solid var(--line); background: transparent;
  width: 100%; text-align: left; cursor: pointer; text-decoration: none; color: var(--ink); }
.row:first-child { border-top: 0; }
button.row:hover, a.row:hover { background: var(--panel-2); }
.card > .row:first-child { border-radius: 16px 16px 0 0; } .card > .row:last-child { border-radius: 0 0 16px 16px; } .card > .row:only-child { border-radius: 16px; }
.row .ico { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--panel-2); }
.row .ico.pay { background: var(--accent-soft); }
.row .main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row .main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main small { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { text-align: right; flex: none; display: grid; gap: 1px; font-size: 14px; }
.row .side small { font-size: 12px; color: var(--ink-2); }
.row .side .num { font-size: 15px; font-weight: 650; }
.day-h { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 16px 4px 6px; }
.av { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--accent-soft); color: var(--accent-text); }
.av.ghost { background: var(--panel-2); color: var(--ink-2); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 8px; background: var(--panel-2); color: var(--ink-2); vertical-align: 2px; margin-left: 4px; }

/* group page */
.g-head { display: flex; align-items: center; gap: 12px; margin: 4px 2px 12px; }
.g-head .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: var(--panel); border: 1px solid var(--line); }
.g-head h2 { margin: 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.summary { padding: 14px 16px; display: grid; gap: 4px; }
.summary .line { font-size: 17px; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel-2); margin: 14px 0 4px; }
.tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 650; font-size: 14px; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.bal-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 4px; }
.bal-bar i { display: block; height: 100%; border-radius: 3px; }
.bal-bar i.good { background: var(--good); } .bal-bar i.bad { background: var(--bad); }
.settle { padding: 6px 0; }
.settle .row { cursor: default; }
.ccy-h { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 14px 4px 6px; }
.note-banner { padding: 10px 14px; border-radius: 12px; background: var(--panel-2); color: var(--ink-2); font-size: 14px; margin: 10px 0; }

/* split editor */
.who { display: grid; gap: 0; }
.who-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 2px; border-top: 1px solid var(--line); }
.who-row:first-child { border-top: 0; }
.who-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-row .part { font-size: 14px; color: var(--ink-2); }
.who-row .in { width: 112px; flex: none; text-align: right; font-family: var(--mono); }
.who-row .in.sh { width: 76px; }
.check { width: 26px; height: 26px; flex: none; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; background: var(--panel); cursor: pointer; padding: 0; }
.check[aria-checked="true"] { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.check[aria-checked="true"]::after { content: "✓"; font-weight: 800; font-size: 15px; }
.tally { font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); }
.tally.bad { background: var(--bad-soft); }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.4); }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 18px);
  overscroll-behavior: contain; animation: up .18s ease-out; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet-h { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; background: var(--bg); }
.sheet-h h2 { flex: 1; margin: 0; font-size: 19px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%); z-index: 300; max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
