/* Recon dashboard ---------------------------------------------------------
   One family (Public Sans), tabular figures for every number.
   The settlement tape is the one bold element; everything else stays quiet. */

/* The hidden attribute always wins over component display rules (e.g. Users / Settings nav for viewers). */
[hidden] { display: none !important; }

@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Peppermint Innovation brand (pepltd.com.au): green #049F82, charcoal #222222 / #353535,
     greys #676767 / #EEEEEE / #F7F7F7. The deeper greens carry text and button labels at
     readable contrast (#00826A: 4.8:1 with white; #00735D: 5.4:1 on the page). */
  --paper: #F7F7F7;
  --paper-2: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #222222;
  --ink-2: #353535;
  --muted: #676767;
  --rule: #E2E2E2;
  --rule-soft: #EEEEEE;
  --brand: #049F82;
  --brand-strong: #00826A;
  --brand-hover: #00735D;
  --brand-text: #00735D;
  --brand-soft: #E4F4F0;
  --matched: #049F82;
  --matched-soft: #E4F4F0;
  --break: #C0392B;
  --break-soft: #F9E6E3;
  --pending: #B26B00;
  --pending-soft: #FBEFD9;
  --none: #E6E6E6;
  --rejected: #9E9E9E;
  --focus: #049F82;
  --shadow: 0 1px 2px rgba(34, 34, 34, 0.05), 0 1px 1px rgba(34, 34, 34, 0.03);

  --r-sm: 4px;
  --r-md: 8px;
  --gutter: clamp(16px, 3vw, 40px);
  --maxw: 1280px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.125rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161716;
    --paper-2: #1B1C1B;
    --surface: #1F2120;
    --ink: #EEEEEE;
    --ink-2: #CFCFCF;
    --muted: #A3A3A3;
    --rule: #333634;
    --rule-soft: #2A2C2B;
    --brand: #2DBE9E;
    --brand-strong: #049F82;
    --brand-hover: #2DBE9E;
    --brand-text: #3CC9A9;
    --brand-soft: #12352D;
    --matched: #2DBE9E;
    --matched-soft: #12352D;
    --break: #F07A70;
    --break-soft: #43231F;
    --pending: #E0A84E;
    --pending-soft: #3D2F17;
    --none: #2E302F;
    --rejected: #7D7D7D;
    --focus: #3CC9A9;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

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

.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.break-text { color: var(--break); }
.ok-text { color: var(--brand-text); }
.pending-text { color: var(--pending); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Header -------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.top-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
  height: 56px; display: flex; align-items: center; gap: 28px;
}
.brand {
  text-decoration: none; font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.env {
  font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px;
}
.env:empty { display: none; }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: var(--fs-sm);
  padding: 6px 10px; border-radius: var(--r-sm);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--rule-soft); }
.live { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.live span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--matched); flex: none; }
.dot.busy { background: var(--pending); animation: pulse 1.2s ease-in-out infinite; }
.dot.down { background: var(--break); }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .dot.busy { animation: none; } }

.user { position: relative; }
.user > button {
  border: 1px solid var(--rule); background: var(--surface); border-radius: 999px;
  padding: 4px 12px; font-size: var(--fs-sm); cursor: pointer; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); z-index: 20;
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
  border-radius: var(--r-sm); text-decoration: none; font-size: var(--fs-sm); cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--rule-soft); }
.menu .menu-note { padding: 8px 10px; font-size: var(--fs-xs); color: var(--muted); border-bottom: 1px solid var(--rule-soft); margin-bottom: 4px; }

