/* Jyothis Physiotherapy – clinic accounts. Mobile first; .ui-web adds the desktop layout. */
:root {
  --navy: #1d3a72; --navy-2: #27509a; --orange: #f0702a; --orange-2: #f59a3c;
  --bg: #f2f5fa; --surface: #ffffff; --surface-2: #f6f8fc; --ink: #142038; --muted: #5f6b80;
  --line: #e1e6ef; --focus: #2f6fd6;
  --in: #11865a; --in-bg: #e2f4ec; --out: #d2531d; --out-bg: #fdebe2; --warn: #9a6400; --warn-bg: #fff3d6;
  --radius: 16px; --shadow: 0 1px 2px rgba(20,32,56,.06), 0 6px 18px rgba(20,32,56,.06);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #16294f; --navy-2: #22427c; --orange: #ff8a45; --orange-2: #ffab5e;
    --bg: #0e1422; --surface: #161e30; --surface-2: #1c2539; --ink: #e7ecf5; --muted: #9aa6bb;
    --line: #2a3550; --focus: #7fb0ff;
    --in: #4fd39a; --in-bg: #12362a; --out: #ff8f5c; --out-bg: #3c2216; --warn: #f2c15b; --warn-bg: #3a2f12;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--navy-2); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: var(--orange-2); } }
h1 { font-size: 21px; font-weight: 700; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 13px; margin: 26px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.num, .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.in { color: var(--in); } .out { color: var(--out); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* brand mark: logo in a white disc */
.mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; flex: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.mark img { width: 30px; height: 30px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand b { display: block; font-size: 16px; line-height: 1.15; font-weight: 700; }
.brand small { display: block; font-size: 11px; opacity: .8; letter-spacing: .04em; }

/* cards & stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: inherit; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.wide { grid-column: 1 / -1; }

/* hero: navy panel with an orange edge */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 18px; color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,112,42,.55), rgba(240,112,42,0) 70%); }
.hero .label { font-size: 13px; opacity: .85; }
.hero .value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero .split { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; opacity: .9; margin-top: 4px; }
.hero .btn { margin-top: 12px; position: relative; z-index: 1; }

/* today strip */
.today { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  border: 2px dashed var(--orange); background: var(--surface); margin-bottom: 14px; }
.today.done { border: 1px solid var(--line); border-left: 5px solid var(--in); }
.today .t1 { font-weight: 700; }
.today .t2 { font-size: 13px; color: var(--muted); }

/* bars */
.bars { display: grid; gap: 10px; }
.bar-row { color: inherit; }
.bar-row .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.pair { display: grid; gap: 3px; margin-top: 5px; }
.pair .bar { margin: 0; height: 7px; }
.pair .bar.c i { background: var(--in); } .pair .bar.e i { background: var(--orange); }
.legend-dots { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend-dots span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .amt { font-weight: 700; text-align: right; }
.item.missing .title { color: var(--warn); }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; }
.cat-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--cat, #888); }
.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--in-bg); color: var(--in); }

/* forms */
.form { display: grid; gap: 14px; }
.field label, .field > .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { color: var(--out); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 48px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-2); outline: none; box-shadow: 0 0 0 3px rgba(39,80,154,.15); }
input[type=color] { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
textarea { min-height: 0; }
.money input { font-size: 24px; font-weight: 700; }
.money-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.live-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 12px;
  background: var(--in-bg); color: var(--in); font-weight: 600; }
.live-total .num { font-size: 22px; font-weight: 700; }

