/* WatchYourSociety — design tokens + components */
:root {
  --primary: #173B6C;
  --primary-ink: #0E2748;
  --primary-soft: #E8EEF7;
  --on-primary: #FFFFFF;
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --line: #E3E5E1;
  --line-soft: #F0F1EE;
  --text: #14171C;
  --muted: #5B6270;
  --green: #1D7A4A;  --green-soft: #E3F2E8;
  --red: #B3261E;    --red-soft: #FCE8E6;  --red-line: #F2C7C2;
  --amber: #8A5300;  --amber-soft: #FFF6E5; --amber-line: #F1D9A8;
  --blue-soft: #EEF3EA;
  --shadow: 0 1px 2px rgba(20, 23, 28, .04);
  --radius: 14px;
  --radius-sm: 10px;
  --gold: #C9A45C;
  --hero-bg: #173B6C;
  --hero-ink: #FFFFFF;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hero-bg: #1D3A63; --hero-ink: #F2F6FC;
    --primary: #8FB3E8; --primary-ink: #B9D0F2; --primary-soft: #1B2A40; --on-primary: #0B1626;
    --bg: #0F1114; --surface: #171A1F; --surface-2: #1C2026; --line: #2A2F37; --line-soft: #22262D;
    --text: #EDEFF2; --muted: #A2A9B4;
    --green: #6FD39E; --green-soft: #163325; --red: #FF9A90; --red-soft: #3A1A18; --red-line: #5A2925;
    --amber: #F3C677; --amber-soft: #33270F; --amber-line: #5A4520; --blue-soft: #18241D;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --hero-bg: #1D3A63; --hero-ink: #F2F6FC;
  --primary: #8FB3E8; --primary-ink: #B9D0F2; --primary-soft: #1B2A40; --on-primary: #0B1626;
  --bg: #0F1114; --surface: #171A1F; --surface-2: #1C2026; --line: #2A2F37; --line-soft: #22262D;
  --text: #EDEFF2; --muted: #A2A9B4;
  --green: #6FD39E; --green-soft: #163325; --red: #FF9A90; --red-soft: #3A1A18; --red-line: #5A2925;
  --amber: #F3C677; --amber-soft: #33270F; --amber-line: #5A4520; --blue-soft: #18241D;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
:lang(hi), .hi { font-family: 'Noto Sans Devanagari', var(--font); }
a { color: var(--primary); }
a:hover { color: var(--primary-ink); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 760px; margin: 0 auto; padding: 2px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); outline: none; }
main.wide { max-width: 1120px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 15px; box-shadow: inset 0 -2px 0 var(--gold); }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.brand-holder { flex: 1 1 auto; min-width: 0; }
.brand > div:last-child { min-width: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center;
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%;
  text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 600; position: relative; }
.tab svg { width: 20px; height: 20px; }
.tab[aria-current="page"] { color: var(--primary); font-weight: 700; }
.tab .dot { position: absolute; top: 6px; right: calc(50% - 18px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 1px; width: 224px; flex: 0 0 224px; padding: 16px 10px; background: var(--surface);
    border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
  .sidebar .brand { padding: 0 8px 12px; }
  .sidebar .brand-name { white-space: normal; line-height: 1.25; }
  main, .topbar { max-width: 920px; }
  main.wide { max-width: 1120px; }
  .side-group { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 12px 10px 4px; }
  .side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; font-size: 13.5px; }
  .side-link svg { width: 17px; height: 17px; color: var(--muted); }
  .side-link:hover { background: var(--surface-2); color: var(--text); }
  .side-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
  .side-link[aria-current="page"] svg { color: var(--primary); }
  .side-link .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 10.5px; font-weight: 700; padding: 1px 6px; }
  .mobile-only { display: none; }
  .topbar { justify-content: flex-end; }
  main { padding: 0 28px 40px; }
  .topbar { padding: 14px 28px 6px; }
}