/* --- Page ---------------------------------------------------------------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 80px; outline: none; }
.loading { color: var(--muted); }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-xl); line-height: 1.2; }
.day-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.day-head h1 .pill { margin-left: 0; vertical-align: baseline; }
.nowrap { white-space: nowrap; }
table.data td:last-child { min-width: 24ch; overflow-wrap: anywhere; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }

section + section { margin-top: 32px; }

/* --- Settlement tape ----------------------------------------------------- */
.tape { margin-top: 4px; }
.tape-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.tape-head p { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: var(--fs-xs); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tape-row { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.tape-cell {
  position: relative; border: 0; padding: 0; cursor: pointer; background: none;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
}
.tape-cell .bar { height: 36px; border-radius: 3px; background: var(--none); transition: transform 120ms ease; }
.tape-cell .d { font-size: 0.6875rem; color: var(--muted); text-align: center; line-height: 1; }
.tape-cell:hover .bar { transform: scaleY(1.08); }
.tape-cell[aria-current="date"] .bar { outline: 2px solid var(--ink); outline-offset: 2px; }
.tape-cell[aria-current="date"] .d { color: var(--ink); font-weight: 700; }
.s-clean { background: var(--matched) !important; }
.s-breaks { background: var(--break) !important; }
.s-pending { background: var(--pending) !important; }
.s-partial { background: repeating-linear-gradient(135deg, var(--pending) 0 3px, var(--pending-soft) 3px 6px) !important; }
.s-none { background: var(--none) !important; }
@media (max-width: 720px) {
  .tape-row { grid-template-columns: repeat(15, minmax(0, 1fr)); }
  .tape-cell:nth-child(-n+15) { display: none; }
}

/* --- Day header ---------------------------------------------------------- */
.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.day-head .sub { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.actions { display: flex; gap: 8px; position: relative; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; border-radius: 999px; padding: 2px 10px; vertical-align: 3px; margin-left: 10px; }
.pill.final { background: var(--matched-soft); color: var(--brand-text); }
.pill.breaks { background: var(--break-soft); color: var(--break); }
.pill.pending { background: var(--pending-soft); color: var(--pending); }
.pill.none { background: var(--rule-soft); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--surface);
  border-radius: var(--r-sm); padding: 7px 12px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-2); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.small { padding: 4px 10px; font-weight: 500; }

/* --- Balance ------------------------------------------------------------- */
.balance {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 22px 24px 20px;
}
.balance-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: start; gap: 12px 20px; }
.side .label { font-size: var(--fs-sm); color: var(--muted); }
.side .count { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; margin-top: 2px; }
.side .amount { font-size: var(--fs-md); color: var(--ink-2); margin-top: 2px; }
.side .split { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
/* figures are top-aligned; the operator sits level with the counts (below the labels) */
.op { font-size: var(--fs-xl); color: var(--muted); padding-top: 1.05rem; font-weight: 300; line-height: 1.15; }
.side.diff .count.zero { color: var(--brand-text); }
.side.diff .count.nonzero { color: var(--break); }
.side.diff .count.pending { color: var(--pending); }

.meter { margin-top: 20px; }
.meter-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--none); }
.meter-bar > span { display: block; height: 100%; }
.meter-bar .m { background: var(--matched); }
.meter-bar .b { background: var(--break); }
.meter-bar .p { background: var(--pending); }
.meter-bar .a { background: var(--rule); }
.meter-bar .r { background: var(--rejected); }
.meter-key .key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.meter-key .key.r { background: var(--rejected); }
.meter-key { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.meter-key strong { color: var(--ink); font-weight: 650; }

@media (max-width: 820px) {
  .balance-row { grid-template-columns: 1fr 1fr; }
  .op { display: none; }
  .side.diff { grid-column: 1 / -1; }
}

.bridge { margin-top: 18px; border-top: 1px solid var(--rule-soft); padding-top: 12px; }
.bridge summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); width: max-content; }
.bridge p { margin: 10px 0 0; font-size: var(--fs-sm); }
.bridge-table { margin-top: 10px; border-collapse: collapse; font-size: var(--fs-sm); min-width: min(560px, 100%); }
.bridge-table th { text-align: left; font-weight: 500; padding: 5px 24px 5px 0; }
.bridge-table td { padding: 5px 0; min-width: 16ch; }
.bridge-table tr.is-break td { color: var(--break); }
.bridge-table tr.total th, .bridge-table tr.total td { font-weight: 650; border-top: 1px solid var(--rule); padding-top: 8px; }
.bridge-table tr.ok th, .bridge-table tr.ok td { color: var(--brand-text); font-weight: 650; }

