
/* Altekore Flow — shared look of the app (index.html) and the sample (sample.html).
   Same shell as Altekore Tips: a navy rail with the brand, the company and the cycle (Inbox → Bank → Reconcile → Close),
   cool paper for the work. The one strong thing on each screen is what needs a person now. */
:root {
  --paper: #f2f4f8; --surface: #ffffff; --surface-2: #f6f8fb; --sunk: #eceff5;
  --line: #e0e4ed; --line-2: #eaedf3;
  --ink: #121a2e; --ink-2: #48526d; --ink-3: #6f7891;
  --brand: #2b44c7; --brand-2: #2238a8; --brand-soft: #e8ebfa; --on-brand: #ffffff;
  --green: #17846b; --green-soft: #dff3ec; --amber: #a35c0a; --amber-soft: #fbefdc; --brick: #b42318; --brick-soft: #fbe9e7;
  --rail: #121a2e; --rail-2: #1b2540; --rail-ink: #e6eaf5; --rail-ink-2: #98a2bf; --rail-line: #26304d;
  --logo-ring: #7f93ff; --logo-dot: #24a889;
  --doc: #fffdf8; --doc-ink: #2a2a2a; --doc-line: #d9d4c7;
  --f-display: "Newsreader", Georgia, serif;
  --f-ui: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --r-s: 6px; --r: 10px; --r-l: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0b1120; --surface: #121a2c; --surface-2: #172036; --sunk: #0e1527; --line: #232d47; --line-2: #1d2740;
  --ink: #e8ecf6; --ink-2: #aeb7cc; --ink-3: #8a93ab;
  --brand: #8b9cf6; --brand-2: #a3b1f8; --brand-soft: #1c2546; --on-brand: #0b1120;
  --green: #4cc7a5; --green-soft: #10302a; --amber: #f0b24f; --amber-soft: #33260f; --brick: #f2857a; --brick-soft: #3a1915;
  --rail: #080d19; --rail-2: #111a2e; --rail-line: #1b2440;
  --doc: #1a1f2b; --doc-ink: #e4e2dc; --doc-line: #343a48; color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0b1120; --surface: #121a2c; --surface-2: #172036; --sunk: #0e1527; --line: #232d47; --line-2: #1d2740;
  --ink: #e8ecf6; --ink-2: #aeb7cc; --ink-3: #8a93ab;
  --brand: #8b9cf6; --brand-2: #a3b1f8; --brand-soft: #1c2546; --on-brand: #0b1120;
  --green: #4cc7a5; --green-soft: #10302a; --amber: #f0b24f; --amber-soft: #33260f; --brick: #f2857a; --brick-soft: #3a1915;
  --rail: #080d19; --rail-2: #111a2e; --rail-line: #1b2440;
  --doc: #1a1f2b; --doc-ink: #e4e2dc; --doc-line: #343a48; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.55 var(--f-ui); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.logo { height: 24px; width: auto; display: block; color: #fff; }

/* shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; }
.rail .product { color: var(--rail-ink-2); font-weight: 600; padding-left: 10px; border-left: 1px solid var(--rail-line); display: inline-flex; align-items: center; gap: 7px; }
.pmark { width: 20px; height: 20px; border-radius: 5px; flex: none; display: block; }
.picker { background: var(--rail-2); border: 1px solid var(--rail-line); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; }
.picker label { display: grid; gap: 3px; font-size: 12px; color: var(--rail-ink-2); }
.picker select { background: transparent; border: 0; padding: 2px 0; color: var(--rail-ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.picker select option { color: #121a2e; }
.picker .books { font-size: 12.5px; color: var(--rail-ink-2); display: flex; align-items: center; gap: 7px; }
.picker .syncnow { margin-left: auto; background: transparent; border: 1px solid var(--rail-line); border-radius: 999px; color: var(--rail-ink); font: inherit; font-size: 11.5px; padding: 2px 9px; cursor: pointer; white-space: nowrap; }
.picker .syncnow:hover:not(:disabled) { background: var(--rail-line); }
.picker .syncnow:disabled { opacity: .7; cursor: default; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--logo-dot); flex: none; }
nav.side { display: grid; gap: 2px; }
nav.side a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-s); color: var(--rail-ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px; }
nav.side a:hover { background: var(--rail-2); color: var(--rail-ink); }
nav.side a[aria-current="page"] { background: var(--rail-2); color: #fff; box-shadow: inset 3px 0 0 var(--logo-ring); }
nav.side a .n { margin-left: auto; font-size: 12px; background: var(--rail-line); color: var(--rail-ink); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
nav.side a .step { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--rail-line); display: grid; place-items: center; font-size: 11px; flex: none; }
nav.side .group { margin: 14px 10px 4px; font-size: 12px; color: var(--rail-ink-2); opacity: .8; }
.rail .who { margin-top: auto; border-top: 1px solid var(--rail-line); padding-top: 14px; font-size: 13px; }
.rail .who b { display: block; font-size: 14px; }
.rail .who span { color: var(--rail-ink-2); }

main { padding: 0 clamp(16px, 3vw, 36px) 48px; min-width: 0; }
.sample-bar { margin: 0 calc(-1 * clamp(16px, 3vw, 36px)); padding: 8px clamp(16px, 3vw, 36px); background: var(--amber-soft); color: var(--amber); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.sample-bar b { font-weight: 600; }
.sample-bar button { margin-left: auto; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 2px 12px; font-size: 12.5px; color: inherit; }
header.page { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; padding: 26px 0 18px; }
header.page h1 { font: 600 30px/1.15 var(--f-display); margin: 0; letter-spacing: -.01em; }
header.page p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }
header.page .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-s); padding: 7px 14px; font-weight: 500; font-size: 14px; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 4px 10px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.chip { font-family: var(--f-ui); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--brick-soft); color: var(--brick); }
.chip.info { background: var(--brand-soft); color: var(--brand); }
.chip.mute { background: var(--sunk); color: var(--ink-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .n { color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat .k { font-size: 12.5px; color: var(--ink-2); }
.stat .v { font: 600 24px/1.2 var(--f-display); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { font-size: 12.5px; color: var(--ink-3); }

/* inbox */
.inbox { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.queue { overflow: hidden; }
.queue .q-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.queue .q-head .btn { margin-left: auto; }
.q-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); width: 100%; text-align: left; background: none; border-left: 3px solid transparent; border-top: 0; border-right: 0; }
.q-item:hover { background: var(--surface-2); }
.q-item[aria-current="true"] { background: var(--brand-soft); border-left-color: var(--brand); }
.q-item .src { grid-row: span 2; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--sunk); color: var(--ink-2); }
.q-item .src svg { width: 16px; height: 16px; }
.q-item .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .a { font-weight: 600; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.q-item .m { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .st { text-align: right; }
.q-empty { padding: 28px 16px; color: var(--ink-3); text-align: center; font-size: 14px; }

.detail { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.source { padding: 14px; }
.source h3 svg { width: 16px; height: 16px; flex: none; }
.source h3, .draft h3 { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.paper-doc { background: var(--doc); color: var(--doc-ink); border: 1px solid var(--doc-line); border-radius: 6px; padding: 16px 18px; font: 12.5px/1.5 "Courier New", ui-monospace, monospace; box-shadow: 0 1px 0 var(--doc-line); }
.paper-doc .hd { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.paper-doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.paper-doc td { padding: 2px 0; border-bottom: 1px dotted var(--doc-line); }
.paper-doc td:last-child { text-align: right; }
.paper-doc mark { background: color-mix(in srgb, var(--logo-dot) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.chat { display: grid; gap: 8px; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.bubble.in { background: var(--sunk); justify-self: start; border-top-left-radius: 4px; }
.bubble.out { background: var(--green-soft); color: var(--ink); justify-self: end; border-top-right-radius: 4px; }
.bubble small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.via { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }

.draft { padding: 16px; }
.draft .top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; margin-bottom: 12px; }
.draft .top .ty { font: 600 20px/1.2 var(--f-display); }
.draft .top .amt { margin-left: auto; font: 600 20px/1.2 var(--f-display); font-variant-numeric: tabular-nums; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.fields div { font-size: 13px; }
.fields .k { color: var(--ink-3); font-size: 12px; display: block; }
.fields .v { font-weight: 500; }
.match { color: var(--green); font-size: 12px; font-weight: 600; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 14px; }
table.lines th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.lines td.r, table.lines th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.lines tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line); }
.checks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; margin-top: 1px; }
.checks .pass .ic { background: var(--green-soft); color: var(--green); }
.checks .warn .ic { background: var(--amber-soft); color: var(--amber); }
.checks .block .ic { background: var(--brick-soft); color: var(--brick); }
.ask { border: 1px solid var(--amber); background: var(--amber-soft); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.ask .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ask .opts button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.ask .opts button:hover { border-color: var(--amber); }
.draft .bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.draft .bar .note { color: var(--ink-3); font-size: 12.5px; flex-basis: 100%; }
.draft .bar .btn.primary { margin-left: auto; }
.posted { border: 1px solid var(--green); background: var(--green-soft); color: var(--green); border-radius: var(--r); padding: 10px 14px; font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.posted span { font-weight: 400; color: var(--ink-2); }
.learned { font-size: 12.5px; color: var(--ink-2); background: var(--sunk); border-radius: var(--r-s); padding: 8px 10px; margin-bottom: 14px; }

/* tables (bank, recon) */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .narr { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--ink-2); }
table.grid .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
table.grid tr.done td { opacity: .55; }
table.grid tr.done td:last-child { opacity: 1; }
.cr { color: var(--green); }

/* recon + close */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.panel { padding: 18px; }
.panel h2 { font: 600 19px/1.25 var(--f-display); margin: 0 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel > p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; }
.kv .r { text-align: right; font-variant-numeric: tabular-nums; }
.kv .tot { font-weight: 600; border-top: 1px solid var(--line); padding-top: 6px; }
.later { opacity: .72; }
.meter { height: 8px; background: var(--sunk); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }
.close-list { list-style: none; margin: 0; padding: 0; }
.close-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.close-list li:last-child { border-bottom: 0; }
.close-list input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.close-list .t { font-weight: 600; font-size: 14.5px; }
.close-list .d { font-size: 13px; color: var(--ink-2); }
.close-list .o { font-size: 12.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.close-list li.ok .t { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.outlier { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.outlier:last-child { border-bottom: 0; }

/* setup */
.settings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.settings li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.settings li:last-child { border-bottom: 0; padding-bottom: 0; }
.settings .how { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r); font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 10; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1180px) { .detail { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 10px; padding: 12px 16px; align-items: center; }
  .rail .who, nav.side .group, .rail .side.setup { display: none; }
  .picker { flex: 1 1 220px; padding: 6px 10px; gap: 2px; }
  .picker .books { display: none; }
  .picker .books:has(.syncnow:not([hidden])) { display: flex; }
  .picker .books:has(.syncnow:not([hidden])) > :not(.syncnow) { display: none; }
  nav.side { grid-auto-flow: column; overflow-x: auto; width: 100%; }
  nav.side a { white-space: nowrap; }
  .inbox { grid-template-columns: 1fr; }
}
