/* Colours and sizes follow the Bookkeeping App UI prototype. */
:root {
  --ink: #14202B; --muted: #4B5B6B; --line: #DDE3E9; --line-soft: #E8EDF1; --field: #C5CFD8;
  --ground: #F4F6F8; --card: #FFFFFF; --side: #14202B; --side-ink: #E6ECF1; --side-muted: #B7C4D0; --side-on: #264257;
  --teal: #0F766E; --teal-ink: #0B5A53; --danger: #7F1D1D;
  --income: #1D4ED8; --income-bg: #DBEAFE; --expense: #92400E; --expense-bg: #FEF3C7;
  --ok-bg: #DCFCE7; --ok: #14532D; --wait-bg: #FEF3C7; --wait: #7A4A06; --chip: #E8EDF1;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); background: var(--ground); }
a { color: var(--teal); text-decoration: none; }
.mono, .amount { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.amount { text-align: right; white-space: nowrap; }
.loading { padding: 40px; color: var(--muted); }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 0 0 232px; background: var(--side); color: var(--side-ink); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.brand { font-size: 18px; font-weight: 600; padding: 0 12px 20px; color: #fff; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--side-ink); font-size: 15px; }
.nav.on { background: var(--side-on); font-weight: 600; }
.nav .soon { font-size: 11px; color: var(--side-muted); }
.nav-n { font-size: 12px; min-width: 20px; text-align: center; padding: 1px 7px; border-radius: 10px; background: #F59E0B; color: #1F2937; font-weight: 600; }
.nav-g { font-size: 12px; color: var(--side-muted); padding: 14px 12px 4px; text-transform: none; cursor: default; }
.nav-set { margin-top: 0; }
.nav-set > summary { cursor: pointer; list-style: none; }
.nav-set > summary::after { content: ' ▾'; }
.nav-set[open] > summary::after { content: ' ▴'; }
.side-foot { margin-top: auto; padding: 16px 12px 0; font-size: 13px; color: var(--side-muted); line-height: 1.5; }
.side-foot button { margin-top: 8px; background: transparent; border: 1px solid #3A5266; color: var(--side-ink); border-radius: 8px; min-height: 36px; padding: 0 12px; font: inherit; font-size: 13px; cursor: pointer; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 760px) {
  .side { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { padding: 8px 12px; width: 100%; }
  .side-foot { margin-top: 0; width: 100%; }
  .main { padding: 20px 16px; }
}

.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.head h1 { margin: 0; font-size: 28px; font-weight: 600; }
.sub { font-size: 14px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.grow3 { flex: 3 1 560px; } .grow2 { flex: 2 1 320px; } .grow1 { flex: 1 1 340px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.tiny { font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
.form-row .field { flex: 1 1 160px; }
.field label { font-size: 14px; font-weight: 500; }
input, select { min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; font: inherit; font-size: 15px; background: #fff; color: var(--ink); width: 100%; }
select.compact { min-height: 40px; font-size: 14px; padding: 0 10px; border-radius: 6px; width: auto; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inset { padding: 16px; border-radius: 10px; background: var(--ground); display: flex; flex-direction: column; gap: 12px; }

.btn { min-height: 44px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--teal); font: inherit; font-size: 15px; font-weight: 500; color: #fff; cursor: pointer; }
.btn.big { min-height: 48px; font-size: 16px; }
.btn.ghost { background: #fff; border: 1px solid var(--teal); color: var(--teal-ink); font-size: 14px; padding: 0 14px; }
.btn.plain { background: #fff; border: 1px solid var(--field); color: var(--ink); font-size: 14px; font-weight: 400; padding: 0 14px; }
.btn.danger { background: #fff; border: 1px solid var(--field); color: var(--danger); font-size: 14px; font-weight: 400; padding: 0 14px; }
.btn:disabled { opacity: .55; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; }
td { padding: 8px 6px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.scroll { overflow-x: auto; }
.list-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 15px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; background: var(--chip); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.wait { background: var(--wait-bg); color: var(--wait); }
.chip.bad { background: #FEE2E2; color: #7F1D1D; }
.chip.info { background: #DBEAFE; color: #1E3A8A; }
.chip.income { background: var(--income-bg); color: var(--income); }
.chip.expense { background: var(--expense-bg); color: var(--expense); }
.yes { color: var(--teal-ink); font-weight: 600; text-align: center; } .no { color: var(--muted); text-align: center; }

.switcher { position: relative; }
.menu { position: absolute; right: 0; top: 48px; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 260px; box-shadow: 0 8px 24px rgba(20,32,43,.12); }
.menu a { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--ink); }
.menu a:hover, .menu a.on { background: var(--ground); }

.center { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 24px; min-height: 100vh; padding: 40px 16px; }
.center .card { padding: 32px; gap: 16px; }
.biz { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; padding: 12px 16px; border: 1px solid var(--field); border-radius: 10px; color: var(--ink); }
.biz .name { font-size: 16px; font-weight: 600; }
.error { color: var(--danger); font-size: 14px; }
.ok-msg { color: var(--ok); font-size: 14px; }
.copy { display: flex; gap: 8px; }
.copy input { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.demo-band { background: var(--wait-bg); color: var(--wait); font-size: 13px; padding: 8px 12px; border-radius: 8px; }
.cell { min-height: 36px; padding: 0 8px; font-size: 14px; border-radius: 6px; width: auto; }
select.cell { padding-right: 4px; }
.cell.needs, .needs-key { border: 2px solid #DC2626; background: #FEF2F2; }
.needs-key { padding: 0 6px; border-radius: 4px; color: #7F1D1D; }
tr.row-checked td { background: #F6FBF8; }
/* Expanded review: entries use the full width. */
body.review-expanded .side, body.review-expanded #photocard { display: none; }
body.review-expanded .main { padding: 20px 24px; }
body.review-expanded #regtable { min-width: 100%; }
body.review-expanded #regtable .cell[data-f="billNo"] { width: 130px !important; }
body.review-expanded #regtable .cell[data-f="remarks"] { width: 220px !important; }
.cell.auto, .auto-key { border: 2px solid #D97706; background: #FFFBEB; }
.auto-key { padding: 0 6px; border-radius: 4px; color: #7A4A06; }
tr.row-found td { background: #FEF9C3 !important; }
tr.clickrow { cursor: pointer; }
tr.clickrow:hover td { background: #F1F5F9; }

[hidden] { display: none !important; }

/* ---- Bring in: stepper, drop zones, spinner, tiles */
.stepper { display: flex; gap: 0; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; flex-wrap: wrap; }
.stepper .st { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.stepper .st:hover { background: var(--ground); }
.stepper .dot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  background: var(--chip); color: var(--muted); flex: 0 0 auto; }
.stepper .st.done { color: var(--ok); } .stepper .st.done .dot { background: var(--ok-bg); color: var(--ok); }
.stepper .st.warn .dot { background: var(--wait-bg); color: var(--wait); }
.stepper .st.now { color: var(--ink); font-weight: 600; } .stepper .st.now .dot { background: var(--teal); color: #fff; }
.stepper .bar { flex: 1 1 24px; min-width: 16px; height: 2px; background: var(--line); margin: 0 4px; }
.stepper .bar.done { background: #86EFAC; }
.step-card { scroll-margin-top: 16px; }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-head .icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: var(--ground); flex: 0 0 auto; }
.step-head .icon.ok { background: var(--ok-bg); color: var(--ok); } .step-head .icon.warn { background: var(--wait-bg); color: var(--wait); }
.step-head .t { flex: 1 1 auto; min-width: 0; } .step-head .t strong { font-size: 17px; display: block; } .step-head .t span { font-size: 13px; color: var(--muted); }
.drop { border: 2px dashed var(--field); border-radius: 12px; padding: 22px 16px; text-align: center; cursor: pointer; color: var(--muted); background: #FAFBFC;
  transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.drop:hover, .drop.over { border-color: var(--teal); background: #F0FAF8; color: var(--teal-ink); }
.drop .big { font-size: 26px; line-height: 1; } .drop strong { color: var(--ink); font-size: 15px; } .drop.small { padding: 14px 10px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spinner { width: 14px; height: 14px; border-color: rgba(255,255,255,.4); border-top-color: #fff; margin-right: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--ground); border-radius: 999px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.pill b { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.tile .th { display: flex; align-items: center; gap: 8px; } .tile .th strong { flex: 1; }
.fileline { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; min-width: 0; }
.fileline .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.okdot { width: 10px; height: 10px; border-radius: 50%; background: #22C55E; display: inline-block; flex: 0 0 auto; }
.greydot { width: 10px; height: 10px; border-radius: 50%; background: var(--field); display: inline-block; flex: 0 0 auto; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--teal); font: inherit; cursor: pointer; }

.rvw { font-size: 12px; white-space: nowrap; border-radius: 999px; padding: 2px 10px; text-decoration: none; color: var(--teal-ink, #115E59); }
.rvw.todo, .rvw.done { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px; font-weight: 600; flex: 0 0 auto; }
.rvw.todo { color: #7A4A06; }
.rvw.done { color: #166534; }
.ring { width: 18px; height: 18px; flex: 0 0 auto; }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: #FDE68A; }
.ring .fill { stroke: #D97706; }
.rvw.done .ring .track { stroke: #22C55E; fill: #22C55E; }
.rvw.done .ring .fill { stroke: #22C55E; }
.ring .tick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 6px; opacity: .55; min-height: 0; }
.iconbtn:hover { opacity: 1; background: #FEE2E2; }

/* Review of a register page: strip, bar, one-line rows, issue column */
body:not(.photo-side) .regphoto { display: none; }
body.photo-side .strip { display: none; }
.regrow .regpanel { min-width: 0; flex: 3 1 760px; }
.rv-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; font-size: 13px; }
.rv-prog { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; }
.rv-prog .bar { flex: 1; height: 6px; background: var(--ground); border-radius: 3px; overflow: hidden; min-width: 80px; }
.rv-prog .bar > span { display: block; height: 100%; background: #16A34A; border-radius: 3px; transition: width .3s; }
.rv-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tchip { padding: 3px 10px; border-radius: 999px; background: var(--ground); white-space: nowrap; font-size: 12px; }
.tchip.ok { background: #DCFCE7; color: #166534; }
.tchip.bad { background: #FEE2E2; color: #991B1B; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 4px 12px; font-size: 12px; cursor: pointer; min-height: 0; color: inherit; }
.seg button.on { background: var(--teal); color: #fff; }
#nextissue { min-height: 32px; padding: 0 12px; font-size: 13px; }
.strip { position: sticky; top: 0; z-index: 3; height: 190px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #FBFAF6; }
.strip canvas { width: 100%; height: 100%; display: block; }
.strip .band { position: absolute; left: 0; right: 0; background: rgba(250, 204, 21, .22); border-top: 2px solid rgba(202, 138, 4, .8); border-bottom: 2px solid rgba(202, 138, 4, .8); pointer-events: none; transition: top .15s; }
.strip-tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.88); border-radius: 8px; padding: 2px 4px; }
.regtable { table-layout: fixed; width: 100%; min-width: 1040px; border-collapse: collapse; }
.regtable th { font-size: 12px; font-weight: 600; color: var(--muted, #6B7280); padding: 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.regtable td { padding: 3px 3px; vertical-align: middle; border-top: 1px solid var(--line); }
.regtable .cell { min-height: 32px; padding: 0 6px; font-size: 13px; border: 1px solid transparent; background: transparent; }
.regtable .cell:hover { border-color: var(--line); }
.regtable .cell:focus { border-color: var(--teal); background: #fff; }
.regtable td.ln { color: var(--muted, #6B7280); font-size: 12px; text-align: center; }
.regtable .cell.flag { border: 0; border-bottom: 2px solid #DC2626; border-radius: 4px 4px 0 0; background: #FEF2F2; }
.regtable .cell.flag-auto { border: 0; border-bottom: 2px solid #D97706; border-radius: 4px 4px 0 0; background: #FFFBEB; }
.regtable td.issue { font-size: 12px; line-height: 1.35; }
.iss.red { color: #B91C1C; }
.iss.amber { color: #92400E; }
.iss.info { color: var(--teal); }
.iss .chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; }
.pickchip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; min-height: 0; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.pickchip:hover { border-color: var(--teal); background: #F0FDFA; }
.regtable td.tick { text-align: center; }
.regtable td.tick input { width: 22px; height: 22px; min-height: 0; cursor: pointer; accent-color: #16A34A; }
.regtable td.paidwith { font-size: 12px; color: var(--muted, #6B7280); }
.regtable tr.row-checked td { background: #F7FAF8; }
.regtable tr.row-checked .cell, .regtable tr.row-checked td.ln { color: #6B7280; }
.regtable tr.current td { background: #EFF6FF; }
.regtable tr.current td.ln { box-shadow: inset 3px 0 0 var(--teal); }
.regtable.only-needs tbody tr:not(.needs-you) { display: none; }
kbd { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #fff; }
details.howto { display: inline; }
details.howto summary { display: inline; cursor: pointer; color: var(--teal); margin-left: 6px; }
details.howto[open] { display: block; margin-top: 6px; }
details.menu { position: relative; top: 0; border: 0; background: none; padding: 0; width: auto; min-width: 0; margin: 0; }
details.menu > summary { list-style: none; display: inline-flex; align-items: center; min-width: 44px; justify-content: center; }
details.menu:not([open]) .menu-pop { display: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu-pop .btn { justify-content: flex-start; width: 100%; }
@media (max-width: 760px) { .strip { height: 140px; } }
/* Phones: each register row becomes a small card: bill, amount, type; the four payments; disc, remarks, tick; the issue. */
@media (max-width: 760px) {
  .regtable { min-width: 0; }
  .regtable colgroup, .regtable thead { display: none; }
  .regtable, .regtable tbody { display: block; }
  .regtable tr { display: grid; grid-template-columns: 22px repeat(4, minmax(0, 1fr)); gap: 2px 6px; padding: 8px 0; border-top: 1px solid var(--line);
    grid-template-areas: "ln bn bn am ty" ". p0 p1 p2 p3" ". dc rm rm tk" ". is is is ed"; }
  .regtable td { border: 0; padding: 0; min-width: 0; }
  .regtable .ln { grid-area: ln; } .regtable .c-bn { grid-area: bn; } .regtable .c-am { grid-area: am; } .regtable .c-ty { grid-area: ty; }
  .regtable .c-p0 { grid-area: p0; } .regtable .c-p1 { grid-area: p1; } .regtable .c-p2 { grid-area: p2; } .regtable .c-p3 { grid-area: p3; }
  .regtable .c-pw { grid-column: 2 / -1; grid-row: 2; }
  .regtable .c-dc { grid-area: dc; } .regtable .c-rm { grid-area: rm; } .regtable .c-tk { grid-area: tk; align-self: end; } .regtable .c-is { grid-area: is; } .regtable .c-ed { grid-area: ed; text-align: right; }
  .regtable td[data-l]::before { content: attr(data-l); display: block; font-size: 10px; color: var(--muted, #6B7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .regtable .cell { padding: 0 4px; font-size: 12px; }
  .regtable tr.grptotal { display: block; padding: 4px 0 8px 28px; } .regtable tr.grptotal td.ln { display: none; }
  .regtable tfoot { display: block; } .regtable tfoot tr.tot-rows { border-top: 2px solid var(--ink, #111827); } .regtable tfoot tr.tot-rows td { border-top: 0; }
  #striphint { display: none; }
}

/* Bills paid together: a bracket down the left of their rows */
.regtable tr.grp td.ln { box-shadow: inset 4px 0 0 #8B5CF6; }
.regtable tr.grp:not(.grp-first) td { border-top: 1px dashed #DDD6FE; }
.regtable tr.grp.grp-first td.ln { border-top-left-radius: 6px; }
.regtable tfoot td { border-top: 0; padding: 4px 6px; font-size: 13px; vertical-align: top; }
.regtable tfoot tr.tot-rows td { border-top: 2px solid var(--ink, #111827); font-weight: 600; padding-top: 8px; }
.regtable tfoot td.tot-ok { color: var(--teal-ink); background: #ECFDF5; }
.regtable tfoot td.tot-bad { color: #B91C1C; background: #FEF2F2; }
.regtable tfoot input.tot-ok { border-color: #10B981; background: #ECFDF5; }
.regtable tfoot input.tot-bad { border-color: #EF4444; background: #FEF2F2; }
.regtable tfoot td.tot-why { color: #92400E; background: #FFFBEB; }
.regtable tfoot input.tot-why { border-color: #F59E0B; background: #FFFBEB; }
.regtable tfoot .tot-whymsg { color: #92400E; }
.regtable tfoot .tot-sub { display: block; font-size: 11px; font-weight: 400; color: var(--muted, #6B7280); }
.regtable tfoot .tot-diff { display: block; font-size: 11px; font-weight: 600; }
.regtable tfoot .tot-verdict { font-weight: 500; }
.regtable tr.grptotal td { padding: 3px 8px 8px; font-size: 13px; font-weight: 600; border-top: 1px dashed #DDD6FE; }
.regtable tr.grptotal td.ln { box-shadow: inset 4px 0 0 #8B5CF6; border-bottom-left-radius: 6px; }
.regtable tr.grptotal.ok td:last-child { color: var(--teal-ink); }
.regtable tr.grptotal.bad td:last-child { color: #B91C1C; }
.regtable td.paidwith { color: #6D28D9; }

.pickchip.taken { color: #6B7280; border-style: dashed; }
.billpop { position: absolute; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; min-width: 320px; display: flex; flex-direction: column; }
.billpop button { display: grid; grid-template-columns: 96px 80px 1fr; gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; min-height: 0; color: inherit; }
.billpop button:hover, .billpop button.on { background: #F0FDFA; }
.billpop button.taken { color: #6B7280; }

/* The bill form on a register page: a modal, opened from ✎ on a row or ＋ Add a bill. */
.rowdlg { border: 0; padding: 0; border-radius: 12px; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 12px 40px rgba(20, 32, 43, .25); }
.rowdlg::backdrop { background: rgba(20, 32, 43, .45); }
.rowdlg > .inset { background: var(--card); padding: 20px; }
@media (max-width: 640px) {
  .rowdlg { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 12px 12px 0 0; }
}

/* Review page head: one bar with title and date, pager, find and page actions. */
.head.compact { gap: 8px 16px; }
.head.compact h1 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.head.compact .sub { font-size: 13px; }
.head.compact > :first-child { flex: 1 1 auto; }
.head.compact .btn { min-height: 36px; }
.demo-tag { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager .btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; padding: 0; font-size: 18px; }
.pager .btn.off { opacity: .4; cursor: default; }
.head-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
#waiting:empty, #findresults:empty, #rmsg:empty { display: none; }
.waiting { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; background: var(--wait-bg); color: var(--wait); font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.waiting > a { margin-left: auto; }
.waitlist { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 12px; margin-top: 6px; max-height: 240px; overflow: auto; }
.waitlist .list-row { padding: 6px 0; font-size: 14px; }
.waitlist .list-row:first-child { border-top: 0; }
.waitlist .list-row > :first-child { flex: 0 0 90px; }
.waitlist .list-row > :nth-child(2) { flex: 1 1 auto; }
@media (max-width: 640px) {
  .head.compact > :first-child { flex-basis: 100%; }
  .head-tools #findbill input { width: 130px !important; }
}

.regtable tr.save-failed td { background: #FEF2F2; }

/* Compare sales */
.cmp-bar { gap: 10px; }
.cmp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cmp-day { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-day .btn { min-height: 36px; padding: 0 12px; }
.cmp-pick select { font-size: 18px; font-weight: 600; border: 0; background: transparent; padding: 4px 6px; min-height: 36px; }
.cmp-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-progress { display: grid; gap: 4px; }
.pgbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #EEF0F2; }
.pgbar .pg.m { background: #10B981; } .pgbar .pg.a { background: #5EADA4; } .pgbar .pg.d { background: #94A3B8; } .pgbar .pg.o { background: #F59E0B; }
.cmp-warn { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; border-radius: 8px; padding: 10px 14px; margin: 8px 0; }
.nm-part { margin-top: 6px; } .nm-part summary { cursor: pointer; } .nm-part li { margin: 2px 0; }
.cmp-tabs { margin: 12px 0; flex-wrap: wrap; }
.cmptable td { vertical-align: top; }
.cmptable tr.undecided td:first-child { box-shadow: inset 3px 0 0 #F59E0B; }
.cmptable tr.grp-head { cursor: pointer; }
.cmptable tr.grp-head td { background: #F8FAFC; }
.cmptable tr.grp-head td:first-child strong::before { content: '▸ '; color: var(--muted, #6B7280); }
.cmptable tr.grp-head.open td:first-child strong::before { content: '▾ '; }
.cmptable tr.grp-bill td:first-child { padding-left: 24px; }
.cmptable .dchip { min-height: 34px; padding: 0 10px; font-size: 13px; }
details.cmp-fold > summary { list-style: none; cursor: pointer; display: grid; gap: 2px; }
details.cmp-fold > summary h2::before { content: '▸ '; color: var(--muted, #6B7280); }
details.cmp-fold[open] > summary h2::before { content: '▾ '; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#confirm[aria-disabled="true"] { background: #fff; color: var(--ink, #111827); border: 1px solid var(--field); }
.tchip.warn { background: #FEF3C7; color: #92400E; }
.cmp-tabs button { padding: 8px 16px; font-size: 14px; }
/* A choice the bank credit backs: pre-selected for the person to accept. */
.cmptable .dchip.sugg { border: 2px solid var(--teal); color: var(--teal-ink); font-weight: 600; }
.bank-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: var(--teal); color: #fff; border-radius: 4px; padding: 1px 4px; margin-left: 2px; vertical-align: 1px; }
/* Reconcile */
.rec-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rec-n { font-size: 20px; font-weight: 600; }
.lane-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.wit3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.wit { background: var(--ground); border-radius: 6px; padding: 6px 8px; }
.wit-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wit.odd { background: #FEF2F2; }
.rv-cards { display: grid; gap: 8px; }
.rv-card { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.wit.odd .wit-v { text-decoration: line-through; color: #991B1B; }
.seg a { padding: 4px 12px; font-size: 12px; color: inherit; text-decoration: none; }
.seg a.on { background: var(--teal); color: #fff; }
.tchip.bad, .tchip.warn { font-weight: 600; }
.um-row { border-top: 1px solid var(--line-soft); }
.um-row summary { display: flex; gap: 10px; align-items: center; padding: 8px 4px; cursor: pointer; }
.um-body { display: grid; gap: 8px; padding: 4px 4px 12px; }
.um-line { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.um-line input { width: 18px; height: 18px; min-height: 0; }
.rec-tabs { align-self: flex-start; }
.rec-tabs a { padding: 7px 16px; font-size: 14px; }
.mode-tabs { align-self: flex-start; }
.mode-tabs button { padding: 8px 18px; font-size: 15px; display: inline-flex; gap: 6px; align-items: center; }
.mode-tabs a { padding: 8px 18px; font-size: 15px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.bank-tabs { max-width: 100%; overflow-x: auto; }
.bank-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bank-tile { background: var(--surface-2, #F6F7F9); border-radius: 8px; padding: 8px 12px; }
.ent-group { margin-top: 10px; }
.ent-line { padding: 8px 4px; border-top: 1px solid var(--line-soft); display: grid; gap: 2px; }

/* Shift bar: one day for Register, Compare sales and Reconcile, a tab for each with what is left (7 Nov 2026). */
.shiftbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.shiftbar .sb-day { display: flex; align-items: center; gap: 6px; }
.shiftbar .sb-day .btn { min-height: 40px; padding: 0 12px; display: inline-flex; align-items: center; }
.shiftbar .sb-day .btn.off { opacity: .4; pointer-events: none; }
.shiftbar .sb-day select { min-height: 40px; width: auto; font-weight: 600; }
.shiftbar .sb-tabs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.shiftbar .sb-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink); border: 1px solid transparent; }
.shiftbar .sb-tabs a:hover { background: var(--line-soft); }
.shiftbar .sb-tabs a.on { border-color: var(--teal); background: #E3F1EF; font-weight: 600; }
.shiftbar .sb-i { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--line-soft); font-size: 12px; font-weight: 600; }
.shiftbar a.on .sb-i { background: var(--teal); color: #fff; }
.shiftbar .sb-n { font-size: 12px; font-weight: 400; color: var(--muted); }
.shiftbar .sb-n:empty { display: none; }
.shiftbar .sb-n.wait { color: #92400E; } .shiftbar .sb-n.ok { color: var(--teal-ink); }
@media (max-width: 640px) {
  .shiftbar .sb-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); width: 100%; }
  .shiftbar .sb-tabs a { flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px; font-size: 13px; text-align: center; line-height: 1.2; }
  .shiftbar .sb-i { display: none; }
  .shiftbar .sb-n { font-size: 11px; }
}

/* Money out: a table on wide screens, a stacked list on phones so each amount shows without scrolling sideways. */
.mo-list { display: none; list-style: none; margin: 0; padding: 0; }
.mo-list li { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.mo-list li:first-child { border-top: 0; }
.mo-list li.off { color: var(--muted); }
.mo-list li.off .amount { text-decoration: line-through; }
.mo-list .mo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
@media (max-width: 640px) {
  .mo-list { display: block; }
  .mo-table { display: none; }
}

/* Dashboard (9 Nov 2026): jobs waiting as cards; two columns on desktop, one on a phone. */
.dash-fresh { margin-bottom: 16px; gap: 6px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-big { grid-row: span 2; }
.dash-num { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-go { align-self: flex-start; display: inline-flex; align-items: center; }
.dash-link { color: inherit; text-decoration: none; }
.dash-link:hover { background: var(--ground); }
.dash-done { flex-direction: row; gap: 8px; padding: 10px 16px; margin-top: 8px; color: var(--muted); font-size: 14px; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } .dash-big { grid-row: auto; } }
/* Multi-pair tray (approved 10 Nov 2026). */
.tray { background: var(--ground); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; margin-top: 8px; display: grid; gap: 4px; }
.tray-row { display: grid; grid-template-columns: minmax(0, 1.1fr) 20px minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.tray-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
@media (max-width: 560px) { .tray-row { grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr); } .tray-row > :last-child { grid-column: 1 / -1; text-align: left !important; } }
/* The tray by tick order (10 Nov 2026): the pair taking the next tick, and the list of what saving will do. */
.tray-row.tray-adding { background: #ECFDF5; outline: 2px solid var(--teal); outline-offset: -2px; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.tray-preview { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.tray-row .dchip { min-height: 0; padding: 3px 9px; font-size: 12px; }

/* Money with no bill (11 Nov 2026): one compact row per credit; the open More menu sits above the rows below it. */
details.menu { z-index: auto; }
details.menu[open] { z-index: 40; }
#nobill .nb-row { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
#nobill .nb-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#nobill .nb-line .nb-head { flex: 1 1 260px; align-items: center; min-width: 0; }
#nobill .nb-line .nb-head input { margin-top: 0; }
#nobill .nb-amt { min-width: 92px; font-variant-numeric: tabular-nums; }
#nobill .nb-meta { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nobill .nb-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #FEF3C7; color: #92400E; white-space: nowrap; }
#nobill .nb-open { min-height: 32px; padding: 4px 12px; }
#nobill .nb-open.on { background: var(--teal); color: #fff; border-color: var(--teal); }
#nobill .nb-acts[hidden] { display: none; }
#nobill .nb-head { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 400; }
#nobill .nb-head input { width: 18px; height: 18px; min-height: 0; margin-top: 3px; flex: none; }
#nobill .nb-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-left: 28px; }
#nobill .nb-acts > input { flex: 1 1 200px; max-width: 280px; min-height: 36px; padding: 6px 10px; }
#nobill .nb-acts .btn, #nobill .nb-acts summary.btn { min-height: 36px; padding: 6px 12px; display: inline-flex; align-items: center; }
#nobill .nb-more .menu-pop { min-width: 280px; gap: 6px; }
#nobill .nb-sep { border-top: 1px solid var(--line-soft); margin: 2px 0; }
#nobill .nb-headpick { display: flex; gap: 6px; }
#nobill .nb-headpick select { flex: 1; min-width: 0; min-height: 36px; }
#nobill .nb-headpick .btn { width: auto; flex: none; justify-content: center; }
@media (max-width: 600px) { #nobill .nb-acts { padding-left: 0; } #nobill .nb-acts > input { max-width: none; flex-basis: 100%; } #nobill .nb-more .menu-pop { right: auto; left: 0; } }
/* The tray: the chosen answer for a pair more than ₹10 apart (11 Nov 2026). */
.tray-row .dchip.on { background: var(--teal); border-color: var(--teal); color: #fff; }

.upitag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--income-bg); color: var(--income); }

.nb-next { flex-basis: 100%; color: #92400E; }

.today-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.today-row:hover { background: var(--surface-2, #F6F7F9); }