/* --- Two-column: breaks + files ----------------------------------------- */
.split2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; margin-top: 32px; }
@media (max-width: 960px) { .split2 { grid-template-columns: 1fr; } }
.split1 { margin-top: 32px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.panel-head .muted { font-size: var(--fs-sm); }

.breaks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.breaks li { border-bottom: 1px solid var(--rule-soft); }
.breaks button {
  width: 100%; display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: baseline;
  padding: 9px 4px; background: none; border: 0; text-align: left; cursor: pointer; font-size: var(--fs-sm);
}
.breaks button:hover { background: var(--rule-soft); }
.breaks button[aria-pressed="true"] { background: var(--rule-soft); box-shadow: inset 3px 0 0 var(--ink); }
.breaks .n { font-weight: 650; min-width: 4ch; text-align: right; }
.breaks .amt { color: var(--muted); min-width: 16ch; text-align: right; }
.breaks .is-break .n { color: var(--break); }
.breaks .zero .n, .breaks .zero .name { color: var(--muted); }
.breaks li.total button { font-weight: 650; cursor: default; }
.breaks li.total button:hover { background: none; }
.breaks li.group { padding: 14px 4px 4px; font-size: var(--fs-xs); color: var(--muted); border-bottom: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th {
  text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.data th.num, table.data td.num { text-align: right; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--rule-soft); }
.table-wrap { overflow-x: auto; border-top: 0; }
.mono-id { font-feature-settings: "tnum" 1, "zero" 1; letter-spacing: 0.01em; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-LOADED, .st-SUCCEEDED, .st-DONE, .st-MATCHED { color: var(--brand-text); }
.st-FAILED, .st-REJECTED { color: var(--break); }
.st-LOADING, .st-RECEIVED, .st-RUNNING, .st-QUEUED { color: var(--pending); }
.st-SUPERSEDED, .st-DUPLICATE, .st-MISSING, .st-SKIPPED { color: var(--muted); }
.err { color: var(--break); font-size: var(--fs-xs); margin-top: 2px; max-width: 60ch; }
.fname { overflow-wrap: anywhere; font-size: var(--fs-xs); }
.exc-detail { min-width: 300px; }

.sev-HIGH { color: var(--break); font-weight: 600; }
.sev-LOW { color: var(--pending); }
.sev-INFO { color: var(--muted); }

/* --- Exceptions ---------------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--rule); background: var(--surface); border-radius: 999px; padding: 3px 11px;
  font-size: var(--fs-xs); font-weight: 500; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .c { opacity: 0.7; margin-left: 4px; }
.search {
  margin-left: auto; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r-sm);
  padding: 6px 10px; font-size: var(--fs-sm); min-width: 240px;
}
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; font-size: var(--fs-sm); color: var(--muted); }
.empty { padding: 28px 4px; color: var(--muted); font-size: var(--fs-sm); }

/* --- Lookup -------------------------------------------------------------- */
.lookup-form { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.lookup-form textarea {
  width: 100%; min-height: 52px; resize: vertical; border: 1px solid var(--rule); background: var(--surface);
  border-radius: var(--r-md); padding: 13px 14px; font-size: var(--fs-lg); line-height: 1.4;
}
.lookup-more { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: var(--fs-sm); color: var(--muted); align-items: center; }
.lookup-more label { display: flex; gap: 6px; align-items: center; }
.lookup-more input { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r-sm); padding: 5px 8px; font-size: var(--fs-sm); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm); max-width: 72ch; }
.btn.go { padding: 15px 22px; font-size: var(--fs-md); }

.result { margin-top: 28px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.result-head h3 { font-size: var(--fs-lg); }
.compare { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.compare th, .compare td { padding: 9px 18px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: top; }
.compare thead th { color: var(--muted); font-weight: 600; width: 21.75%; }
.compare thead th:first-child { width: 13%; }
.compare tbody th { color: var(--muted); font-weight: 500; }
.compare td.diff { color: var(--break); font-weight: 650; }
.compare td.absent { color: var(--muted); }
.compare td { overflow-wrap: anywhere; }
.result-exc { padding: 12px 18px; font-size: var(--fs-sm); display: grid; gap: 4px; }

.verdict { font-size: var(--fs-sm); font-weight: 650; border-radius: 999px; padding: 3px 12px; }
.v-ok { background: var(--matched-soft); color: var(--brand-text); }
.v-bad { background: var(--break-soft); color: var(--break); }
.v-warn { background: var(--pending-soft); color: var(--pending); }
.v-neutral { background: var(--rule-soft); color: var(--ink-2); }

/* --- Control totals ------------------------------------------------------ */
.ct { margin-top: 24px; }
.ct-table { font-variant-numeric: tabular-nums; }
.ct-table td.num .muted, .ct-table td.num div { font-size: var(--fs-xs); margin-top: 1px; }
.ct-table tr.grp th { color: var(--ink); font-weight: 650; border-bottom: 0; }
.ct-table tr.sub th, .ct-table tr.types td { border-bottom: 1px solid var(--rule-soft); }
.ct-table tr.grp td { font-weight: 600; border-bottom: 0; }
.ct-table tr.sub th { font-weight: 400; color: var(--muted); padding-left: 22px; }
.ct-table tr.sub td { color: var(--muted); }
.ct-table tr.types td { padding-top: 0; }
.ct-table details summary { cursor: pointer; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; padding-left: 12px; }
.ct-types { margin-top: 6px; }
.ct-types tr.sub th { padding-left: 10px; white-space: normal; }
.small { font-size: var(--fs-xs); margin: 0; max-width: 32ch; }

/* --- Export popover ------------------------------------------------------ */
.pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 300px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); display: grid; gap: 10px;
}
.pop h3 { font-size: var(--fs-sm); }
.pop .row { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.pop input { border: 1px solid var(--rule); background: var(--paper); border-radius: var(--r-sm); padding: 5px 8px; font-size: var(--fs-sm); width: 100%; }
.pop hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 2px 0; width: 100%; }

/* --- Upload --------------------------------------------------------------- */
.drop {
  display: grid; gap: 6px; place-items: center; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--rule); border-radius: var(--r-md); background: var(--surface);
  padding: 34px 20px; transition: border-color 120ms ease, background 120ms ease;
}
.drop:hover, .drop.over { border-color: var(--ink); background: var(--rule-soft); }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-title { font-weight: 600; }
.drop-title .link { text-decoration: underline; text-underline-offset: 3px; }
.drop-hint { color: var(--muted); font-size: var(--fs-sm); max-width: 70ch; }
.queue { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.q-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 2px 10px; border-bottom: 1px solid var(--rule-soft); font-size: var(--fs-sm); }
.q-name { font-weight: 600; overflow-wrap: anywhere; }
.q-side { display: flex; align-items: center; gap: 10px; }
.q-bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--rule-soft); overflow: hidden; }
.q-bar span { display: block; height: 100%; width: 0; background: var(--matched); transition: width 160ms linear; }
.q-choose { margin-top: 8px; display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; color: var(--ink-2); }
.q-choose label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.q-choose select, .q-choose input { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r-sm); padding: 4px 8px; font-size: var(--fs-sm); color: var(--ink); }
.q-confirm.all { margin: 14px 0 0; padding: 10px 12px; background: var(--pending-soft); border-radius: var(--r-md); }
.q-confirm { margin-top: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .q-bar span, .drop { transition: none; } }

.imports .imp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 2px; border-bottom: 1px solid var(--rule-soft); font-size: var(--fs-sm); }
.imp-hist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.imp-hist li { display: flex; gap: 10px; flex-wrap: wrap; }
.imp-ignored { margin-top: 6px; }
.imp-ignored summary { cursor: pointer; color: var(--muted); width: max-content; }
.imp-ignored ul { margin: 6px 0 0; padding-left: 18px; }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-md);
  font-size: var(--fs-sm); transition: opacity 160ms ease, transform 160ms ease; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.notice { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--pending-soft); color: var(--ink); font-size: var(--fs-sm); }
.notice.bad { background: var(--break-soft); }

