/* =====================================================================
   Cashbook — visual system
   Grounded in the paper cashbook it replaces: pale ledger stock, hairline
   rules, green ink for Cash In, red ink for Cash Out, and figures set in
   tabular numerals so columns line up the way they do on a ruled page.
   ===================================================================== */

:root {
  --ink:        #16241C;
  --ink-soft:   #5A6B60;
  --ink-faint:  #8A9A8E;
  --paper:      #F3F6EF;
  --sheet:      #FFFFFF;
  --rule:       #DBE2D5;
  --rule-strong:#B9C6B2;

  --in:         #1E7A4C;
  --in-wash:    #E8F3EC;
  --out:        #A63A28;
  --out-wash:   #FAEBE7;
  --pending:    #B87514;
  --pending-wash:#FBF1DF;

  --focus:      #1E7A4C;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --shell-max: 940px;
  --tabbar-h: 62px;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  overscroll-behavior-y: contain;
}

body {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  min-height: 100dvh;
}

/* Every figure in the app is tabular so columns align. */
.figure, .amount, td.num, .stat-value, input[inputmode="decimal"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.shell { max-width: var(--shell-max); margin: 0 auto; padding: 0 14px; }

/* ---------------------------------------------------------------- header */
.topbar {
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 1030;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: var(--shell-max); margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; min-height: 56px;
}
/* The brand is the only part allowed to shrink; the sync badge and the
   settings button must stay reachable however long the badge label gets. */
.topbar-inner .brand { flex: 1 1 auto; min-width: 0; }
.topbar-inner .sync-pill,
.topbar-inner .icon-btn { flex: 0 0 auto; }
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; letter-spacing: -0.01em; color: var(--ink);
  text-decoration: none; font-size: 1.02rem;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--in); color: #fff;
  display: grid; place-items: center; font-size: .85rem; flex: none;
}
.brand small { display: block; font-weight: 450; font-size: .72rem; color: var(--ink-faint); }
/* A long trading name must not push the sync badge off the header. */
.brand > span { min-width: 0; }
#bizName {
  display: block; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 100%;
}
@media (min-width: 768px) { #bizName { max-width: 260px; } }

/* ------------------------------------------------------- sync indicator */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 11px 5px 9px;
  font-size: .78rem; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.sync-pill[data-state="synced"]  { color: var(--in);      border-color: #BEDCCB; background: var(--in-wash); }
.sync-pill[data-state="synced"] .dot  { background: var(--in); }
.sync-pill[data-state="pending"] { color: var(--pending); border-color: #E8D3A8; background: var(--pending-wash); }
.sync-pill[data-state="pending"] .dot { background: var(--pending); }
.sync-pill[data-state="failed"]  { color: var(--out);     border-color: #E9C5BC; background: var(--out-wash); }
.sync-pill[data-state="failed"] .dot  { background: var(--out); }
.sync-pill[data-state="syncing"] .dot { background: var(--pending); animation: pulse 1s ease-in-out infinite; }
.sync-pill[data-state="offline"] { color: var(--ink-soft); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .sync-pill[data-state="syncing"] .dot { animation: none; }
}

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center; flex: none;
  color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--rule-strong); background: var(--sheet);
}
.icon-btn.active { color: var(--in); border-color: #BEDCCB; background: var(--in-wash); }

.offline-strip {
  background: var(--ink); color: #E7EEE8;
  font-size: .8rem; text-align: center; padding: 6px 12px;
  display: none;
}
body.is-offline .offline-strip { display: block; }

/* ------------------------------------------------------------- balance */
/* The one loud element in the app: what is actually in the cash box. */
.balance-block { padding: 26px 0 18px; }
.balance-label { font-size: .82rem; color: var(--ink-soft); margin-bottom: 2px; }
.balance-value {
  font-size: clamp(2.5rem, 11vw, 3.6rem);
  font-weight: 680; letter-spacing: -0.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.balance-value .sym { font-size: .45em; font-weight: 550; color: var(--ink-soft); vertical-align: .42em; margin-right: .12em; }
.balance-value.negative { color: var(--out); }
.balance-rule { height: 1px; background: var(--rule-strong); margin: 16px 0 12px; }

.flow-split { display: flex; gap: 26px; }
.flow-item { flex: 1; }
.flow-item .k { font-size: .78rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.flow-item .v { font-size: 1.32rem; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.flow-item.in .v  { color: var(--in); }
.flow-item.out .v { color: var(--out); }

/* --------------------------------------------------------------- sheets */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--rule);
}
.sheet-head h2 { font-size: .95rem; font-weight: 620; margin: 0; letter-spacing: -0.01em; }
.sheet-head a { font-size: .82rem; color: var(--in); text-decoration: none; font-weight: 550; }
.sheet-body { padding: 16px; }

.section-title {
  font-size: .9rem; font-weight: 620; margin: 22px 0 10px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.section-title .count { font-weight: 450; font-size: .8rem; color: var(--ink-faint); }

/* --------------------------------------------------- ledger (txn rows) */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px; align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  background: var(--sheet);
}
.ledger li:last-child { border-bottom: 0; }
.ledger li:active { background: #F7F9F4; }

.ledger .mark {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: .92rem; flex: none;
}
.ledger .in  .mark { background: var(--in-wash);  color: var(--in); }
.ledger .out .mark { background: var(--out-wash); color: var(--out); }

/* These are spans inside a grid cell: without display:block the overflow and
   ellipsis rules below are ignored and long names run under the amount. */
.ledger .what { display: block; min-width: 0; overflow: hidden; }
.ledger .what .t {
  display: block;
  font-weight: 550; font-size: .94rem; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ledger .what .m {
  display: block;
  font-size: .78rem; color: var(--ink-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ledger .val { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.ledger .val .a { display: block; font-weight: 620; font-size: .98rem; letter-spacing: -0.01em; white-space: nowrap; }
.ledger .in  .val .a { color: var(--in); }
.ledger .out .val .a { color: var(--ink); }
.ledger .val .s { display: block; font-size: .7rem; margin-top: 2px; white-space: nowrap; }
.ledger .val .s.pending { color: var(--pending); }
.ledger .val .s.failed  { color: var(--out); }
.ledger .val .s.synced  { color: var(--ink-faint); }

/* Each day sits in its own sheet, so the header is ruled at the top of that
   sheet rather than pinned — a pinned header from the next day would ride
   over the rows of the one above it. */
.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 16px; background: #EFF3EA;
  border-bottom: 1px solid var(--rule);
  font-size: .78rem; color: var(--ink-soft); font-weight: 550;
}
.day-head .net { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- empty */
.empty { padding: 40px 22px; text-align: center; color: var(--ink-soft); }
.empty i { font-size: 1.8rem; color: var(--rule-strong); display: block; margin-bottom: 12px; }
.empty h3 { font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.empty p { font-size: .87rem; margin-bottom: 16px; }

/* --------------------------------------------------------------- forms */
.form-label { font-size: .83rem; font-weight: 550; color: var(--ink-soft); margin-bottom: 5px; }
.form-control, .form-select {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-size: 1rem;
  background: var(--sheet);
  color: var(--ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--in);
  box-shadow: 0 0 0 3px rgba(30,122,76,.15);
}
.form-control::placeholder { color: var(--ink-faint); }

/* Amount entry is the most used field in the app, so it gets the room. */
.amount-field { position: relative; }
.amount-field .cur {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1.25rem; font-weight: 550; color: var(--ink-faint); pointer-events: none;
}
.amount-field input {
  font-size: 2rem; font-weight: 650; letter-spacing: -0.02em;
  padding: 14px 14px 14px 46px; height: auto;
  font-variant-numeric: tabular-nums;
}

/* in/out chooser */
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.type-toggle label {
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-md);
  padding: 13px 10px; text-align: center; cursor: pointer;
  font-weight: 600; font-size: .93rem; color: var(--ink-soft);
  background: var(--sheet); transition: background .12s, border-color .12s, color .12s;
}
.type-toggle input:checked + label.in  { border-color: var(--in);  background: var(--in-wash);  color: var(--in); }
.type-toggle input:checked + label.out { border-color: var(--out); background: var(--out-wash); color: var(--out); }
.type-toggle input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

/* quick category / method chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--rule-strong); background: var(--sheet);
  border-radius: 999px; padding: 7px 13px; font-size: .86rem;
  color: var(--ink-soft); cursor: pointer; font-weight: 500;
}
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }

/* -------------------------------------------------------------- buttons */
.btn { border-radius: var(--r-md); font-weight: 580; padding: 11px 17px; font-size: .95rem; }
.btn-ink { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-ink:hover, .btn-ink:focus { background: #0E1A13; color: #fff; }
.btn-in { background: var(--in); color: #fff; border: 1px solid var(--in); }
.btn-in:hover, .btn-in:focus { background: #186040; color: #fff; }
.btn-quiet { background: var(--sheet); color: var(--ink); border: 1px solid var(--rule-strong); }
.btn-quiet:hover { background: #F0F3EC; color: var(--ink); }
.btn-danger-quiet { background: var(--out-wash); color: var(--out); border: 1px solid #E9C5BC; }
.btn-out { background: var(--out-wash); color: var(--out); border: 1px solid #E9C5BC; }
.btn-out:hover, .btn-out:focus { background: #F4DFDA; color: var(--out); }
.dashboard-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.dashboard-actions .btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }

/* Expand details only when a user asks for them. */
details.sheet > summary,
.ledger-filters > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 16px;
  font-size: .92rem; font-weight: 600;
}
details.sheet > summary::-webkit-details-marker,
.ledger-filters > summary::-webkit-details-marker { display: none; }
details.sheet > summary::after,
.ledger-filters > summary::after { content: "+"; color: var(--ink-soft); font-size: 1.2rem; font-weight: 400; }
details.sheet[open] > summary::after,
.ledger-filters[open] > summary::after { content: "−"; }
details.sheet[open] > summary { border-bottom: 1px solid var(--rule); }
.dashboard-summary { margin-top: 14px; }
.dashboard-summary summary .muted { font-size: .78rem; font-weight: 450; }
.dashboard-summary .summary-content { padding-bottom: 14px; }
.dashboard-summary .section-title { margin-left: 16px; margin-right: 16px; }
.report-section { margin-bottom: 12px; }
.report-section .report-subhead { font-size: .88rem; font-weight: 620; margin: 0 0 12px; }
.report-section .report-subhead:not(:first-child) { margin-top: 18px; }
.ledger-filters { border-top: 1px solid var(--rule); }
.ledger-filters > summary { min-height: 40px; padding: 8px 0 0; }
.ledger-title { display: flex; align-items: center; justify-content: space-between; }
.ledger-title .btn { padding: 7px 11px; }
.btn-lg-block { width: 100%; padding: 15px; font-size: 1.02rem; }

/* -------------------------------------------------------------- tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
  background: var(--sheet); border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--ink-faint);
  font-size: .68rem; font-weight: 550; height: var(--tabbar-h);
}
.tabbar a i { font-size: 1.12rem; }
.tabbar a.active { color: var(--in); }
.tabbar .record { position: relative; }
.tabbar .record i {
  background: var(--in); color: #fff; width: 40px; height: 40px;
  border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem;
  margin-top: -12px;
}
.tabbar .record.active i { background: #186040; }
.tabbar .record span { margin-top: -1px; }

/* --------------------------------------------------------------- charts */
.chart-wrap { position: relative; height: 210px; }
.chart-wrap.tall { height: 250px; }

/* ------------------------------------------------------------- toasts */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 1080; width: min(440px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast-note {
  background: var(--ink); color: #EFF4EF;
  border-radius: var(--r-md); padding: 12px 15px; font-size: .89rem;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(22,36,28,.22);
}
.toast-note.ok   { background: var(--in); }
.toast-note.warn { background: var(--pending); }
.toast-note.bad  { background: var(--out); }

/* --------------------------------------------------------------- misc */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--rule); }
.stat-cell { background: var(--sheet); padding: 14px 16px; }
.stat-cell .k { font-size: .77rem; color: var(--ink-soft); }
.stat-value { font-size: 1.2rem; font-weight: 620; letter-spacing: -0.02em; margin-top: 3px; }

.cat-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.cat-row:last-child { border-bottom: 0; }
.cat-swatch { width: 10px; height: 26px; border-radius: 3px; flex: none; }
.cat-bar { height: 5px; border-radius: 3px; background: var(--rule); overflow: hidden; margin-top: 5px; }
.cat-bar span { display: block; height: 100%; border-radius: 3px; }

.list-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.list-line:last-child { border-bottom: 0; }

.modal-content { border: 0; border-radius: var(--r-lg); }
.modal-header { border-bottom: 1px solid var(--rule); }
.modal-footer { border-top: 1px solid var(--rule); }

.auth-page {
  display: grid; place-items: center; min-height: 100dvh;
  padding: 24px 18px; background: var(--paper);
}
.auth-card { width: min(420px, 100%); }
.auth-card .sheet-body { padding: 26px; }

.text-in  { color: var(--in); }
.text-out { color: var(--out); }
.muted    { color: var(--ink-soft); }
.hairline { height: 1px; background: var(--rule); margin: 16px 0; }

@media (min-width: 768px) {
  .tabbar { position: static; display: none; }
  body { padding-bottom: 28px; }
  .desk-nav { display: flex; gap: 4px; margin-left: auto; }
  .desk-nav a {
    text-decoration: none; color: var(--ink-soft); font-size: .88rem; font-weight: 550;
    padding: 8px 13px; border-radius: var(--r-md);
  }
  .desk-nav a.active { background: var(--in-wash); color: var(--in); }
}
@media (max-width: 767.98px) {
  .desk-nav { display: none; }
}

/* ------------------------------------------------- shorts total slab */
/* One loud figure, the way the shorts register opens: what is outstanding. */
.total-slab { background: var(--ink); border-color: var(--ink); }
.slab-label {
  color: #9FB3A6; font-size: .78rem; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600;
}
.slab-value {
  color: #fff; font-size: clamp(2.2rem, 10vw, 3rem); font-weight: 680;
  letter-spacing: -.03em; line-height: 1.05; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.slab-sub { color: #8FA394; font-size: .8rem; margin-top: 8px; }

.cat-row .rank {
  width: 22px; flex: none; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 620;
  color: var(--ink-faint); font-size: .85rem;
}

/* --------------------------------------------- detail screens (drill-down) */
.detail-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px;
}
.detail-title {
  font-size: 1.35rem; font-weight: 660; letter-spacing: -.025em; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-sub {
  font-size: .84rem; color: var(--ink-soft); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* A person's balance is the red one: it is what they are accountable for. */
.owed-slab { background: var(--out-wash); border-color: #E9C5BC; }
.owed-slab .slab-label { color: var(--out); opacity: .85; }
.owed-slab .slab-value { color: var(--out); }
.owed-slab .slab-sub { color: #9A6B5F; }

.cat-row.tappable { cursor: pointer; }
.cat-row.tappable:active { background: #F7F9F4; }

/* ------------------------------------------------------------ tally table */
.tally { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tally th, .tally td { padding: 11px 16px; text-align: left; vertical-align: top; }
.tally thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); font-weight: 600; border-bottom: 1px solid var(--rule);
  padding-top: 13px; padding-bottom: 8px;
}
.tally tbody tr { border-bottom: 1px solid var(--rule); cursor: pointer; }
.tally tbody tr:last-child { border-bottom: 0; }
.tally tbody tr:active { background: #F7F9F4; }
.tally .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 620; color: var(--out); white-space: nowrap; }
.tally .d { display: block; font-weight: 550; }
.tally .ref {
  display: block; font-size: .72rem; color: var(--ink-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 2px;
}
.tally .pending-ref { color: var(--pending); font-family: var(--font-ui); font-style: italic; }
.tally .reason { display: block; }
.tally .note {
  display: block; font-size: .75rem; color: var(--ink-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24ch;
}
.tally tfoot th {
  border-top: 1px solid var(--rule-strong); font-size: .85rem;
  background: #F7F9F4; font-weight: 620;
}
.tally tfoot .num { color: var(--ink); }

/* Three stats should sit three across rather than leaving a dead cell. */
.stat-grid.three { grid-template-columns: repeat(3, 1fr); }
.stat-grid.three .stat-cell { padding: 13px 12px; }
.stat-grid.three .stat-value { font-size: 1.05rem; }
@media (max-width: 380px) {
  .stat-grid.three .stat-value { font-size: .95rem; }
}

/* ------------------------------------------------------------ team roles */
.role-chip {
  display: inline-block; border-radius: 999px; padding: 3px 9px;
  font-size: .7rem; font-weight: 620; text-transform: capitalize;
  border: 1px solid var(--rule-strong); color: var(--ink-soft); background: var(--sheet);
}
.role-chip.role-owner   { color: #7A5A12; border-color: #E8D3A8; background: var(--pending-wash); }
.role-chip.role-admin   { color: var(--in); border-color: #BEDCCB; background: var(--in-wash); }
.role-chip.role-cashier { color: #3D6B8E; border-color: #C3D6E4; background: #EDF3F8; }
.role-chip.role-viewer  { color: var(--ink-soft); }

.you {
  font-size: .68rem; font-weight: 600; color: var(--in);
  background: var(--in-wash); border-radius: 999px; padding: 1px 7px; margin-left: 5px;
  vertical-align: middle;
}
.ledger li.muted-row .what .t { color: var(--ink-faint); }

/* ---------------------------------------------------------- activity log */
/* A timeline rather than a table: the reading order is who, what, when. */
.audit { list-style: none; margin: 0; padding: 0; }
.audit li {
  display: grid; grid-template-columns: 30px 1fr; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--rule);
}
.audit li:last-child { border-bottom: 0; }

.audit .tick {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; flex: none;
  background: #EEF2EA; color: var(--ink-soft);
}
.audit .tick.good { background: var(--in-wash); color: var(--in); }
.audit .tick.bad  { background: var(--out-wash); color: var(--out); }

.audit .body { min-width: 0; }
.audit .line { display: block; font-size: .9rem; line-height: 1.4; }
.audit .subject { font-weight: 550; }
.audit .meta { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: 3px; }
.audit .offline-tag { color: var(--pending); }

.audit .changes { display: block; margin-top: 7px; }
.audit .change {
  display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: .74rem; background: #F4F7F1; border: 1px solid var(--rule);
  border-radius: var(--r-sm); padding: 3px 7px; margin: 0 5px 5px 0;
}
.audit .change .f { color: var(--ink-faint); }
.audit .change .from { color: var(--out); text-decoration: line-through; opacity: .75; }
.audit .change .to { color: var(--in); font-weight: 550; }
.audit .change i { font-size: .6rem; color: var(--ink-faint); }

a.list-line { display: flex; align-items: center; justify-content: space-between; }

/* ------------------------------------------------------- choice dialog */
/* Used where a confirm() would be too blunt: the options are spelled out
   and none of them is a default that quietly destroys work. */
.choice-overlay {
  position: fixed; inset: 0; z-index: 1090;
  background: rgba(22, 36, 28, .55);
  display: grid; place-items: end center;
  padding: 16px;
  overflow-y: auto;
}
@media (min-width: 640px) { .choice-overlay { place-items: center; } }

.choice-card {
  background: var(--sheet); border-radius: var(--r-lg);
  width: min(460px, 100%); padding: 22px 20px 20px;
  box-shadow: 0 16px 48px rgba(22, 36, 28, .3);
  margin-bottom: env(safe-area-inset-bottom, 0px);
}
.choice-card h2 {
  font-size: 1.1rem; font-weight: 650; letter-spacing: -.015em; margin: 0 0 10px;
}
.choice-body { font-size: .92rem; color: var(--ink-soft); line-height: 1.5; }
.choice-body p { margin: 0 0 10px; }
.choice-body strong { color: var(--ink); }
.choice-warn {
  color: var(--out); background: var(--out-wash); border: 1px solid #E9C5BC;
  border-radius: var(--r-md); padding: 9px 12px; font-size: .87rem;
}
.choice-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.choice-actions .btn { text-align: left; padding: 13px 15px; }
.choice-note {
  display: block; font-weight: 450; font-size: .76rem; opacity: .8; margin-top: 2px;
}

/* ------------------------------------------------------- icon alignment */
/* Keep Font Awesome glyphs inside their boxes even when a glyph has a wide
   side-bearing. Fixed flex sizing also prevents icons from being squeezed by
   long labels on settings and detail screens. */
.icon-btn > i,
.list-line > i,
.btn > i,
.sheet-head > i,
.detail-head > i {
  display: inline-flex;
  width: 1.05em;
  min-width: 1.05em;
  height: 1em;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: 0 0 auto;
}

.icon-btn {
  box-sizing: border-box;
  overflow: hidden;
}

/* Settings links: the icon, text and chevron each keep their own space. */
.setting-link {
  min-width: 0;
  box-sizing: border-box;
  padding: 13px 16px;
}
.setting-link .setting-icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
}
.setting-link .setting-copy {
  min-width: 0;
  overflow: hidden;
}
.setting-link .setting-copy strong,
.setting-link .setting-copy .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-link > .fa-chevron-right {
  margin-left: 8px;
  flex: 0 0 auto;
}

/* ---------------------------------------------------- Shorts month archive */
.shorts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.shorts-head .section-title { margin-bottom: 0 !important; }
.shorts-filter .sheet-body { padding: 13px 14px; }
.shorts-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.shorts-filter-grid label { min-width: 0; margin: 0; }
.shorts-filter-grid label > span {
  display: block;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .025em;
  margin: 0 0 5px 2px;
}
.shorts-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shorts-actions .btn { flex: 1 1 auto; }
.archive-readonly {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sheet);
}
.archive-readonly > i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  background: var(--wash);
  color: var(--ink-soft);
}
.archive-readonly strong,
.archive-readonly span { display: block; }
.archive-readonly strong { font-size: .88rem; }
.archive-readonly span { color: var(--ink-soft); font-size: .77rem; margin-top: 2px; }
.archive-list { display: grid; gap: 10px; }
.archive-month {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.archive-month:hover,
.archive-month:focus { color: inherit; }
.archive-month-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--wash);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  flex: 0 0 40px;
}
.archive-month-main { min-width: 0; flex: 1 1 auto; }
.archive-month-main strong,
.archive-month-main span { display: block; }
.archive-month-main strong { font-size: .92rem; }
.archive-month-main span { color: var(--ink-soft); font-size: .76rem; margin-top: 3px; }
.archive-month-total {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font-size: .9rem;
  font-weight: 650;
  color: var(--out);
}
.archive-month-total i { color: var(--ink-faint); font-size: .72rem; }

@media (max-width: 520px) {
  .shorts-filter-grid { grid-template-columns: 1fr; }
  .shorts-head { align-items: flex-end; }
  .archive-month { gap: 10px; padding: 12px; }
  .archive-month-total { font-size: .82rem; }
}


/* ---------------------------------------------------------- danger zone */
.danger-zone-entry { margin-top:22px; padding-top:16px; border-top:1px solid #E9C5BC; }
.btn-danger-zone, .btn-danger-action { background:var(--out); border:1px solid var(--out); color:#fff; font-weight:700; }
.btn-danger-zone:hover, .btn-danger-zone:focus, .btn-danger-action:hover, .btn-danger-action:focus { background:#8F2F21; border-color:#8F2F21; color:#fff; }
.btn-danger-zone:disabled, .btn-danger-action:disabled { opacity:.6; }
.danger-warning { display:flex; gap:12px; align-items:flex-start; padding:14px; border:1px solid #E9C5BC; border-radius:var(--r-md); background:var(--out-wash); color:var(--out); }
.danger-warning > i { margin-top:2px; font-size:1.05rem; }
.danger-warning strong { display:block; }
.danger-warning span { display:block; margin-top:2px; font-size:.8rem; color:#70473F; }
.danger-card { border-color:#E9C5BC; }
.danger-card .sheet-head { border-bottom-color:#E9C5BC; }
.danger-card .sheet-head h2 { color:var(--out); }
.danger-count { color:var(--out); background:var(--out-wash); border:1px solid #E9C5BC; border-radius:999px; padding:3px 8px; font-size:.72rem; white-space:nowrap; }


/* ------------------------------------------------ notification permission bubble */
.notification-enable-bubble {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1045;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100vw - 28px);
  padding: 10px 15px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(34, 45, 35, .18);
  white-space: nowrap;
}
.notification-enable-bubble:hover,
.notification-enable-bubble:focus { color:#fff; transform:translateX(-50%) translateY(-1px); }
.notification-enable-bubble[hidden] { display:none !important; }
.notification-enable-bubble.is-blocked { background:var(--out); border-color:var(--out); }
@media (min-width: 821px) {
  .notification-enable-bubble { bottom: 22px; }
}
\n\n/* ---------------------------------------------------------- app footer */\n.app-footer {\n  margin: 26px auto 18px;\n  padding: 14px 18px calc(92px + env(safe-area-inset-bottom));\n  text-align: center;\n  color: var(--ink-soft);\n  font-size: .72rem;\n  line-height: 1.55;\n}\n.app-footer strong { color: var(--ink); font-weight: 650; }\n.auth-footer {\n  width: min(100%, 520px);\n  margin-top: 18px;\n  padding-bottom: calc(20px + env(safe-area-inset-bottom));\n}\n@media (min-width: 821px) {\n  .app-footer { padding-bottom: 24px; }\n}\n
/* ----------------------------------------------------- cash handovers */
.handover-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.handover-metric { padding:16px; background:var(--sheet); border:1px solid var(--rule); border-radius:var(--r-lg); min-width:0; }
.handover-metric small { display:block; color:var(--ink-soft); font-size:.76rem; margin-bottom:5px; }
.handover-metric strong { display:block; font-size:clamp(1.05rem,4vw,1.5rem); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.handover-note { border:1px solid #E8D3A8; background:var(--pending-wash); border-radius:8px; padding:10px; margin-bottom:14px; font-size:.82rem; }
.handover-remainder { padding:13px 14px; background:var(--in-wash); border-radius:8px; display:flex; justify-content:space-between; align-items:center; gap:10px; }
.handover-remainder span { font-size:.8rem; }
.handover-remainder strong { font-variant-numeric:tabular-nums; font-size:1.15rem; }
.handover-review, .handover-history, .handover-branch { padding:14px 0; border-bottom:1px solid var(--rule); }
.handover-review:first-child, .handover-history:first-child, .handover-branch:first-child { padding-top:0; }
.handover-review:last-child, .handover-history:last-child, .handover-branch:last-child { border-bottom:0; padding-bottom:0; }
.handover-values { display:flex; flex-wrap:wrap; gap:9px 22px; margin-bottom:10px; }
.handover-values > span { min-width:120px; display:flex; flex-direction:column; font-size:.74rem; color:var(--ink-soft); }
.handover-values strong { color:var(--ink); font-size:.97rem; font-variant-numeric:tabular-nums; }
.handover-location-row { display:flex; gap:12px; justify-content:space-between; padding:7px 0; border-top:1px solid var(--rule); align-items:center; }
.handover-location-row span { font-size:.87rem; min-width:0; }
.handover-location-row small, .handover-history small { display:block; color:var(--ink-soft); font-size:.73rem; font-weight:400; }
.handover-status { display:inline-block; flex:none; text-transform:capitalize; padding:4px 9px; border-radius:999px; font-size:.73rem; font-weight:650; }
.handover-status.pending { color:#86540a; background:var(--pending-wash); }
.handover-status.approved { color:var(--in); background:var(--in-wash); }
.handover-status.rejected { color:var(--out); background:var(--out-wash); }
@media(max-width:390px) { .handover-metrics { grid-template-columns:1fr; } }
