/* Society Books — plain CSS, no build step */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e3e6ec;
  --brand: #1f5f8b;
  --brand-ink: #ffffff;
  --brand-soft: #e8f1f8;
  --ok: #1e7b4a;
  --ok-soft: #e7f5ed;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --side: #17283a;
  --side-ink: #c9d4df;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d; --panel: #18202a; --ink: #e6ebf1; --muted: #93a0b0; --line: #2a3542;
    --brand: #5fa8dc; --brand-ink: #0c1620; --brand-soft: #1b2c3b;
    --ok: #5cc98d; --ok-soft: #15291e; --warn: #f0b252; --warn-soft: #2d2412;
    --bad: #f2766b; --bad-soft: #321a18; --side: #0c1117; --side-ink: #aab6c3;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; font-weight: 700; font-size: 15px; padding: 0 18px 4px; display: block; }
.side .soc { padding: 0 18px 14px; font-size: 12px; opacity: .8; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.side .soc a { color: inherit; text-decoration: underline; }
.side nav a { display: block; padding: 7px 18px; color: var(--side-ink); border-left: 3px solid transparent; }
.side nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.side nav a.on { color: #fff; border-left-color: #5fa8dc; background: rgba(255,255,255,.06); }
.side nav .sec { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; }
.side .badge { background: #e8a33a; color: #1a1a1a; border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.main { padding: 20px 28px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .main { padding: 14px 16px 40px; }
}

/* panels / layout */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.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)); }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }

/* tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--panel); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; }
tr.sub td { font-weight: 600; background: var(--brand-soft); }
tr.dim td { opacity: .55; }
tbody tr:hover td { background: rgba(127,127,127,.04); }

/* forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input.amt { text-align: right; font-variant-numeric: tabular-nums; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline .field { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.check input { width: auto; }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 7px 14px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.linkbtn { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }

/* flash / tags */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.flash.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.flash.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.flash ul { margin: 4px 0 0 18px; padding: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.dr { color: var(--bad); }
.cr { color: var(--ok); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .panel { width: 100%; max-width: 380px; padding: 24px; }
.auth h1 { margin-bottom: 4px; }

/* voucher grid */
.vlines td { padding: 4px 6px; }
.vlines select { min-width: 220px; }
.vlines .x { color: var(--bad); }
.totals { font-variant-numeric: tabular-nums; font-weight: 700; }

/* print */
@media print {
  .side, .topbar .actions, .noprint, form.filter { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .panel { border: none; padding: 0; }
  body { background: #fff; color: #000; }
}

.side .msearch { padding: 0 12px 6px; }
.side .msearch input { width: 100%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: #fff; border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.side .msearch input::placeholder { color: rgba(255,255,255,.5); }
.side .msearch input:focus { outline: none; border-color: #5fa8dc; background: rgba(255,255,255,.12); }
.side .mfound { border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 6px; padding-bottom: 6px; }
.side .mfound a { display: block; padding: 6px 18px; color: var(--side-ink); font-size: 13px; }
.side .mfound a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.side .mfound .t { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; margin-right: 4px; }
.side .mfound small { display: block; opacity: .6; font-size: 11px; }
