:root {
  color-scheme: light;
  --neel: #24367f;
  --ink: #171c33;
  --muted: #646b85;
  --line: #e4e6ee;
  --soft: #f5f6fa;
  --rani: #b90f58;
  --rani-soft: #fbedf3;
  --haldi-soft: #fdf6e3;
  --leaf: #1a6b50;
  --leaf-soft: #e9f5f0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Anek Latin", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}
a { color: var(--neel); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--neel); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; font-weight: 650; line-height: 1.2; }
h2 { font-size: 1.1rem; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Header */
.top { border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 960px; margin: auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { font-size: 1.2rem; font-weight: 700; color: var(--neel); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--muted); padding: 18px 0 16px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-color: var(--neel); }
.badge { display: inline-block; min-width: 19px; padding: 0 5px; margin-left: 4px; border-radius: 10px; background: var(--rani); color: #fff; font-size: .75rem; font-weight: 600; line-height: 19px; text-align: center; }
.top-side { display: flex; gap: 16px; align-items: center; }
.top-side a, .linkish { color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.linkish:hover { color: var(--ink); }

main { max-width: 960px; margin: auto; padding: 36px 20px 72px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.note { color: var(--muted); margin-top: 4px; max-width: 62ch; }

/* Plain controls */
label { display: block; font-size: .92rem; font-weight: 500; margin-bottom: 4px; }
input, select, textarea { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #c8ccda; border-radius: 8px; background: #fff; max-width: 100%; }
textarea { width: 100%; min-height: 120px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--neel); }
.quiet-select { border-color: var(--line); color: var(--muted); }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 18px; border: 1px solid var(--neel); border-radius: 8px; background: var(--neel); color: #fff; cursor: pointer; }
.btn:hover { background: #1b2a66; text-decoration: none; }
.btn.plain { background: #fff; color: var(--ink); border-color: #c8ccda; }
.btn.plain:hover { background: var(--soft); }
.btn.danger { background: #fff; color: var(--rani); border-color: #e7b9cd; }
.btn.danger:hover { background: var(--rani-soft); }
.btn.tiny { padding: 3px 12px; font-size: .9rem; font-weight: 500; }
.tabs { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 3px; }
.tabs a { padding: 5px 14px; border-radius: 6px; color: var(--muted); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-current="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.choice { display: inline-flex; align-items: center; gap: 7px; margin: 0 16px 0 0; font-size: 1rem; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.stack > * + * { margin-top: 24px; }

/* Notices */
.notice { padding: 11px 14px; margin-bottom: 20px; border-radius: 8px; background: var(--haldi-soft); }
.notice.error { background: var(--rani-soft); }
.notice.success { background: var(--leaf-soft); }
.flag { color: var(--rani); }
.good { color: var(--leaf); }

/* Overview: the two answers */
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 44px; }
.figure { display: block; padding: 24px 26px; background: var(--soft); border-radius: 14px; color: var(--ink); }
.figure:hover { text-decoration: none; background: #eef0f7; }
.figure-label { color: var(--muted); }
.figure-value { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; margin: 4px 0; letter-spacing: -.01em; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
section > h2 { margin-bottom: 6px; }
.more { display: inline-block; margin-top: 12px; }

/* Rows replace tables wherever two or three facts are enough */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; overflow-wrap: anywhere; }
.row-side { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.empty { padding: 40px 0; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.progress { height: 5px; margin-top: 7px; width: 180px; max-width: 100%; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--neel); }

/* Dues */
.group { margin-bottom: 32px; }
.group-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-weight: 600; font-size: 1.1rem; }
details.row-detail { border-bottom: 1px solid var(--line); }
details.row-detail:last-child { border-bottom: 0; }
details.row-detail > summary { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; cursor: pointer; list-style: none; }
details.row-detail > summary::-webkit-details-marker { display: none; }
details.row-detail > summary:hover .strong { color: var(--neel); }
.detail-body { padding: 0 0 16px; }

/* Tables only where columns are the point */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: .9rem; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
th.num { text-align: right; }

/* Dispatch entry */
.dispatch-bar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.dispatch-input { width: 74px; text-align: right; }
.status-col { display: none; }
form:has(#show-status:checked) .status-col { display: table-cell; }

/* Upload */
.upload { padding: 20px 22px; margin-bottom: 32px; background: var(--soft); border-radius: 14px; }
.upload-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.upload details { margin-top: 12px; }
summary { cursor: pointer; }
.upload summary { color: var(--muted); }
.upload details select { margin-top: 8px; }

/* Review */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.review > * { min-width: 0; }
.source { position: sticky; top: 16px; height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.source iframe { display: block; width: 100%; height: 100%; border: 0; }
.source .img-wrap { height: 100%; overflow: auto; }
.source img { display: block; width: 100%; height: auto; }
main.wide { max-width: 1240px; }
.top.wide .top-inner { max-width: 1240px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields input { width: 100%; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 9px 12px; margin-bottom: 6px; border-radius: 8px; }
.checks .error { background: var(--rani-soft); }
.checks .warning { background: var(--haldi-soft); }
.checks .ok { background: var(--leaf-soft); }
.lines > summary { font-weight: 600; padding: 4px 0 10px; }
.lines td { padding: 3px 4px 3px 0; }
.lines th { padding: 6px 4px 6px 0; }
.lines input { width: 100%; min-width: 72px; padding: 5px 7px; font-size: .95rem; }
.lines .wide-cell input { min-width: 125px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; position: sticky; bottom: 0; background: #fff; padding: 14px 0; border-top: 1px solid var(--line); }
.login { max-width: 360px; margin: 8vh auto; }
.login input { width: 100%; }
.settings-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }

/* Phone: the five main places sit under the thumb */
@media (max-width: 760px) {
  body { font-size: 16px; }
  main { padding: 24px 16px 96px; }
  .top-inner { height: 54px; padding: 0 16px; justify-content: space-between; }
  .nav {
    position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    justify-content: space-around; gap: 0;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .nav a { flex: 1; padding: 13px 2px 14px; text-align: center; font-size: .82rem; border-bottom: 0; border-top: 2px solid transparent; margin-top: -1px; }
  .nav a[aria-current="page"] { border-top-color: var(--neel); }
  .badge { min-width: 16px; line-height: 16px; font-size: .68rem; padding: 0 4px; margin-left: 2px; }
  .figures, .columns, .review, .fields { grid-template-columns: 1fr; }
  .figures { gap: 10px; margin-bottom: 32px; }
  .figure { padding: 18px 20px; }
  .columns { gap: 32px; }
  .source { position: static; height: 55vh; }
  .actions { bottom: 58px; }
  .dispatch-input { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.comparison{display:grid;gap:12px;padding-bottom:20px;border-bottom:1px solid var(--line)}
.comparison h2,.comparison p{margin:0}
.dispatch-date{max-width:220px}
.lines .date-cell input { min-width: 112px; }

/* Filters, review tab, users */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; color: var(--muted); }
.inline-label input { padding: 5px 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.section-head h2 { margin: 0; }
.tabs.small a { padding: 3px 10px; font-size: .88rem; }
details.group-detail { margin-bottom: 14px; }
details.group-detail > summary { list-style: none; cursor: pointer; align-items: baseline; }
details.group-detail > summary::-webkit-details-marker { display: none; }
details.group-detail > summary::before { content: "▸"; color: var(--muted); margin-right: 8px; display: inline-block; transition: transform .15s; }
details.group-detail[open] > summary::before { transform: rotate(90deg); }
details.group-detail > summary > span:first-child { flex: 1; }
details.group-detail > .row-detail { padding-left: 20px; }
.pill { display: inline-block; padding: 0 8px; border-radius: 10px; background: var(--soft); color: var(--neel); font-size: .78rem; font-weight: 600; vertical-align: 2px; }
.pill.off { color: var(--rani); }
.saved-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 16px; background: var(--soft); border-radius: 10px; }
.saved-meta > div { min-width: 0; }
.no-source { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 28px; height: auto; position: static; background: var(--soft); border: 0; }
@media (max-width: 760px) { .nav a { font-size: .74rem; } }

/* Excel and CSV uploads, shown as a grid */
.sheet-source { overflow: auto; background: #fff; }
.sheet-name { position: sticky; left: 0; padding: 8px 10px; font-weight: 600; font-size: .9rem; background: var(--soft); border-bottom: 1px solid var(--line); }
table.sheet { width: auto; font-size: .82rem; font-variant-numeric: tabular-nums; }
table.sheet td, table.sheet th { padding: 3px 8px; border: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
table.sheet th { position: sticky; left: 0; background: var(--soft); color: var(--muted); font-weight: 400; text-align: right; }

.full-ledger { margin-bottom: 8px; }

table.ledger-print { width: auto; min-width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.ledger-print th, table.ledger-print td { white-space: nowrap; padding: 9px 20px 9px 0; vertical-align: top; }
table.ledger-print th { padding-bottom: 10px; }
table.ledger-print th:last-child, table.ledger-print td:last-child { padding-right: 0; }
table.ledger-print .detail-row td { color: var(--muted); font-style: italic; font-size: .85rem; padding-top: 4px; padding-bottom: 4px; border-bottom-style: dashed; }
table.ledger-print .total-row td { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 0; }
.full-ledger thead th { white-space: nowrap; padding-right: 16px; }

.review.single { grid-template-columns: minmax(0, 1fr); gap: 20px; }
.review.single .source { position: static; height: auto; padding: 16px 20px; }

table.ledger-print.editable [data-cell] { cursor: text; border-radius: 4px; outline: none; min-width: 2.5em; }
table.ledger-print.editable [data-cell]:hover { background: var(--soft); }
table.ledger-print.editable [data-cell]:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--neel); }
table.ledger-print.editable td[data-cell] { padding-left: 6px; padding-right: 14px; }
table.ledger-print.editable th { padding-left: 6px; padding-right: 14px; }
table.ledger-print .row-tools { padding: 4px 0; white-space: nowrap; text-align: right; }
table.ledger-print .row-tools select { padding: 3px 4px; font-size: .8rem; margin-right: 6px; }
.remove-line { border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 4px 8px; border-radius: 4px; cursor: pointer; opacity: .45; }
tr:hover .remove-line, .remove-line:focus-visible { opacity: 1; }
.remove-line:hover { color: var(--rani); background: var(--rani-soft); }
