/* Trimly styles. System fonts only, so the page stays light on weak internet. */
:root {
  --bg:#EEF2F8; --card:#FFFFFF; --ink:#16202F; --muted:#5E6C82; --line:#DCE3EE;
  --accent:#2747F0; --accent-ink:#FFFFFF; --warn:#D9480F; --warn-bg:#FFF1E8; --danger:#C92A2A;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0F1624; --card:#18223A; --ink:#EAF0FB; --muted:#9AA8C2; --line:#2A3654;
    --accent:#6F86FF; --accent-ink:#0F1624; --warn:#FF9A62; --warn-bg:#3A2418; --danger:#FF8787;
  }
}
*, *::before, *::after { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; background:var(--bg); color:var(--ink); font-size:16px; line-height:1.45;
  font-family:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
main { max-width:520px; margin:0 auto; padding:20px 16px 48px; }
button, input, select { font:inherit; color:inherit; }

.top { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:16px; }
.top h1 { margin:0; font-size:1.5rem; font-weight:800; letter-spacing:-.02em; }
.tagline { color:var(--muted); margin:0 0 20px; }

.btn { background:var(--accent); color:var(--accent-ink); border:0; border-radius:12px;
  padding:11px 16px; font-weight:700; cursor:pointer; min-height:46px; }
.btn.ghost { background:transparent; color:var(--ink); border:1.5px solid var(--line); }
.btn.big { width:100%; min-height:60px; font-size:1.1rem; border-radius:14px; }
.btn[disabled] { opacity:.6; cursor:wait; }
.link { background:none; border:0; padding:6px 0; color:var(--accent); font-size:.9rem; font-weight:600;
  cursor:pointer; white-space:nowrap; text-decoration:none; }
.link.del { color:var(--danger); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .chip:focus-visible,
.seg button:focus-visible, .link:focus-visible, .choice button:focus-visible, .tabs button:focus-visible {
  outline:3px solid var(--accent); outline-offset:2px; }

.card, .panel { background:var(--card); border:1px solid var(--line); border-radius:18px; padding:16px; }
.panel { margin-bottom:14px; }

.tabs { display:flex; gap:6px; background:var(--card); border:1px solid var(--line);
  border-radius:16px; padding:5px; margin-bottom:14px; }
.tabs button { flex:1; border:0; background:transparent; border-radius:12px; padding:13px 6px;
  font-weight:700; font-size:1rem; cursor:pointer; color:var(--muted); }
.tabs button[aria-selected="true"] { background:var(--accent); color:var(--accent-ink); }

.curbar { display:flex; align-items:center; gap:10px; margin-bottom:14px; font-size:.9rem; color:var(--muted); font-weight:600; }
.curbar .choice { flex-wrap:nowrap; overflow-x:auto; padding:2px; }
.choice { display:flex; flex-wrap:wrap; gap:8px; }
.choice button { background:var(--bg); border:1.5px solid var(--line); border-radius:12px;
  padding:10px 14px; font-weight:600; cursor:pointer; min-height:44px; white-space:nowrap; }
.choice button[aria-pressed="true"] { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }

.total { background:var(--accent); color:var(--accent-ink); border-radius:20px; padding:22px 20px; }
.total .big { font-size:2.6rem; font-weight:800; line-height:1.05; letter-spacing:-.02em; overflow-wrap:anywhere; }
.total .big small { font-size:1.1rem; font-weight:600; opacity:.85; letter-spacing:0; }
.total .sub { margin-top:8px; opacity:.92; }
.soon { margin:12px 0 14px; background:var(--warn-bg); color:var(--warn); border-radius:14px; padding:12px 14px; font-weight:700; }
.brk h3 { margin:0 0 12px; font-size:1rem; }
.brow { margin-bottom:10px; }
.brow .t { display:flex; justify-content:space-between; gap:10px; font-size:.9rem; margin-bottom:4px; }
.brow .track { height:8px; background:var(--bg); border-radius:99px; overflow:hidden; }
.brow .fill { height:100%; background:var(--accent); border-radius:99px; }

.bar { display:flex; align-items:center; justify-content:space-between; margin:8px 0 12px; gap:10px; }
.bar h2 { margin:0; font-size:1.15rem; }

label { display:block; font-weight:600; font-size:.9rem; margin:14px 0 6px; }
.chips + label { margin-top:0; }
input, select { width:100%; background:var(--bg); border:1.5px solid var(--line);
  border-radius:12px; padding:12px; min-height:46px; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.chip { background:var(--bg); border:1.5px solid var(--line); border-radius:999px;
  padding:8px 14px; font-size:.9rem; cursor:pointer; min-height:40px; }
.seg { display:flex; gap:6px; }
.seg button { flex:1; background:var(--bg); border:1.5px solid var(--line); border-radius:12px;
  padding:12px 4px; cursor:pointer; font-weight:600; min-height:46px; }
.seg button[aria-pressed="true"] { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.actions { display:flex; gap:10px; margin-top:18px; }
.actions .btn { flex:1; }
.err { color:var(--danger); font-size:.95rem; margin-top:10px; min-height:1.2em; }
.note { color:var(--muted); font-size:.9rem; margin-top:10px; }
.note:empty { display:none; }

.ucards { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ucard { display:block; width:100%; text-align:left; cursor:pointer; border-radius:18px; padding:16px; background:var(--card); border:2px solid var(--line); min-height:64px; }
.ucard[aria-pressed="true"] { border-color:var(--accent); }
.ucard:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.ucard .k { display:block; color:var(--muted); font-size:.85rem; font-weight:600; }
.ucard .v { display:block; font-size:1.4rem; font-weight:800; letter-spacing:-.02em; line-height:1.15; overflow-wrap:anywhere; }
.ucard.owe .v { color:var(--warn); }
.ucard.owed .v { color:var(--accent); }
.ubig { display:flex; gap:10px; margin:14px 0; }
.ubig .btn { flex:1; padding:15px 8px; font-size:1rem; min-height:56px; }
.uh { margin:20px 0 8px; font-size:1.05rem; }
.uitem { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:14px 16px; margin-bottom:10px; }
.uitem.over { border-color:var(--warn); }
.uitem .top { display:flex; justify-content:space-between; gap:10px; align-items:baseline; }
.uitem .who { font-weight:700; overflow-wrap:anywhere; }
.uitem .amt { font-weight:800; white-space:nowrap; }
.uitem .meta { color:var(--muted); font-size:.9rem; margin-top:2px; }
.uitem.over .dueTxt { color:var(--warn); font-weight:600; }
.uitem .btns { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.uitem .btns .btn { padding:9px 14px; font-size:.9rem; min-height:44px; }
.btn.dng { color:var(--danger); }

.list { display:flex; flex-direction:column; gap:10px; }
.item { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:14px 16px;
  display:flex; flex-wrap:wrap; gap:6px 12px; align-items:flex-start; }
.item.due { border-color:var(--warn); }
.item .main { flex:1; min-width:0; }
.item .name { font-weight:700; overflow-wrap:anywhere; }
.item .when { color:var(--muted); font-size:.9rem; }
.item.due .when { color:var(--warn); font-weight:600; }
.item .price { text-align:right; font-weight:800; white-space:nowrap; }
.item .price span { display:block; font-weight:400; color:var(--muted); font-size:.8rem; }
.item .acts { flex-basis:100%; display:flex; flex-wrap:wrap; gap:4px 20px; margin-top:2px;
  padding-top:6px; border-top:1px solid var(--line); }
.cat { display:inline-block; background:var(--bg); border-radius:999px; padding:1px 9px;
  font-size:.75rem; color:var(--muted); margin:2px 0; }
.empty { background:var(--card); border:1.5px dashed var(--line); border-radius:16px;
  padding:22px 18px; text-align:center; color:var(--muted); }
.foot { margin-top:28px; color:var(--muted); font-size:.8rem; text-align:center; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition:transform .1s; }
  .btn:active { transform:scale(.97); }
}
