/* CashDesk — ledger ink on cool paper. Money is the one loud element. */
:root {
  --ink: #1E3A5F; --ink-2: #2B5384; --ink-soft: #E6EDF5;
  --page: #F2F4F6; --paper: #FFFFFF; --rule: #D3DAE1; --rule-soft: #E7EBEF;
  --text: #1D2733; --muted: #5B6773;
  --ok: #1E7A46; --ok-bg: #E2F2E8; --warn: #8A5A00; --warn-bg: #FFF0D2;
  --bad: #B3261E; --bad-bg: #FBE3E1; --info: #1F5FA8; --info-bg: #E3EDF9;
  --radius-s: 4px; --radius-m: 8px;
  --font: "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--page); }
a { color: var(--ink-2); }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid #F2A900; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .45rem 1rem;
  border: 1px solid var(--ink); border-radius: var(--radius-s); background: var(--ink); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--ink-2); }
.btn.secondary { background: var(--paper); color: var(--ink); }
.btn.secondary:hover { background: var(--ink-soft); }
.btn.danger { background: var(--paper); color: var(--bad); border-color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.big { min-height: 56px; font-size: 1.05rem; width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; text-decoration: underline; cursor: pointer; }
label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=month],
input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 42px; padding: .45rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius-s);
  background: #fff; font: inherit; color: var(--text); }
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); outline: 2px solid var(--ink-soft); }
input[type=file] { font: inherit; padding: .5rem 0; }
.hint { font-size: .82rem; color: var(--muted); margin: .2rem 0 0; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.inline { display: inline; }

/* ---------- messages & status */
.flash { padding: .7rem .9rem; border-radius: var(--radius-s); margin: 0 0 1rem; border-left: 4px solid; background: var(--paper); }
.flash.ok { border-color: var(--ok); background: var(--ok-bg); }
.flash.error { border-color: var(--bad); background: var(--bad-bg); }
.flash.info { border-color: var(--info); background: var(--info-bg); }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--rule-soft); color: var(--muted); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- surfaces */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: .25rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .5rem .65rem; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: #F8FAFB; position: sticky; top: 0; font-size: .82rem; }
tbody tr:hover { background: #FAFBFC; }
tr.total td { font-weight: 700; border-top: 2px solid var(--rule); background: #F8FAFB; }
tr.week-row td { background: var(--ink-soft); font-weight: 600; }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; padding: .5rem 0 1rem; font-size: .9rem; }
.filters { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: .4rem .9rem .9rem; margin-bottom: 1rem; }
.filters label { font-size: .8rem; margin-top: .5rem; }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--rule); border-top: 6px solid var(--ink);
  border-radius: var(--radius-m); padding: 1.6rem 1.5rem 1.4rem; }
.auth-card h1 { margin-bottom: .2rem; }

