/* Books — plain CSS, no build step. Edit freely. */
:root {
  --bg: #f8fafc; --card: #fff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0; --line-soft: #f1f5f9;
  --brand: #2259bd; --brand-dark: #1d4a9a; --brand-soft: #eef6ff;
  --good: #047857; --good-soft: #ecfdf5; --bad: #b91c1c; --bad-soft: #fef2f2; --warn: #b45309; --warn-soft: #fffbeb;
  --side: #0f172a; --side-2: #1e293b; --side-text: #cbd5e1;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 600; }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }
p { margin: 0 0 8px; }
code { background: var(--line-soft); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--side); padding: 12px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 600; font-size: 18px; padding: 4px; }
.switcher { width: 100%; background: var(--side-2); color: #fff; border: 1px solid #475569; border-radius: 6px; padding: 6px; font-size: 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; justify-content: space-between; align-items: center; color: var(--side-text); padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.nav:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav.active { background: #334155; color: #fff; }
.nav-head { margin-top: 12px; padding: 0 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #334155; padding-top: 10px; font-size: 12px; color: #94a3b8; }
.link-light { background: none; border: 0; color: var(--side-text); padding: 0; margin-top: 4px; cursor: pointer; font: inherit; }
.link-light:hover { color: #fff; }
main { flex: 1; min-width: 0; padding: 24px; }
.wrap { max-width: 1100px; }
.wrap-sm { max-width: 760px; }
.wrap-lg { max-width: 1300px; }
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-header .muted { margin: 2px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row.center { align-items: center; }
.grow { flex: 1; min-width: 160px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; } .spanall { grid-column: 1 / -1; }
.inline { display: inline; }
.right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card.pad, .pad { padding: 16px; }
.card.tint { background: var(--brand-soft); border-color: #d9eaff; }
.card.warn { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.card.danger { border-color: #fecaca; }
.scroll-x { overflow-x: auto; }
.btn, .btn-primary, .btn-secondary, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; padding: 6px 12px; font: 500 14px/1.3 inherit; font-family: inherit; cursor: pointer; border: 1px solid transparent; white-space: nowrap; text-decoration: none !important; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad-soft); }
button:disabled, .btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.red { color: var(--bad); } .btn-link.grey { color: var(--muted); }
.input { display: block; width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 9px; font: inherit; font-size: 14px; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid #bfd5fb; border-color: var(--brand); }
.input.num { text-align: right; }
.input.w-sm { width: 140px; } .input.w-md { width: 220px; }
.input.suggested { border-color: #fcd34d; background: var(--warn-soft); }
label.lbl, .lbl { display: block; font-size: 12px; font-weight: 500; color: #475569; margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn-text { color: var(--warn); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 500; background: var(--line-soft); color: #475569; }
.badge.warn { background: #f59e0b; color: #fff; }
.badge.good { background: #d1fae5; color: #065f46; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.blue { background: #e0f2fe; color: #075985; }
.badge.red { background: #fee2e2; color: #991b1b; }
.flash { border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--good-soft); color: #065f46; border: 1px solid #a7f3d0; }
.flash.error { background: var(--bad-soft); color: var(--bad); border: 1px solid #fecaca; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: #334155; font-size: 14px; }
.tab.on { background: var(--text); color: #fff; border-color: var(--text); }
.tab:hover { text-decoration: none; }
.pill { padding: 3px 10px; font-size: 12px; }
.stat .lbl { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--muted); }
.stat .big { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
details > summary { cursor: pointer; }

/* tables */
table { border-collapse: collapse; }
.table { width: 100%; font-size: 14px; }
.table th { text-align: left; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr.review td { background: #fffdf5; }
.table tr.cleared td { background: #f0fdf4; }
.table tr.clickable { cursor: pointer; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: #94a3b8; padding: 28px !important; }
.report td { padding: 4px 0; font-size: 14px; }
.report .sec td { padding-top: 16px; font-weight: 600; }
.report .total td { font-weight: 600; }
.report .total td.num { border-top: 1px solid #94a3b8; }
.report .grand td { font-weight: 700; font-size: 15px; padding-top: 12px; }
.report .grand td.num { border-bottom: 3px double #64748b; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 18px; }
.auth-card .field { margin-bottom: 12px; }

/* reconcile */
.sticky { position: sticky; top: 8px; z-index: 5; }
.diff-zero { color: var(--good); } .diff-off { color: var(--bad); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-head { display: none; }
  main { padding: 16px; }
  .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .no-print, .sidebar { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
.hide-cleared tr.cleared { display: none; }
button.badge { border: 0; cursor: pointer; font-family: inherit; }