@media (max-width: 640px) {
  /* menu on its own row under the brand, status and user (5 items for admins) */
  .top-inner { gap: 4px 10px; flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
  .nav a { white-space: nowrap; }
  .env { display: none; }
  .nav a { padding: 6px 6px; }
  .live span { display: none; }
  .search { min-width: 0; width: 100%; margin-left: 0; }
  .lookup-form { grid-template-columns: 1fr; }
  .user > button { max-width: 88px; }
}
.page > .hint + section, .page > .hint + .notice { margin-top: 24px; }

/* --- Totals by report (deposits / withdrawals / Bizmoto) ------------------ */
.sections { margin-top: 20px; }
.sec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .sec-grid { grid-template-columns: 1fr; } }
.sec { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px; }
.sec h3 { font-size: var(--fs-md); margin: 0 0 10px; }
.sec dl { margin: 0; display: grid; gap: 6px; }
.sec dl > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; }
.sec dt { color: var(--muted); font-size: var(--fs-sm); }
.sec dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.sec dd span { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--ink-2); }
.sec .disc { border-top: 1px solid var(--rule); padding-top: 6px; }
.sec .disc dt { color: inherit; font-weight: 650; }
.sec .disc dd span { color: inherit; }
.sec-items { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--rule-soft);
  display: grid; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.sec-items li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.sec-items li .n, .sec-items li .amt { text-align: right; font-variant-numeric: tabular-nums; }
.sec-items li.is-break { color: var(--break); }
.sec p { font-size: var(--fs-xs); margin: 10px 0 0; }
details.ct > summary { cursor: pointer; list-style: none; }
details.ct > summary::-webkit-details-marker { display: none; }
details.ct > summary h2::before { content: "▸ "; color: var(--muted); }
details.ct[open] > summary h2::before { content: "▾ "; }

/* Overall card: MC Connect - ((Java Deposit + Java Withdrawal) + Bizmoto) */
.balance .formula { margin: 0 0 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.balance-row.five { grid-template-columns: 1.15fr auto 1fr auto 1fr auto 0.8fr auto 1.1fr; gap: 12px 14px; }
.balance-row.five .side .count { font-size: var(--fs-xl); }
.balance-row.five .op { padding-top: 1.15rem; }
@media (max-width: 1100px) {
  .balance-row.five { grid-template-columns: 1fr 1fr; }
  .balance-row.five .op { display: none; }
  .balance-row.five .side.diff { grid-column: 1 / -1; }
}
.sec .adj dt, .sec .adj dd { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.sec .adj dd span { font-size: var(--fs-xs); color: var(--muted); }
.sec .adj { padding-left: 10px; }
.sec .adj-total { border-top: 1px dashed var(--rule); padding-top: 4px; }

/* --- Footer ------------------------------------------------------------------ */
.site-foot { display: flex; justify-content: center; padding: 8px var(--gutter) 28px; }
.site-foot img { display: block; height: 24px; width: auto; opacity: 0.9; }

/* --- Sign-in page (in the dashboard itself) --------------------------------------- */
body.signed-out .nav, body.signed-out .live, body.signed-out .user { display: none; }
.auth-wrap { min-height: calc(100vh - 190px); display: grid; place-items: center; padding: 24px 0; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 28px 28px 24px; box-shadow: 0 8px 30px rgb(0 0 0 / 0.06);
}
.auth-brand { font-weight: 700; letter-spacing: -0.01em; color: var(--muted); font-size: var(--fs-sm); margin-bottom: 14px; }
.auth-card h1 { font-size: var(--fs-xl); margin: 0 0 4px; letter-spacing: -0.015em; }
.auth-sub { margin: 0 0 18px; color: var(--muted); font-size: var(--fs-sm); }
.auth-card form { display: grid; gap: 6px; }
.auth-card label, .acct-form label { font-size: var(--fs-sm); font-weight: 600; margin-top: 8px; }
.auth-card input[type=email], .auth-card input[type=password], .auth-card input.code,
.acct-form input[type=password], .acct-form input.code {
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: var(--fs-md); font-family: inherit; width: 100%;
}
.auth-card input:focus, .acct-form input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
input.code { font-size: 1.375rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.btn.wide { width: 100%; justify-content: center; padding: 11px 14px; margin-top: 14px; font-size: var(--fs-md); }
.auth-hint { color: var(--muted); font-size: var(--fs-xs); margin: 2px 0 0; }
.auth-error { color: var(--break); background: var(--break-soft); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--fs-sm); margin: 10px 0 0; }
.auth-ok { color: var(--brand-text); background: var(--matched-soft); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--fs-sm); }
.auth-who { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 16px;
  padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); font-size: var(--fs-sm); }