/* ---------- employee panel (mobile first) */
.emp-top { background: var(--ink); color: #fff; padding: .7rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.emp-top strong { display: block; font-size: .95rem; }
.emp-top .who { font-size: .8rem; opacity: .85; }
.emp-top .btn-link { color: #fff; font-size: .85rem; }
.emp-main { max-width: 600px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.emp-nav { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--paper);
  border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.emp-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; font-size: .78rem;
  color: var(--muted); text-decoration: none; font-weight: 600; gap: 2px; }
.emp-nav a svg { width: 22px; height: 22px; }
.emp-nav a.on { color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0 1rem; }
.tile { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: .7rem .8rem; text-decoration: none; color: inherit; }
.tile b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile span { font-size: .82rem; color: var(--muted); }
.tile.alert { border-color: var(--warn); background: var(--warn-bg); }
.tile.alert-bad { border-color: var(--bad); background: var(--bad-bg); }
.today-total { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 1rem; margin-top: .8rem; }
.today-total .figure { font-size: 2.3rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cust-list { list-style: none; margin: 0; padding: 0; }
.cust-list li { border-bottom: 1px solid var(--rule-soft); }
.cust-list a { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .8rem .2rem; text-decoration: none; color: inherit; min-height: 60px; }
.cust-list .name { font-weight: 600; }
.cust-list .meta { font-size: .82rem; color: var(--muted); }
.cust-list li.done a { opacity: .65; }
.amount-input { font-size: 2.4rem !important; font-weight: 700; min-height: 72px !important; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--ink); letter-spacing: .01em; }
.amount-wrap { position: relative; }
.amount-wrap::before { content: "₹"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; color: var(--muted); }
.receipt { border: 2px solid var(--ok); background: var(--ok-bg); border-radius: var(--radius-m); padding: 1rem; margin-bottom: 1rem; }
.receipt .figure { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.denoms { width: 100%; }
.denoms td { padding: .35rem .3rem; border: 0; vertical-align: middle; }
.denoms input { text-align: right; min-height: 46px; font-size: 1.1rem; }
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; padding: 1rem; border-radius: var(--radius-m); background: var(--paper);
  border: 1px solid var(--rule); margin: 1rem 0; }
.readout .lbl { color: var(--muted); font-size: .85rem; }
.readout .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.readout .diff { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: .6rem; display: flex; justify-content: space-between; align-items: baseline; }
.readout .diff .val { font-size: 2.2rem; }
.readout[data-state=MATCHED] { border-color: var(--ok); }
.readout[data-state=MATCHED] .diff .val { color: var(--ok); }
.readout[data-state=SHORTAGE] { border-color: var(--bad); background: #FFF8F7; }
.readout[data-state=SHORTAGE] .diff .val { color: var(--bad); }
.readout[data-state=EXCESS] { border-color: var(--warn); background: #FFFBF2; }
.readout[data-state=EXCESS] .diff .val { color: var(--warn); }
.notes { background: var(--warn-bg); border-bottom: 1px solid #EBD39C; padding: .5rem 1rem; font-size: .88rem; }
.notes ul { margin: 0; padding-left: 1.1rem; }
.notes form { margin-top: .3rem; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); }
.timeline li { padding: 0 0 .7rem .9rem; position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.proof-ok { color: var(--ok); font-weight: 700; }

/* ---------- admin */
.adm { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #DCE5EF; padding: 1rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 1.1rem 1rem; font-weight: 700; color: #fff; line-height: 1.3; }
.side .brand small { display: block; font-weight: 400; opacity: .75; font-size: .8rem; }
.side h4 { margin: 1rem 1.1rem .3rem; font-size: .78rem; font-weight: 600; color: #9FB3C8; }
.side a { display: flex; justify-content: space-between; padding: .38rem 1.1rem; color: #E9EFF5; text-decoration: none; font-size: .92rem; }
.side a:hover { background: rgba(255,255,255,.07); }
.side a.on { background: rgba(255,255,255,.13); box-shadow: inset 3px 0 0 #F2A900; color: #fff; }
.side .count { background: #F2A900; color: #1D2733; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; line-height: 1.6; }
.side form { padding: .8rem 1.1rem; }
.side .btn-link { color: #C9D6E3; }
.adm-main { padding: 1.4rem 1.8rem 3rem; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.menu-btn { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.stat { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: .7rem .9rem; }
.stat b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat.lead { border-color: var(--ink); }
.stat.lead b { font-size: 1.9rem; color: var(--ink); }
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li a { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .2rem; border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: var(--text); }
.alerts li a b { color: var(--bad); font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--ink-soft); border-top: 3px solid var(--ink); min-height: 3px; position: relative; }
.bars .bar.sun { background: transparent; border-top-color: transparent; }
.bars-x { display: flex; gap: 4px; font-size: .7rem; color: var(--muted); }
.bars-x span { flex: 1; text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; }
.flow { display: flex; flex-wrap: wrap; gap: 0; margin: .5rem 0 1rem; padding: 0; list-style: none; counter-reset: step; }
.flow li { padding: .35rem .7rem; font-size: .8rem; border: 1px solid var(--rule); margin: 0 -1px -1px 0; background: var(--paper); color: var(--muted); }
.flow li.done { background: var(--ok-bg); color: var(--ok); }
.flow li.now { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.proof-view { width: 100%; max-height: 640px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: #fff; }
.proof-view img { max-width: 100%; display: block; margin: 0 auto; }
iframe.proof-view { height: 640px; }
.matrix td, .matrix th { font-size: .82rem; padding: .35rem .5rem; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: .2rem 0; }
.checklist li.ok::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.checklist li.bad::before { content: "✕ "; color: var(--bad); font-weight: 700; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; background: var(--warn-bg); padding: .4rem .7rem; border-radius: var(--radius-s); display: inline-block; }

@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  body.nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .adm-main { padding: 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media print {
  .side, .emp-nav, .emp-top, .filters, .actions, .pager, .menu-btn { display: none !important; }
  .adm { display: block; } body { background: #fff; }
}

/* ---------- sync, bank cards, template editor */
.count:empty { display: none; }
.sync-label { margin: 1rem 1.1rem 0; font-size: .78rem; color: #9FB3C8; }
.sync-label.late { color: #FFC857; }
.bank-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.bank-card { text-decoration: none; color: inherit; margin: 0; }
.bank-card h3 { margin-top: 0; color: var(--ink); }
.bank-card:hover { border-color: var(--ink-2); }
.field-table input[type=number] { width: 5.2rem; min-height: 34px; padding: .25rem .35rem; }
.field-table select { min-height: 34px; padding: .2rem; }
.field-table td { padding: .25rem .35rem; }
#dash-body.fresh { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: var(--info-bg); } to { background: transparent; } }
