/* Plumbline. Jubilee's palette and typeface, laid out desktop-first for working the books:
   a fixed sidebar, wide tables, and numbers that line up. */
:root {
  --brand: #2c349c; --on-bg: #e9ebfb; --on-ink: #2c349c;
  --bg: #f4f4f6; --card: #ffffff; --ink: #1a1b1f; --ink2: #63656e; --line: #e6e6eb;
  --soft: #ededf1; --gold: #be8a2e; --good-t: #17603a; --good-bg: #dff3e6;
  --warn-t: #b32b21; --warn-f: #b32b21; --warn-bg: #fce9e6; --btn: #2c349c; --btn-t: #ffffff;
  --shadow: 0 1px 2px rgba(20, 22, 40, .04), 0 6px 20px rgba(20, 22, 40, .05);
}
/* Dark mode is a dark gray page with lighter gray tiles and off-white text, never near-black with pure white. */
html.dark {
  --brand: #a9afff; --on-bg: #23265a; --on-ink: #c3c7ff;
  --bg: #14151a; --card: #1d1e25; --ink: #e9eaee; --ink2: #adb0bb; --line: #2e3039;
  --soft: #2a2c35; --gold: #d9a441; --good-t: #9be0b6; --good-bg: #173a27;
  --warn-t: #ff8e82; --warn-f: #ff8e82; --warn-bg: #2e1513; --btn: #535cd6; --btn-t: #ffffff;
  --shadow: 0 0 0 1px #2e3039;
}
@media (prefers-color-scheme: dark) {
  html.auto {
    --brand: #a9afff; --on-bg: #23265a; --on-ink: #c3c7ff;
    --bg: #14151a; --card: #1d1e25; --ink: #e9eaee; --ink2: #adb0bb; --line: #2e3039;
    --soft: #2a2c35; --gold: #d9a441; --good-t: #9be0b6; --good-bg: #173a27;
    --warn-t: #ff8e82; --warn-f: #ff8e82; --warn-bg: #2e1513; --btn: #535cd6; --btn-t: #ffffff;
    --shadow: 0 0 0 1px #2e3039;
    color-scheme: dark;
  }
}
/* Manrope (SIL Open Font License, static/fonts/LICENSE-Manrope-OFL.txt). */
@font-face { font-family: Manrope; src: url("../fonts/Manrope-Variable.c9ecede79fde.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: light; }
html.dark { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 14px/1.5 Manrope, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums; font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
h1 { margin: 2px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
h1 .tag { font-size: 13px; vertical-align: 6px; }
h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--ink2); }
.small { font-size: 13px; line-height: 1.4; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code.secret { word-break: break-all; font-size: 14px; }

/* ---- Shell: fixed sidebar, wide workspace --------------------------------- */
.side {
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px; padding: 28px 16px 20px;
  display: flex; flex-direction: column; gap: 10px; background: var(--card); border-right: 1px solid var(--line); z-index: 10;
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 12px; text-decoration: none; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.nav-brand .mark { height: 30px; width: 22px; flex: none; }
.entity { padding: 0 12px 0 44px; margin-top: -8px; font-size: 12px; color: var(--ink2); font-weight: 600; }
.nav-items { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.nav-items a, .nav-foot button {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink2); font: inherit; font-size: 14px; font-weight: 500;
}
.nav-items a:hover, .nav-foot button:hover { background: var(--soft); color: var(--ink); }
.nav-items a.on { background: var(--on-bg); color: var(--on-ink); font-weight: 700; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-foot form { margin: 0; }
.nav-foot button { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; }
.page { margin-left: 240px; padding: 36px 48px 64px; display: flex; flex-direction: column; gap: 18px; }
.page > * { width: 100%; max-width: 1180px; margin-left: auto; margin-right: auto; }
.page.form-page > * { max-width: 760px; }

/* Narrow windows: the sidebar becomes a strip across the top. */
@media (max-width: 900px) {
  .side { position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px; }
  .entity { display: none; }
  .nav-items { flex-direction: row; margin: 0 0 0 8px; flex-wrap: wrap; }
  .nav-items a span, .nav-foot button span { display: none; }
  .nav-foot { margin: 0 0 0 auto; flex-direction: row; }
  .page { margin-left: 0; padding: 20px 16px 48px; }
  h1 { font-size: 26px; }
  .chart .detail, .preview td:nth-child(3), .preview th:nth-child(3), .preview td:nth-child(5), .preview th:nth-child(5) { display: none; }
  .chart th.name { width: auto; }
  .chart th.num { width: 120px; }
}

/* ---- Headings, cards, buttons ---------------------------------------------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--ink2); }
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 22px 24px; }
.card.empty { display: flex; flex-direction: column; gap: 6px; }
.card.empty p { margin: 0 0 8px; }
.btn {
  height: 48px; border: 0; border-radius: 14px; background: var(--btn); color: var(--btn-t);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap;
}
.btn.small-btn { height: 38px; width: auto; padding: 0 16px; border-radius: 11px; font-size: 14px; }
.btn.quiet { background: transparent; color: var(--ink); font-weight: 500; }
.btn.outline { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.outline:hover, .btn.quiet:hover { background: var(--soft); }
.btn.warn { background: transparent; color: var(--warn-t); border: 1px solid var(--warn-bg); }
.btn.warn:hover { background: var(--warn-bg); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 9px; background: var(--soft); color: var(--ink2); vertical-align: 1px; white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn-t); }
.tag.in { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
.tag.src-claude { background: var(--on-bg); color: var(--on-ink); }
.tag.src-import { background: transparent; border: 1px solid var(--line); }
.note { border-radius: 12px; padding: 11px 16px; font-size: 14px; background: var(--soft); color: var(--ink); }
.note.success { background: var(--good-bg); color: var(--good-t); }
.note.error { background: var(--warn-bg); color: var(--warn-t); }
.flash { display: flex; flex-direction: column; gap: 8px; }
.over { color: var(--warn-t); }
.error, .errorlist { color: var(--warn-t); font-size: 13px; list-style: none; padding: 0; margin: 6px 0 0; }

/* ---- Tables ------------------------------------------------------------ */
.table-card { padding: 6px 0 8px; overflow-x: auto; }
.table-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 24px 8px; }
.table-head .amt { font-weight: 700; font-size: 16px; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th, .ledger td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger th:first-child, .ledger td:first-child { padding-left: 24px; }
.ledger th:last-child, .ledger td:last-child { padding-right: 24px; }
.ledger thead th { font-size: 11px; font-weight: 600; color: var(--ink2); letter-spacing: .05em; text-transform: uppercase; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger td.num { font-weight: 600; }
.ledger td.num.rollup { color: var(--ink2); }
.ledger a { text-decoration: none; }
.ledger td a:hover { text-decoration: underline; }
.ledger tbody:last-of-type tr:last-child td { border-bottom: 0; }
.ledger tfoot th { border-bottom: 0; border-top: 2px solid var(--line); font-size: 14px; }
.ledger .sub { font-size: 12px; margin-top: 2px; }
.ledger tr.inactive td, .ledger tbody.inactive td { color: var(--ink2); }
.ledger tr.inactive td.name a, .ledger tbody.inactive td.num { text-decoration: line-through; text-decoration-color: var(--ink2); }
.ledger .acct-num { color: var(--ink2); font-weight: 600; margin-right: 2px; }
.ledger td.name a, .ledger td.name > span { display: inline-block; padding-left: calc(var(--depth, 0) * 22px); }
.ledger td.credit-side { padding-left: 48px; }
.ledger tr.kind-row th { font-size: 12px; font-weight: 700; color: var(--ink); background: var(--soft); text-transform: none; letter-spacing: 0; border-bottom: 0; }
.ledger tr.kind-row th.num { font-weight: 700; }
table.chart { table-layout: fixed; }
.chart th.name { width: 46%; }
.chart th.num { width: 160px; }
.chart td.detail { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart .tools { width: 76px; padding-top: 6px; padding-bottom: 6px; }
.chart .tools form { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s; }
.chart tr:hover .tools form, .chart .tools form:focus-within { opacity: 1; }
.mini { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mini:hover { color: var(--ink); background: var(--soft); }
.journal tbody.entry tr:last-child td { border-bottom: 1px solid var(--line); }
.journal tbody.entry td { border-bottom-color: transparent; }
.events td.when { white-space: nowrap; color: var(--ink2); width: 170px; }
.events .changes { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); margin-top: 3px; }
.events .changes s { opacity: .7; }
.preview tr.st-error td { background: var(--warn-bg); }
.preview tr.st-exists td { color: var(--ink2); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }
@media (hover: none) { .chart .tools form { opacity: 1; } }

/* ---- Forms ------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field-row label, .upload label { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 6px; }
.field-row input[type=text], .field-row input[type=number], .field-row select, .upload input[type=file] {
  width: 100%; height: 44px; border-radius: 11px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-size: 15px; padding: 0 12px;
}
.upload input[type=file] { padding: 9px 12px; height: auto; }
.field-row input:focus, .field-row select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field-row.bad input, .field-row.bad select { border-color: var(--warn-f); }
.hint { display: block; font-size: 12px; color: var(--ink2); margin-top: 5px; font-weight: 500; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.form-actions form { margin: 0; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 4px; }
.void-box summary { cursor: pointer; font-weight: 700; color: var(--warn-t); }
.void-box[open] summary { margin-bottom: 8px; }
.steps ol { margin: 0 0 18px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.upload { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.upload .form-actions { margin-top: 10px; }

/* ---- Summary blocks ----------------------------------------------------- */
.stat-row { display: flex; gap: 36px; flex-wrap: wrap; }
.stat .k, .facts .k { font-size: 12px; font-weight: 600; color: var(--ink2); }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.stat .v.small-v { font-size: 15px; padding-top: 7px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; }
.facts > div { display: flex; flex-direction: column; }

/* ---- Sign-in pages (Jubilee's layout) ------------------------------------ */
.page.narrow { margin: 0 auto; max-width: 440px; padding: 12vh 20px 40px; }
.page.narrow > * { max-width: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.brand .mark { height: 30px; width: 22px; flex: none; }
.brand.large { font-size: 30px; gap: 12px; margin-bottom: 8px; }
.brand.large .mark { height: 44px; width: 33px; }
form.stack { display: flex; flex-direction: column; gap: 14px; }
form.stack label { font-size: 13px; font-weight: 600; color: var(--ink2); display: block; margin-bottom: 6px; }
form.stack input[type=text], form.stack input[type=email], form.stack input[type=password] {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-size: 16px; padding: 0 14px;
}
.qr { background: #FFFFFF; border-radius: 16px; padding: 12px; width: 220px; margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }
.codes div { background: var(--soft); border-radius: 12px; padding: 12px; text-align: center; }
.pull-indicator { display: none; }