.auth-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.auth-who a { color: var(--ink-2); flex: none; }
.auth-choices { display: grid; gap: 10px; margin: 4px 0 2px; }
.auth-choice { display: grid; gap: 3px; text-align: left; width: 100%; padding: 14px 16px; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.auth-choice strong { font-size: var(--fs-md); }
.auth-choice small { color: var(--muted); font-size: var(--fs-sm); }
.auth-choice.preferred { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.auth-choice:hover { border-color: var(--ink); }
.auth-choice:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.auth-choice:disabled { opacity: 0.7; cursor: progress; }
.auth-hint + form, .auth-who + form { margin-top: 0; }
.auth-choice .tag { font-size: var(--fs-xs); font-weight: 600; color: var(--brand-text); background: var(--matched-soft);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
.pk-warn { color: var(--break); font-size: var(--fs-sm); padding: 6px 2px 2px; border: 0 !important; }
.auth-links { text-align: center; font-size: var(--fs-sm); margin: 16px 0 0; }
.auth-links a { color: var(--ink-2); }
.auth-steps { padding-left: 18px; margin: 0 0 10px; font-size: var(--fs-sm); display: grid; gap: 10px; }
.qr-box { margin: 10px 0 6px; }
.qr-box img.qr { display: block; image-rendering: pixelated; border-radius: 6px; background: #fff; padding: 4px; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: var(--fs-sm); letter-spacing: 0.06em; word-break: break-all;
  background: var(--paper); border: 1px dashed var(--rule); border-radius: var(--r-sm); padding: 8px 10px; }
details summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); }

/* --- Account & security ------------------------------------------------------------- */
.acct { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; margin-top: 16px; max-width: 760px; }
.acct section + section { margin-top: 0; }
.acct .panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 18px 20px; }
.acct .panel h2 { font-size: var(--fs-lg); margin: 0; }
.acct .panel p { font-size: var(--fs-sm); }
.acct-form { display: grid; gap: 6px; max-width: 360px; }
.acct-form .btn { justify-self: start; margin-top: 10px; }
.pk-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.pk-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm); padding: 8px 10px; }
.pk-list small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.page-head h1 { font-size: var(--fs-xl); margin: 8px 0 2px; }
.page-head .sub { color: var(--muted); margin: 0; font-size: var(--fs-sm); }

/* Users (admin) */
.invite-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.invite-form label { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.invite-form input, .invite-form select, table.users select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.invite-form label:first-child { flex: 1 1 280px; max-width: 360px; }
.invite-form input { width: 100%; }
.role-help { font-size: var(--fs-sm); margin: 8px 0 0; }
.invite-form label.nm { flex: 0 1 180px; }
table.users .u-name { display: inline; }
table.users .u-email.muted { font-size: var(--fs-xs); margin-top: 1px; }
table.users .u-name-btn { display: block; margin-top: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-xs);
  color: var(--brand-text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
table.users .u-name-btn:hover { color: var(--ink); }
table.users .u-name-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
/* first / last name: Account page and the Users page edit row */
.name-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 12px; }
.name-grid > div { display: grid; gap: 4px; }
.name-grid label { font-size: var(--fs-sm); font-weight: 600; }
.acct-form.name-form { max-width: none; }
.name-grid input { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); }
.name-edit .name-grid input { background: var(--surface); }
.name-grid input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.name-edit .name-grid { max-width: 460px; margin: 4px 0 10px; }
.confirm.name-edit { margin-left: 0; }
.acct-form .name-grid label { margin-top: 0; }
.panel.invite { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px; }
table.users td { vertical-align: middle; }
table.users select { padding: 5px 8px; }
table.users .tag { font-size: var(--fs-xs); color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; margin-left: 4px; }
/* a table cell, not the page-head .actions flex row; buttons wrap instead of pushing the table wider */
table.users td.actions { display: table-cell; position: static; text-align: right; min-width: 200px; }
table.users td.actions .btn { margin: 2px 0 2px 4px; }
table.users th.actions-h { text-align: right; }
.btn.danger { color: var(--break); }
.btn.danger.solid { background: var(--break); border-color: var(--break); color: var(--paper); }
.confirm { display: grid; gap: 10px; padding: 12px 14px; background: var(--rule-soft); border-radius: var(--r-sm); max-width: 72ch; margin-left: auto; }
.confirm p { margin: 0; font-size: var(--fs-sm); }
.confirm .chk { font-size: var(--fs-sm); display: flex; gap: 8px; align-items: center; }
.confirm-btns { display: flex; gap: 8px; }
.st-ACTIVE { color: var(--brand-text); }
.st-INVITED, .st-NO_SECOND_STEP, .st-RESET { color: var(--pending); }
.st-DISABLED { color: var(--muted); }

/* Settings (admin): drive connections */
.conn-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; margin-top: 16px; }
.conn-grid section + section { margin-top: 0; }
.panel.conn { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px; }
.panel.conn form { display: grid; gap: 12px; }
.conn-status { text-align: right; font-size: var(--fs-sm); }
.fld { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.fld small, .panel.conn > form > small { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.fld input, .small-fld input { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); width: 100%; }
.fld-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.small-fld { max-width: 160px; }
.switch { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); font-weight: 600; }
.keybox { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 400;
  border: 1px dashed var(--rule); border-radius: var(--r-sm); padding: 8px 10px; overflow-wrap: anywhere; }