/* chip picker */
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-pick input { position: absolute; opacity: 0; pointer-events: none; }
.chips-pick label { margin: 0; padding: 9px 14px; min-height: 42px; display: inline-flex; align-items: center; border: 1.5px solid var(--line);
  border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.chips-pick input:checked + label { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips-pick input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.light { background: #fff; color: var(--navy); border-color: #fff; }
.btn.danger { color: var(--out); border-color: var(--out); background: transparent; }
.btn.sm { min-height: 36px; padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* filters & chips */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters .q { grid-column: 1 / -1; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips a { flex: none; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.chips a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* messages */
.msgs { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.msgs li { padding: 10px 14px; border-radius: 12px; background: var(--in-bg); color: var(--in); font-weight: 500; }
.msgs li.error { background: var(--out-bg); color: var(--out); }
.msgs li a { color: inherit; text-decoration: underline; font-weight: 700; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.month-nav .m { font-weight: 700; font-size: 17px; text-align: center; }
.month-nav .m small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.hint { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.hint a { color: inherit; text-decoration: underline; font-weight: 600; }

/* tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); text-transform: uppercase; letter-spacing: .04em; }
table.grid td.amt, table.grid th.amt { text-align: right; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.missing td { background: var(--warn-bg); }
table.grid tr.future td { color: var(--muted); }
table.grid tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line); }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }

/* ---------- mobile shell ---------- */
.ui-mobile .topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--navy); color: #fff; }
.ui-mobile .topbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.ui-mobile main { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.ui-mobile .tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(20,32,56,.06); }
.ui-mobile .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: 11px; color: var(--muted); }
.ui-mobile .tabbar a .ico { font-size: 20px; line-height: 1; }
.ui-mobile .tabbar a.on { color: var(--navy-2); font-weight: 700; }
@media (prefers-color-scheme: dark) { .ui-mobile .tabbar a.on { color: var(--orange-2); } }
.ui-mobile .tabbar a.add .ico { width: 52px; height: 52px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: #fff; font-size: 28px; box-shadow: 0 6px 16px rgba(240,112,42,.45); border: 4px solid var(--surface); }
.ui-mobile .tabbar a.add { color: var(--orange); font-weight: 700; }

/* ---------- web shell ---------- */
.ui-web .navbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 10px rgba(20,32,56,.15); }
.ui-web .navbar .in-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; min-height: 64px; }
.ui-web .navbar nav { display: flex; gap: 4px; flex: 1; }
.ui-web .navbar nav a { color: rgba(255,255,255,.82); padding: 20px 12px; font-weight: 500; font-size: 14px; border-bottom: 3px solid transparent; }
.ui-web .navbar nav a:hover { color: #fff; }
.ui-web .navbar nav a.on { color: #fff; border-bottom-color: var(--orange); font-weight: 600; }
.ui-web .navbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.8); }
.ui-web .navbar .who a, .ui-web .navbar .who button { color: #fff; }
.ui-web main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 48px; }
.ui-web .stats { grid-template-columns: repeat(4, 1fr); }
.ui-web .stats .stat.wide { grid-column: auto; }
.ui-web .top-grid { display: grid; grid-template-columns: 1.1fr 2fr; gap: 16px; align-items: stretch; }
.ui-web .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.ui-web .cols.c3 { grid-template-columns: 1.4fr 1fr; }
.ui-web .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
.ui-web .filters .q { grid-column: auto; }
.ui-web .form-card { max-width: 640px; }
.ui-web h2 { margin-top: 0; }
.ui-web .foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }
@media (max-width: 900px) {
  .ui-web .navbar .in-wrap { flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; }
  .ui-web .navbar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .ui-web .navbar nav a { padding: 10px 10px; }
  .ui-web .stats, .ui-web .cols, .ui-web .cols.c3, .ui-web .top-grid { grid-template-columns: 1fr 1fr; }
  .ui-web .top-grid > * { grid-column: 1 / -1; }
  .ui-web main { padding: 18px 16px; }
  .ui-web .filters { grid-template-columns: 1fr 1fr; }
}

/* print (FY report) */
@media print {
  .navbar, .tabbar, .topbar, .no-print, .msgs { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  main { padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-head { display: flex !important; }
  table.grid th, table.grid td { padding: 5px 8px; }
}
.print-head { display: none; align-items: center; gap: 12px; margin-bottom: 12px; }
.print-head img { width: 48px; height: 48px; }
table.grid td.num, table.grid td:first-child { white-space: nowrap; }

/* fingerprint buttons + password fallback */
.bio-btn { min-height: 56px; font-size: 16px; }
.bio-btn .fp { font-size: 22px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
#pw-box { margin-top: 14px; }
#pw-box > summary { text-align: center; text-decoration: underline; }
#pw-box[open] > summary { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); }

/* pending payments */
.item.pend .receive { grid-column: 1 / -1; margin-top: 8px; }
.item.pend .receive[open] > summary { display: none; }
.receive-form { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; gap: 10px; }
.setup-bio { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--navy); color: #fff; }
.setup-bio .btn { flex: none; }
.part-paid { grid-column: 1 / -1; margin-top: 6px; }
.part-paid .bar { margin: 0 0 4px; height: 6px; }
.part-paid .bar i { background: var(--in); }