/* ---------- typography ---------- */
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 700; }
.amount-in { color: var(--green); font-weight: 700; }
.amount-out { color: var(--red); font-weight: 700; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- cards ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .grid-3 { gap: 8px; } .grid-3 > .card { padding: 10px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px 8px; }
.card-title { font-weight: 700; font-size: 14px; }
.card.warn { background: var(--amber-soft); border-color: var(--amber-line); box-shadow: none; }
.card.danger { border-color: var(--red-line); border-width: 1.5px; }
.card.ok { background: var(--blue-soft); border-color: transparent; box-shadow: none; }

.hero { background: var(--hero-bg); color: var(--hero-ink); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.hero .label { font-size: 13px; font-weight: 600; opacity: .85; }
.hero .big { font-size: 36px; font-weight: 800; letter-spacing: -1px; line-height: 1.05; }
.hero .chip { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.14); border-radius: 99px; padding: 5px 10px; }
.hero .mini { background: rgba(255,255,255,.08); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.hero .mini .k { font-size: 12px; opacity: .85; }
.hero .mini .v { font-size: 16px; font-weight: 700; }

.stat-tile { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.stat-tile:hover { color: var(--text); border-color: #CBD2DC; }
.icon-box { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.icon-box svg { width: 17px; height: 17px; }
.stat-v { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.stat-v small { font-size: 13px; font-weight: 600; color: var(--muted); }

.progress { height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .6s ease; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--line-soft); min-height: 52px; }
.item:first-child { border-top: none; }
.card-head + .list .item:first-child { border-top: 1px solid var(--line-soft); }
.item .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .title { font-weight: 600; font-size: 13.5px; }
.item .meta { font-size: 12px; color: var(--muted); }
a.item { text-decoration: none; color: var(--text); }
a.item:hover { background: var(--surface-2); color: var(--text); }
.sign { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.sign.in { background: var(--green-soft); color: var(--green); }
.sign.out { background: var(--red-soft); color: var(--red); }
.thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--line-soft); object-fit: cover; flex-shrink: 0; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { width: 36px; height: 36px; opacity: .6; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.badge.paid, .badge.approved, .badge.resolved, .badge.matched, .badge.green { background: var(--green-soft); color: var(--green); }
.badge.overdue, .badge.rejected, .badge.reversed, .badge.red { background: var(--red-soft); color: var(--red); }
.badge.due, .badge.partial, .badge.pending, .badge.open, .badge.unmatched, .badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.in_progress, .badge.blue, .badge.ignored { background: var(--primary-soft); color: var(--primary); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent; font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none;
  background: var(--primary); color: var(--on-primary); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.08); color: var(--on-primary); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 46px; font-size: 15px; border-radius: 11px; }
.btn.xl { min-height: 84px; font-size: 19px; border-radius: 18px; }
.btn.ghost { background: var(--surface); color: var(--primary); border-color: var(--line); }
.btn.ghost:hover { color: var(--primary); border-color: #CBD2DC; filter: none; background: var(--surface-2); }
.btn.success { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.subtle { background: var(--primary-soft); color: var(--primary); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.pill { border-radius: 99px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); cursor: pointer; text-decoration: none; flex-shrink: 0; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
@media (max-width: 899px) { .input, select.input, textarea.input { font-size: 16px; min-height: 42px; } }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[aria-invalid="true"] { border-color: var(--red); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 480px) { .field-row.stack-sm { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--primary); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { cursor: pointer; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; min-height: 34px; display: inline-flex; align-items: center; }
.seg input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.seg input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.choice { display: flex; flex-direction: column; gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-height: 56px; }
.choice label .radio { width: 22px; height: 22px; border-radius: 99px; border: 2px solid #B9C0CA; flex-shrink: 0; display: grid; place-items: center; }
.choice input:checked + label { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice input:checked + label .radio { background: var(--primary); border-color: var(--primary); }
.choice input:checked + label .radio::after { content: ''; width: 10px; height: 6px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.choice input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.file-drop { border: 1.5px dashed #B9C0CA; border-radius: 12px; padding: 14px; text-align: center; background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.file-drop:hover { border-color: var(--primary); }
.preview-img { max-height: 180px; border-radius: 12px; margin: 0 auto; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }

/* ---------- tabs / filters ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex-shrink: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--muted); min-height: 30px; text-decoration: none; }
.chips { gap: 6px; }
.chip-btn[aria-pressed="true"], .chip-btn[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---------- misc ---------- */
.notice-card { display: flex; gap: 12px; align-items: flex-start; }
.notice-card .tag { font-size: 12px; font-weight: 600; color: var(--amber); }
.qr-box { width: 220px; height: 220px; margin: 0 auto; border-radius: 16px; background: #fff; padding: 12px; border: 1px solid var(--line); }
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.code-pill { font-weight: 800; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 4px 8px; letter-spacing: .3px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.kv .k { color: var(--muted); flex-shrink: 0; }
.divider { height: 1px; background: var(--line-soft); }
.callout { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.callout svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.callout.info { background: var(--blue-soft); color: var(--text); }
.callout.info svg { color: var(--green); }
.callout.warn { background: var(--amber-soft); }
.callout.warn svg { color: var(--amber); }
.callout.success { background: var(--green-soft); }
.callout.success svg { color: var(--green); }
.calendar { max-width: 420px; margin: 0 auto; width: 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-h { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-d { aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 700; font-size: 14px; cursor: pointer; padding: 0; position: relative; }
.cal-d:disabled { opacity: .35; cursor: default; }
.cal-d.today { border-color: var(--primary); }
.cal-d[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.cal-dots { display: flex; gap: 3px; height: 6px; }
@media (hover: hover) {
  .cal-d[data-tip]:hover { z-index: 30; }
  .cal-d[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 230px; white-space: pre-line; text-align: left; font-size: 12px; font-weight: 500; line-height: 1.45;
    background: var(--text); color: var(--surface); padding: 8px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); pointer-events: none; }
  .cal-d.tip-l[data-tip]:hover::after { left: 0; transform: none; }
  .cal-d.tip-r[data-tip]:hover::after { left: auto; right: 0; transform: none; }
}
.cal-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--red); }
.cal-dots i.free { background: transparent; }
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; background: var(--surface); }
.slot.taken { background: var(--surface-2); color: var(--muted); }
.slot .s-name { font-weight: 800; }
.slot .s-time { font-size: 12px; color: var(--muted); }
.big-count { font-size: 52px; font-weight: 800; line-height: 1; }
.watch-hero { background: var(--hero-bg); color: var(--hero-ink); border-radius: 22px; padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.watch-hero .sep { border-left: 1px solid rgba(255,255,255,.25); padding-left: 16px; display: flex; flex-direction: column; justify-content: flex-end; }
.skeleton { background: linear-gradient(90deg, var(--line-soft), var(--surface-2), var(--line-soft)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .progress > span { transition: none; } }
.boot { min-height: 60vh; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--muted); }
.boot-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 24px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { main.wide .menu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.menu-tile { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); position: relative; min-width: 0; }
.menu-tile > div:not(.icon-box) { min-width: 0; }
.menu-tile:has(.count) > div:not(.icon-box) { padding-right: 22px; }
.menu-tile:hover { color: var(--text); border-color: #CBD2DC; }
.menu-tile .t { font-weight: 700; font-size: 13.5px; }
.menu-tile .d { font-size: 12px; color: var(--muted); }
.menu-tile .count { position: absolute; top: 10px; right: 10px; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 2px 8px; }
.auth-wrap { max-width: 400px; margin: 12px auto; }

/* ---------- toast & modal ---------- */
.toast-host { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toast-host { bottom: 24px; } }
.toast { background: #14171C; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: tin .2s ease; pointer-events: auto; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal { border: none; border-radius: 16px; padding: 0; width: min(94vw, 480px); max-height: 90vh; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(10, 14, 20, .45); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 800; }

/* ---------- print (receipts) ---------- */
.receipt { background: #fff; color: #14171C; border: 1px solid var(--line); border-radius: 20px; padding: 28px; max-width: 560px; margin: 0 auto; }
.receipt h2 { font-size: 20px; }
.receipt .amt { font-size: 32px; font-weight: 800; }
@media print {
  .sidebar, .tabbar, .topbar, .no-print, .toast-host { display: none !important; }
  body, main { background: #fff !important; padding: 0 !important; }
  .receipt { border: none; }
}

/* ---------- home: the estate panel (balance + building) ---------- */
@media (min-width: 900px) { body.wide .topbar { max-width: 1120px; } }
.home { display: flex; flex-direction: column; gap: 12px; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.alert-strip a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 99px; background: var(--amber-soft); border: 1px solid var(--amber-line);
  color: var(--text); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.alert-strip a svg { color: var(--amber); }
.alert-strip a:hover { color: var(--text); border-color: var(--amber); }

.estate { --e-ink: var(--hero-ink); background: var(--hero-bg); color: var(--e-ink); border-radius: 18px; overflow: hidden; position: relative;
  display: grid; grid-template-columns: 1fr; isolation: isolate; }
.estate::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.07), transparent 60%), linear-gradient(180deg, transparent 70%, rgba(0,0,0,.12)); }
.estate-money { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 2px; }
.em-label { font-size: 12.5px; font-weight: 600; opacity: .8; }
.em-big { font-size: 38px; font-weight: 800; letter-spacing: -1.2px; line-height: 1.1; }
.em-upd { font-size: 11.5px; opacity: .65; }
.em-flows { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 12px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.12); }
.em-flows > div { background: var(--hero-bg); padding: 8px 10px; display: flex; flex-direction: column; }
.em-flows > div { background: color-mix(in srgb, var(--hero-bg) 88%, #fff); }
.em-flows span { font-size: 11.5px; opacity: .75; }
.em-flows b { font-size: 15px; }
.em-mine { margin-top: 10px; display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: 10px; background: #fff; color: #14171C; text-decoration: none; }
.em-mine:hover { color: #14171C; }
.em-mine span:first-child { font-size: 12px; color: #5B6270; font-weight: 600; }
.em-mine b { flex: 1; font-size: 14px; }
.em-mine .em-pay { background: var(--hero-bg); color: #fff; font-size: 12.5px; font-weight: 700; border-radius: 7px; padding: 5px 10px; }
.em-mine.late .em-pay { background: #B3261E; }
.estate-tower { padding: 14px 18px 16px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 10px; }
.et-head { font-size: 13px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.et-sub { font-size: 12px; opacity: .7; }
.tower-link { display: block; text-decoration: none; color: inherit; border-radius: 10px; }
.tower { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.tower .fl { display: grid; grid-template-columns: 18px repeat(8, 1fr); gap: 4px; width: 100%; max-width: 340px; align-items: center; }
.tower .fn { font-size: 9.5px; opacity: .45; text-align: right; padding-right: 3px; font-weight: 600; }
.tower .ground { width: 100%; max-width: 360px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.25); margin-top: 3px; }
.w { display: inline-block; height: 11px; border-radius: 2.5px; background: rgba(255,255,255,.14); }
.legend .w { width: 12px; height: 9px; margin-right: 5px; vertical-align: -1px; }
.w-occ { background: rgba(255,255,255,.55); }
.w-paid { background: var(--gold); box-shadow: 0 0 8px rgba(201,164,92,.55); }
.w-due { background: rgba(255,255,255,.2); }
.w-late { background: #E0705F; }
.w-vacant { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.w-me { outline: 2px solid #fff; outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; opacity: .8; justify-content: center; }
@media (prefers-reduced-motion: no-preference) {
  .tower .fl .w { animation: lit .5s ease both; animation-delay: calc(var(--i) * 45ms + 150ms); }
  @keyframes lit { from { opacity: 0; } }
}
@media (min-width: 760px) {
  .estate { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .estate-money { padding: 24px 26px; justify-content: center; }
  .em-big { font-size: 46px; }
  .estate-tower { border-top: 0; border-left: 1px solid rgba(255,255,255,.1); padding: 20px 26px; }
  .w { height: 14px; }
}
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hs { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.hs:hover { color: var(--text); border-color: #CBD2DC; }
.hs-k { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hs-v { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.hs-v small { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hs-v-text { font-size: 16px; }
.hs-d { font-size: 12px; color: var(--muted); }
.hs .progress { margin: 4px 0 2px; height: 6px; }
@media (max-width: 640px) { .home-stats { grid-template-columns: 1fr 1fr; } .home-stats > :first-child { grid-column: span 2; } }
.home-cols { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 900px) { .home-cols { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }
.foot-note { display: flex; gap: 8px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.notice-mini { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; background: var(--amber-soft); border-color: var(--amber-line); box-shadow: none; }
.notice-mini:hover { color: var(--text); }
.nm-k { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--amber); }
.nm-k span { color: var(--muted); font-weight: 500; margin-left: auto; }
.nm-body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- account block (sidebar foot) ---------- */
.side-foot { margin-top: auto; padding: 10px 0 2px; position: sticky; bottom: -16px; background: var(--surface); padding-bottom: 14px; display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line-soft); }
.me-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 9px; text-decoration: none; color: var(--text); }
.me-chip:hover, .me-chip[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.me-av { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.me-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-out { width: 32px; height: 32px; border-color: transparent; }
@media (min-width: 900px) { .topbar.bare, .topbar.anon { display: none; } main { padding-top: 22px; } }
.side-auth { display: flex; flex-direction: column; gap: 6px; width: 100%; }
/* very large screens: use more of the width */
@media (min-width: 1800px) { main.wide { max-width: 1360px; } main { max-width: 1040px; } .sidebar { width: 248px; flex-basis: 248px; } }
/* small laptops (e.g. 1280 px at 150 %): tighter side bar and gutters */
@media (min-width: 900px) and (max-width: 1100px) { .sidebar { width: 200px; flex-basis: 200px; } main { padding-left: 18px; padding-right: 18px; } }

/* ---------- festival funds ---------- */
.fest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fest-card { padding: 0; overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.fest-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(17,24,39,.12); }
.fest-band { display: flex; align-items: center; gap: 12px; padding: 16px; }
.fest-emoji { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
.fest-emoji.big { font-size: 44px; }
.fest-name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.fest-sub { font-size: 12.5px; opacity: .92; margin-top: 2px; }
.fest-pill { background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 99px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.fest-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.fest-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fest-nums .k, .fest-hero-nums .k { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.fest-nums .v { font-weight: 800; font-size: 15px; }
.fest-hero { border-radius: 20px; padding: 22px; margin-top: 8px; box-shadow: 0 12px 30px rgba(17,24,39,.14); }
.fest-kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .85; }
.fest-title { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 2px 0; color: #fff; }
.fest-hero-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.fest-hero-nums > div { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 14px; padding: 12px; min-width: 0; }
.fest-hero-nums .k { color: rgba(255,255,255,.85); }
.fest-hero-nums .v { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.fest-hero-nums .s { font-size: 12px; opacity: .85; }
.fest-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.25); margin-top: 14px; overflow: hidden; }
.fest-bar span { display: block; height: 100%; border-radius: 99px; background: #fff; transition: width .6s ease; }
.fest-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
@media (max-width: 900px) { .fest-cols { grid-template-columns: 1fr; } }
.fest-pay { display: flex; gap: 16px; align-items: flex-start; }
.fest-pay .qr-box { width: 160px; height: 160px; margin: 0; flex-shrink: 0; padding: 8px; }
@media (max-width: 520px) { .fest-pay { flex-direction: column; align-items: stretch; } .fest-pay .qr-box { margin: 0 auto; width: 190px; height: 190px; }
  .fest-hero-nums { grid-template-columns: 1fr 1fr; } .fest-hero-nums > div:last-child { grid-column: span 2; } .fest-title { font-size: 22px; } }
.fest-flats { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.ff { border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: var(--text); font-size: 13px; }
.ff span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.ff.confirmed { background: var(--green-soft); border-color: transparent; }
.ff.confirmed span { color: var(--green); }
.ff.claimed { background: var(--amber-soft); border-color: transparent; }
.ff.claimed span { color: var(--amber); }
a.ff:hover { color: var(--text); outline: 2px solid var(--green); }
.fest-receipt { margin: 4px auto 0; width: 100%; max-width: 560px; }
@media print { .fest-receipt table { box-shadow: none !important; } }
.fest-spend { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fs { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; cursor: pointer; color: var(--text); font: inherit; }
.fs:hover { border-color: #CBD2DC; }
.fs.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.fs.none { opacity: .7; }
.fs-dot { grid-row: span 3; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.fs-name { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-amt { font-weight: 800; font-size: 14px; }
.fs.none .fs-amt { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.fs-n { font-size: 11px; color: var(--muted); }

/* ---------- committee org chart ---------- */
.org { padding-bottom: 20px; }
.org-tree { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.org-tier { display: flex; flex-direction: column; align-items: center; width: 100%; position: relative; padding-top: 26px; }
.org-tier.first { padding-top: 6px; }
.org-tier:not(.first)::before { content: ''; position: absolute; top: 0; left: 50%; height: 14px; border-left: 2px solid var(--line); }
.org-tier-label { position: absolute; top: 2px; left: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.org-tier.first .org-tier-label { display: none; }
.org-row { display: flex; justify-content: center; flex-wrap: nowrap; }
.org-node { position: relative; padding: 14px 8px 0; display: flex; justify-content: center; }
/* connector: horizontal bar across siblings + a stub down to each card */
.org-node::before { content: ''; position: absolute; top: 0; left: 0; right: 0; border-top: 2px solid var(--line); }
.org-node:first-child::before { left: 50%; }
.org-node:last-child::before { right: 50%; }
.org-node::after { content: ''; position: absolute; top: 0; left: 50%; height: 14px; border-left: 2px solid var(--line); }
.org-row.single .org-node::before { display: none; }
.org-tier.first .org-node { padding-top: 0; }
.org-tier.first .org-node::before, .org-tier.first .org-node::after { display: none; }
.org-card { position: relative; width: 168px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px 12px;
  box-shadow: 0 4px 14px rgba(17,24,39,.06); transition: transform .15s ease, box-shadow .15s ease; }
.org-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(17,24,39,.12); }
.org-av { width: 48px; height: 48px; border-radius: 99px; margin: 0 auto 8px; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, #2C5AA0, #173B6C); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #C9D6EA; }
.org-card.t-admin { border-color: #E7C66B; background: linear-gradient(180deg, #FFF9E8 0%, var(--surface) 60%); }
.org-card.t-admin .org-av { background: linear-gradient(135deg, #E0A526, #B7791F); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #F1D58A; }
.org-card.t-chair .org-av { background: linear-gradient(135deg, #2C5AA0, #173B6C); }
.org-card.t-office .org-av { background: linear-gradient(135deg, #2F9E6E, #17704C); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #BFE3D2; }
.org-card.t-member .org-av { background: linear-gradient(135deg, #7C8796, #556070); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #D9DEE5; }
.org-name { font-weight: 800; font-size: 14px; line-height: 1.25; }
.org-title { display: inline-block; margin-top: 5px; font-size: 11.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 99px; padding: 2px 9px; }
.org-card.t-admin .org-title { color: #8A5A00; background: #FCEFC7; }
.org-card.t-staff .org-av { background: linear-gradient(135deg, #8B5CF6, #5B3BB5); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #DDD3FB; }
.org-card.t-staff .org-title { color: #5B3BB5; background: #EEE8FD; }
.org-add { cursor: pointer; background: transparent; font: inherit; color: var(--primary); font-weight: 700; gap: 6px; grid-auto-flow: column; }
.org-add:hover { border-color: var(--primary); background: var(--primary-soft); }
.org-card.t-office .org-title { color: #17704C; background: #DDF2E8; }
.org-card.t-member .org-title { color: var(--muted); background: var(--line-soft); }
.org-meta { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.org-chk { display: inline-flex; align-items: center; gap: 3px; margin: 5px 0 0 4px; font-size: 10.5px; font-weight: 700; color: #17704C; background: #DDF2E8; border-radius: 99px; padding: 1px 7px; }
.org-meta a { color: inherit; }
.org-dot { margin: 0 4px; }
.org-edit { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.org-edit:hover { color: var(--primary); border-color: var(--primary); }
/* phones: same tree, compact cards (up to 3 side by side) */
@media (max-width: 700px) {
  .org { padding-left: 10px; padding-right: 10px; }
  .org-tier { padding-top: 34px; }
  .org-tier:not(.first)::before { height: 12px; }
  .org-tier-label { top: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 9.5px; background: var(--surface); padding: 0 6px; z-index: 1; }
  .org-row { flex-wrap: wrap; width: 100%; }
  .org-node { flex: 0 1 33.333%; padding: 12px 3px 0; min-width: 0; }
  .org-row.single .org-node { flex-basis: 50%; }
  .org-node::after { height: 12px; }
  .org-card { width: 100%; padding: 10px 4px 9px; border-radius: 12px; }
  .org-av { width: 36px; height: 36px; font-size: 13px; margin-bottom: 6px; }
  .org-name { font-size: 12px; overflow-wrap: anywhere; }
  .org-title { font-size: 10px; padding: 1px 6px; margin-top: 4px; }
  .org-meta { font-size: 10px; margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
  .org-dot { display: none; }
  .org-edit { top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 7px; }
  .org-edit svg { width: 12px; height: 12px; }
  .org-empty { font-size: 11px; padding: 8px; }
  /* more than 3 cards wrap onto several lines: one bar across the first line instead of per-card segments */
  .org-row.many { position: relative; }
  .org-row.many::before { content: ''; position: absolute; top: 0; left: 16.66%; right: 16.66%; border-top: 2px solid var(--line); }
  .org-row.many .org-node::before { display: none; }
  .org-row.many .org-node:nth-child(n+4)::after { display: none; }
}
.org-help { margin-top: 2px; }
.org-card[draggable="true"] { cursor: grab; }
.org-card.dragging { opacity: .45; }
.org-card.drop-on, .org-row.drop-on .org-empty { outline: 3px dashed var(--primary); outline-offset: 3px; }
.org-row.drop-on { border-radius: 18px; background: var(--primary-soft); }
.org-empty { width: 220px; min-height: 90px; display: grid; place-items: center; text-align: center; padding: 12px; border: 2px dashed var(--line); border-radius: 16px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 700px) { .org-empty { width: 100%; min-height: 70px; } .org-help { display: none; } .org-row:has(.org-empty) .org-node { flex-basis: 70%; } }

/* app-login chips on Owners & tenants */
.login-chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 2px 9px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.login-chip.ok { color: #17704C; background: #DDF2E8; }
.login-chip.off { color: var(--muted); background: var(--line-soft); text-decoration: line-through; }
.login-chip.wait { color: #8A5A00; background: #FCEFC7; }
.login-chip:hover { border-color: currentColor; }