.filebtn { cursor: pointer; flex: none; }
.where { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-sm); }
.where legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.where label { display: flex; gap: 6px; align-items: center; }
details.adv summary, details.howto summary { cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); }
details.adv[open] { display: grid; gap: 10px; }
details.howto ol { font-size: var(--fs-sm); color: var(--ink-2); padding-left: 20px; margin: 8px 0 0; display: grid; gap: 4px; }
.conn-result { font-size: var(--fs-sm); border-radius: var(--r-sm); padding: 10px 12px; }
.conn-result.ok { background: var(--matched-soft); }
.conn-result.bad { background: var(--break-soft); color: var(--break); }
.conn-result p { margin: 0 0 6px; }
.conn-files { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; font-size: var(--fs-xs); }
.ok-txt { color: var(--brand-text); font-weight: 600; }
.conn-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Upload panel on other pages (uploads keep running in the open tab) */
.tray { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14); font-size: var(--fs-sm); }
.tray[hidden] { display: none; }
.t-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); }
.t-title { all: unset; cursor: pointer; font-weight: 600; flex: 1; }
.t-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.t-link { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; }
.t-x { all: unset; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); padding: 0 2px; }
.t-list { list-style: none; margin: 0; padding: 6px 12px 10px; display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.t-row { display: flex; justify-content: space-between; gap: 10px; }
.t-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-st { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-list li.ask .t-st a { color: var(--pending); font-weight: 600; }
.t-list li.bad .t-st { color: var(--break); }
.t-bar { height: 4px; background: var(--rule-soft); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.t-bar span { display: block; height: 100%; background: var(--matched); transition: width 300ms linear; }
.t-note { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: var(--fs-xs); }
@media (prefers-reduced-motion: reduce) { .t-bar span { transition: none; } }

/* Unreadable rows of a file (Uploads ?file=) */
.file-errors { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; margin-top: 16px; scroll-margin-top: 72px; }
.kvs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.kv { white-space: nowrap; font-size: var(--fs-xs); }
.kv .k { color: var(--muted); }
.err-reason { color: var(--break); white-space: nowrap; }

/* Zip of reports in the upload list */
.zip-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.zip-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.zip-list .status { font-size: var(--fs-xs); }

/* Rejected transactions tally (day view) */
.rejected { margin-top: 24px; }
.rej-table tfoot th { border-top: 1px solid var(--rule); padding: 8px 10px; }
.rej-detail { margin-top: 10px; }
.rej-detail > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 10px; }

/* Numbered pager (exceptions) */
.pager { flex-wrap: wrap; gap: 6px; }
.pager .range { margin-right: 8px; }
.pager .page { min-width: 34px; justify-content: center; font-variant-numeric: tabular-nums; }
.pager .page.cur { background: var(--ink); border-color: var(--ink); color: var(--paper); opacity: 1; }
.pager .gap { color: var(--muted); padding: 0 2px; }
#excTable { scroll-margin-top: 72px; }

/* Matching runs: short errors, details on demand */
tr.resolved td { opacity: 0.7; }

/* Error details window */
.linkbtn { all: unset; cursor: pointer; color: var(--ink-2); text-decoration: underline; font-size: var(--fs-xs); margin-left: 4px; }
.linkbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.err-dialog { border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  padding: 18px 20px; width: min(760px, calc(100vw - 32px)); max-height: min(80vh, 720px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.err-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.err-dialog h2 { margin: 0 0 10px; font-size: var(--fs-lg); overflow-wrap: anywhere; }
.err-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-xs); background: var(--rule-soft);
  border-radius: var(--r-sm); padding: 10px 12px; margin: 0; max-height: 55vh; overflow: auto; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Retry / Remove side by side under a failed file */
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.zip-list [data-retry], .q-side [data-retry] { margin-left: 4px; }

/* Sortable column headers (Recent files) */
table.data th .sortbtn {
  font: inherit; color: inherit; background: none; border: 0; padding: 2px 0; margin: 0;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
table.data th .sortbtn:hover, table.data th .sortbtn.cur { color: var(--ink); }
table.data th .sortbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
table.data th .sort-ind { font-size: 0.7em; opacity: 0.45; }
table.data th .sortbtn.cur .sort-ind { opacity: 1; }
.load-note { font-size: var(--fs-xs); min-width: 9.5rem; margin-top: 2px; }
[data-reload], [data-retry] { white-space: nowrap; }

/* Unreadable rows: Fix form */
.file-errors tr.row-fixed td { background: var(--matched-soft); }
.fix-panel { margin-top: 14px; padding: 14px 16px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); }
.fix-panel h3 { margin: 0; font-size: var(--fs-md, 1rem); }
.fix-panel .hint { margin: 4px 0 12px; }
.file-errors tr.fixing td { background: var(--pending-soft); }
.fix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.fix-grid label { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-xs); color: var(--muted); min-width: 0; }
.fix-grid label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fix-grid label em { font-style: normal; font-weight: 600; color: var(--ink); }
.fix-grid input { font: inherit; font-size: var(--fs-sm); color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--r-sm); padding: 6px 8px; min-width: 0; }
.fix-grid input:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.fix-grid label.key-field input { background: var(--surface); border-color: var(--muted); }
.fix-grid label.needs-fix span { color: var(--break); }
.fix-grid label.needs-fix input { border-color: var(--break); background: var(--break-soft); }
.fix-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.fix-msg { font-size: var(--fs-sm); }
.fix-changed { margin-top: 4px; }
.fix-changed .kv { margin-right: 12px; display: inline-block; }
.temp-pw code { font-size: 1.05rem; padding: 4px 8px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sm); user-select: all; }

/* Settings > System status */
.sys { margin: 8px 0 28px; }
.sub-h { margin: 8px 0 6px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.sys-tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px; min-width: 0; }
.sys-tile h3 { margin: 0 0 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.sys-big { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.sys-of { font-size: var(--fs-md); font-weight: 500; color: var(--muted); }
.sys-tile > .muted { font-size: var(--fs-sm); margin-top: 2px; }
.sys-tile p.muted { font-size: var(--fs-xs); margin: 10px 0 0; }
.sys-tbl { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: var(--fs-sm); }
.sys-tbl td { padding: 5px 0; border-top: 1px solid var(--rule-soft); vertical-align: top; }
.sys-tbl td + td { padding-left: 10px; }
.sys-tbl td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sys-tbl td.muted { font-size: var(--fs-xs); }
.sys-meter { height: 8px; border-radius: 4px; background: var(--none); margin-top: 10px; overflow: hidden; }
.sys-meter span { display: block; height: 100%; background: var(--matched); border-radius: 4px; }
.sys-meter.warn span { background: var(--pending); }
.sys-meter.bad span { background: var(--break); }


/* ===========================================================================
   Peppermint brand pass: white header with the leaf mark and a green rule, green primary
   actions and links, quiet white panels with a hairline border and the faintest shadow,
   tables on white with a light header band. Status colours keep their meaning.
   =========================================================================== */
.top {
  background: var(--surface); backdrop-filter: none;
  border-top: 3px solid var(--brand); border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.top-inner { height: 58px; }
.brand { gap: 10px; color: var(--ink); font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; display: block; flex: none; }
.brand-name { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-name small { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* navigation: the current page is marked by a green bar along the bottom of the header */
.nav { align-self: stretch; gap: 2px; }
.nav a {
  display: flex; align-items: center; height: 100%; padding: 0 12px; border-radius: 0;
  color: var(--muted); font-weight: 550; box-shadow: inset 0 0 0 transparent;
}
.nav a:hover { color: var(--ink); background: transparent; }
.nav a[aria-current="page"] { color: var(--ink); background: transparent; box-shadow: inset 0 -3px 0 var(--brand); }

/* buttons */
.btn { color: var(--ink); border-color: var(--rule); transition: background-color .12s, border-color .12s; }
.btn:hover { border-color: #BDBDBD; background: var(--paper-2); }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #FFFFFF; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* links inside the page read as links, in the brand green */
.page a:not(.btn):not(.chip) { color: var(--brand-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.page a:not(.btn):not(.chip):hover { color: var(--brand-hover); }

/* panels: one surface treatment everywhere */
.balance, .result, .sec, .acct .panel, .panel.invite, .panel.conn, .file-errors, .fix-panel, .sys-tile,
.auth-card, .drop { box-shadow: var(--shadow); }

/* tables sit on a white panel with a light header band */
.page > section .table-wrap, .page > div .table-wrap, .page > .table-wrap {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow);
}
.table-wrap table.data th { background: var(--paper-2); color: var(--muted); font-weight: 600; }
.table-wrap table.data th:first-child, .table-wrap table.data td:first-child { padding-left: 14px; }
.table-wrap table.data th:last-child, .table-wrap table.data td:last-child { padding-right: 14px; }
.table-wrap table.data tbody tr:last-child td { border-bottom: 0; }
.table-wrap table.data tbody tr:hover td { background: var(--paper-2); }
.file-errors .table-wrap, .sec .table-wrap, .result .table-wrap { border: 0; box-shadow: none; border-radius: 0; }

/* headings */
.page > h1 { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.panel-head h2 { font-size: var(--fs-lg); font-weight: 650; }

/* footer badge: centred, a little quieter */
.site-foot img { opacity: 0.9; }

/* cloud-drive list: the same white panel as the other lists */
.queue.imports { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 0 16px; }
.queue.imports > li:last-child { border-bottom: 0; }

/* phones: the menu sits on its own row; give it a proper tap height and keep the green bar */
@media (max-width: 640px) {
  .top-inner { padding-bottom: 0; }
  .nav { align-self: auto; margin: 2px -6px 0; }
  .nav a { height: 40px; padding: 0 8px; }
}

/* dark mode: white labels on the deeper green stay readable */
@media (prefers-color-scheme: dark) {
  :root { --brand-strong: #00826A; --brand-hover: #00735D; }
}

/* ===========================================================================
   Day view: Transactions over time (timeline.js)
   Chart colours: light #049F82 / #C0392B, dark #1FA98B / #E5655A (palette validator: pass).
   =========================================================================== */
:root { --chart-ok: #049F82; --chart-rej: #C0392B; }
@media (prefers-color-scheme: dark) { :root { --chart-ok: #1FA98B; --chart-rej: #E5655A; } }

.tl { margin-top: 28px; }
.tl-card { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 14px 16px 12px; }
.tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tl-field select, .tl-range input { font: inherit; font-size: var(--fs-sm); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 5px 8px; }
.tl-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; font-size: var(--fs-sm); color: var(--muted); }
.tl-range label { display: flex; align-items: center; gap: 6px; }
.tl-range input { width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: var(--fs-sm); font-weight: 550; color: var(--muted); background: none; border: 0;
  padding: 5px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover:not([disabled]) { color: var(--ink); background: var(--paper-2); }
.seg button[aria-pressed="true"] { color: #FFFFFF; background: var(--brand-strong); }
.seg button[disabled] { opacity: 0.4; cursor: default; }

/* figures above the chart */
.tl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule-soft); }
.tl-stat-l { font-size: var(--fs-xs); color: var(--muted); }
.tl-stat-v { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.tl-stat-v.rej { color: var(--break); }
.tl-stat-s { font-size: var(--fs-xs); color: var(--muted); }
@media (max-width: 720px) { .tl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tl-range { margin-left: 0; } }

/* chart */
.tl-chart { position: relative; min-height: 120px; transition: opacity .15s; }
.tl-chart.loading { opacity: 0.45; }
@media (prefers-reduced-motion: reduce) { .tl-chart { transition: none; } }
.tl-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; }
.tl-empty { padding: 40px 0; text-align: center; }
.tl-empty-over { position: absolute; inset: 40% 0 auto; text-align: center; margin: 0; }
.tl-ok { fill: var(--chart-ok); }
.tl-rej { fill: var(--chart-rej); }
.tl-area { fill-opacity: 0.22; }
.tl-ok-line, .tl-rej-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.tl-ok-line { stroke: var(--chart-ok); }
.tl-rej-line { stroke: var(--chart-rej); }
.tl-grid { stroke: var(--rule-soft); stroke-width: 1; }
.tl-base { stroke: var(--rule); stroke-width: 1; }
.tl-ylab, .tl-xlab { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tl-ptitle { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.tl-cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.tl-sel { fill: var(--brand); fill-opacity: 0.12; stroke: var(--brand); stroke-opacity: 0.5; pointer-events: none; }
.tl-hit { fill: transparent; cursor: crosshair; outline: none; }
.tl-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }

/* tooltip: values lead, labels follow; series keyed with a short stroke */
.tl-tip { position: absolute; z-index: 5; min-width: 200px; pointer-events: none; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-sm); box-shadow: 0 4px 14px rgba(34, 34, 34, 0.12);
  padding: 8px 10px; font-size: var(--fs-sm); }
.tl-tip-h { font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.tl-tip-r { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tl-tip-r b { font-weight: 650; color: var(--ink); }
.tl-tip-r span { color: var(--muted); }
.tl-tip-f { margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); }
.tl-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; transform: translateY(-3px); flex: none; }
.tl-key-ok { background: var(--chart-ok); }
.tl-key-rej { background: var(--chart-rej); }

.tl-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 6px; font-size: var(--fs-xs); }
.tl-table summary { cursor: pointer; color: var(--brand-text); font-size: var(--fs-xs); }
.tl-table[open] { flex-basis: 100%; }
.tl-table > div { max-height: 320px; overflow: auto; margin-top: 8px; border: 1px solid var(--rule); border-radius: var(--r-sm); }
.tl-tbl th { position: sticky; top: 0; background: var(--paper-2); }

/* --- Loading placeholders (a day's results, exceptions, chart) ---------------------- */
.spin { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--brand); animation: spin 0.8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); margin: 10px 0 0; }
.panel-head .loading-note { margin: 0; }
.pill.loading-pill { background: var(--rule-soft); color: var(--muted); font-weight: 500; }
.sk { display: block; height: 12px; border-radius: 4px; width: 60%;
  background: linear-gradient(90deg, var(--rule-soft) 25%, var(--paper-2) 50%, var(--rule-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.sk.tall { height: 22px; }
.sk.w30 { width: 30%; } .sk.w40 { width: 40%; } .sk.w50 { width: 50%; } .sk.w60 { width: 60%; }
.sk.w70 { width: 70%; } .sk.w80 { width: 80%; } .sk.w90 { width: 90%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-lines { display: grid; gap: 12px; margin-top: 16px; }
.skel-card { min-height: 170px; }
section.skel, .split2.skel { margin-top: 32px; }
.sections.skel { margin-top: 20px; }
.balance.skel .panel-head { margin-bottom: 0; }
.skel-table { table-layout: fixed; width: 100%; }
.skel-table td { padding-top: 13px; padding-bottom: 13px; }
.skel-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 12px 4px 0; border-bottom: 1px solid var(--rule); }
.skel-chart .skb { flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--rule-soft) 25%, var(--paper-2) 50%, var(--rule-soft) 75%);
  background-size: 100% 200%; animation: shimmer-v 1.4s ease-in-out infinite; }
@keyframes shimmer-v { from { background-position: 0 100%; } to { background-position: 0 -100%; } }
.skb.b0 { height: 12%; } .skb.b1 { height: 22%; } .skb.b2 { height: 34%; } .skb.b3 { height: 46%; } .skb.b4 { height: 58%; }
.skb.b5 { height: 70%; } .skb.b6 { height: 40%; } .skb.b7 { height: 28%; } .skb.b8 { height: 82%; }
.tl-chart .tl-loading { margin-top: 8px; }
.tl-chart.loading::after { content: ""; position: absolute; top: 12px; right: 12px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
.tape.is-loading .tape-cell .bar.sk { width: auto; height: 36px; border-radius: 3px; }
.tape-head .spin { width: 11px; height: 11px; margin-left: 6px; }
.tape-back { color: var(--brand-text); }
#excTable.is-loading { opacity: 0.5; transition: opacity .15s; pointer-events: none; }
#excTable.is-loading::before { content: ""; display: block; width: 16px; height: 16px; margin: 0 0 8px auto; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .spin, .sk, .skel-chart .skb, .tl-chart.loading::after, #excTable.is-loading::before { animation-duration: 0s; animation-iteration-count: 1; }
  .spin, .tl-chart.loading::after, #excTable.is-loading::before { border-top-color: var(--brand); border-right-color: var(--brand); }
}

/* --- Day navigation: ‹ [date] › ----------------------------------------------------- */
.day-nav { display: inline-flex; align-items: stretch; gap: 6px; }
.date-pick { display: inline-flex; }
.date-pick input { font: inherit; font-size: var(--fs-sm); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 0 10px; min-height: 36px; cursor: pointer; }
.date-pick input:hover { border-color: var(--ink-2); }
.date-pick input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (prefers-color-scheme: dark) { .date-pick input { color-scheme: dark; } }
@media (max-width: 640px) {
  .day-head .actions { flex-wrap: wrap; width: 100%; }
  .day-head .actions .btn { white-space: nowrap; }
  .day-nav { flex: 1 1 100%; }
  .date-pick { flex: 1; }
  .date-pick input { width: 100%; min-height: 40px; }
  .day-nav .btn { min-width: 44px; justify-content: center; }
}
/* shortened file names: the full name is in the tooltip */
.fn { white-space: nowrap; }
.fn.cut { cursor: help; text-decoration: underline dotted var(--rule); text-underline-offset: 3px; }
