/* layout: ledger workbook — summary meters, sheet tabs, editable ledger tables, sticky save bar */
:root {
  --bg:#f6f7f9; --panel:#ffffff; --fg:#1d2733; --muted:#5d6b7a; --line:#d9dee5;
  --accent:#1f5f8b; --hd:#e8eef4; --sub:#f0f3f7; --neg:#c0392b; --edit:#fffbe6; --ok:#2e7d4f;
  --sans:"IBM Plex Sans KR",system-ui,-apple-system,"Malgun Gothic",sans-serif;
  --mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg:#12171d; --panel:#1a2129; --fg:#e3e8ee; --muted:#93a1b0; --line:#2c3642;
  --accent:#6fb0dc; --hd:#222c37; --sub:#1f2832; --neg:#ff7b6b; --edit:#2a2a1c; --ok:#6fcf97; color-scheme:dark } }
:root[data-theme="dark"] {
  --bg:#12171d; --panel:#1a2129; --fg:#e3e8ee; --muted:#93a1b0; --line:#2c3642;
  --accent:#6fb0dc; --hd:#222c37; --sub:#1f2832; --neg:#ff7b6b; --edit:#2a2a1c; --ok:#6fcf97; color-scheme:dark }
body { background:var(--bg); color:var(--fg); font-family:var(--sans); font-size:14px; }
.wrap { max-width:1280px; margin:0 auto; padding-block:20px 96px; padding-inline:16px; display:grid; gap:16px; }
header h1 { font-size:20px; margin:0; text-wrap:balance; }
header p { margin:4px 0 0; color:var(--muted); font-size:13px; }
.totals { display:flex; flex-wrap:wrap; gap:8px 28px; font-family:var(--mono); font-variant-numeric:tabular-nums; }
.totals span { display:block; font-family:var(--sans); font-size:11px; color:var(--muted); letter-spacing:.04em; }
.totals strong { font-size:18px; font-weight:500; }
.cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:6px; padding:10px 12px; display:grid; gap:6px; min-width:0; }
.cn { font-weight:500; font-size:13px; }
.cv { font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:15px; }
.cv small { color:var(--muted); font-size:12px; }
.meter { height:6px; background:var(--line); border-radius:3px; overflow:hidden; }
.meter i { display:block; height:100%; background:var(--accent); }
.meter.over i { background:var(--neg); }
.cr { display:flex; justify-content:space-between; gap:8px; font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
[role=tablist] { display:flex; flex-wrap:wrap; gap:4px; border-bottom:1px solid var(--line); }
[role=tab] { font:inherit; font-size:13px; padding:7px 12px; border:1px solid transparent; border-bottom:none; background:none; color:var(--muted); cursor:pointer; border-radius:6px 6px 0 0; }
[role=tab][aria-selected=true] { background:var(--panel); color:var(--fg); border-color:var(--line); font-weight:500; margin-bottom:-1px; }
button:focus-visible, input:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.panel { background:var(--panel); border:1px solid var(--line); border-top:none; padding:14px; display:grid; gap:14px; min-width:0; }
.hint { margin:0; color:var(--muted); font-size:12.5px; }
.tbl { overflow-x:auto; }
table { border-collapse:collapse; font-size:12.5px; width:100%; }
th, td { border:1px solid var(--line); padding:4px 6px; vertical-align:middle; text-align:left; }
th { background:var(--hd); font-weight:500; text-align:center; white-space:nowrap; }
td.num { text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; white-space:nowrap; }
.neg { color:var(--neg); }
tr.sub td { background:var(--sub); font-weight:500; }
tr.tot td { background:var(--hd); font-weight:700; }
input.cell { width:100%; min-width:0; box-sizing:border-box; font:inherit; color:inherit; background:var(--edit); border:1px solid transparent; border-radius:3px; padding:4px 6px; }
input.cell:hover { border-color:var(--line); }
input.cell.num { text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; }
input.cell:read-only { background:transparent; }
.bar { display:inline-block; width:64px; height:6px; background:var(--line); border-radius:3px; overflow:hidden; vertical-align:middle; margin-right:6px; }
.bar i { display:block; height:100%; background:var(--accent); }
.bar.over i { background:var(--neg); }
.sec { display:grid; gap:6px; }
.sec h3 { margin:0; font-size:14px; display:flex; flex-wrap:wrap; gap:6px 14px; align-items:baseline; }
.sec h3 small { font-weight:400; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.btn { font:inherit; font-size:12.5px; border:1px solid var(--line); background:var(--panel); color:var(--fg); border-radius:5px; padding:5px 10px; cursor:pointer; }
.btn:hover { border-color:var(--accent); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--panel); }
.btn:disabled { opacity:.5; cursor:default; }
.del { border:none; background:none; color:var(--muted); cursor:pointer; font-size:15px; padding:2px 6px; }
.del:hover { color:var(--neg); }
.savebar { position:fixed; left:0; right:0; bottom:0; padding:10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background:var(--panel); border-top:1px solid var(--line); display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; justify-content:flex-end; z-index:5; }
.savebar .msg { margin-right:auto; font-size:12.5px; color:var(--muted); }
.savebar .msg.dirty { color:var(--fg); font-weight:500; }
.savebar .msg.ok { color:var(--ok); }
.savebar .msg.err { color:var(--neg); }

/* site additions */
*, *::before, *::after { box-sizing:border-box; }
body { margin:0; line-height:1.45; }
a { color:var(--accent); }
.top { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; font-size:12.5px; color:var(--muted); }
.top .who { margin-left:auto; display:flex; flex-wrap:wrap; gap:4px 14px; align-items:center; }
.top a { text-decoration:none; }
.top a:hover { text-decoration:underline; }
.plist { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }
.pcard { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:14px 16px; display:grid; gap:8px; color:inherit; text-decoration:none; min-width:0; }
.pcard:hover { border-color:var(--accent); }
.pcard h2 { margin:0; font-size:15px; text-wrap:balance; }
.pcard p { margin:0; font-size:12px; color:var(--muted); }
.notice { background:var(--edit); border:1px solid var(--line); border-radius:6px; padding:10px 12px; font-size:13px; display:grid; gap:8px; }
.notice ul { margin:0; padding-left:18px; }
dialog { background:var(--panel); color:var(--fg); border:1px solid var(--line); border-radius:8px; padding:16px; width:min(640px, calc(100vw - 32px)); max-height:80vh; }
dialog::backdrop { background:rgb(0 0 0 / .35); }
dialog h2 { margin:0 0 10px; font-size:16px; }
.hist td { font-size:12.5px; }
#users table, .hist { background:var(--panel); }
.field { display:grid; gap:4px; font-size:12.5px; color:var(--muted); min-width:0; }
.field input.cell { border-color:var(--line); background:var(--panel); padding:7px 9px; font-size:14px; }
.formrow { display:flex; flex-wrap:wrap; gap:10px 16px; }
.formrow .field { flex:1 1 200px; }
.pcard h2 { font-size:15px; }
#print { display:none; }

/* PDF(인쇄) 전용 예산표 */
@page { size:A4 landscape; margin:12mm; }
@media print {
  :root { --bg:#fff; --panel:#fff; --fg:#000; --muted:#444; --line:#999; --hd:#e6e6e6; --sub:#f2f2f2; --neg:#b00; color-scheme:light; }
  body { background:#fff; color:#000; font-size:10pt; }
  body > .wrap, .savebar, dialog { display:none !important; }
  #print { display:block; }
  #print h1 { font-size:15pt; margin:0 0 2mm; }
  #print h2 { font-size:12pt; margin:6mm 0 2mm; }
  #print h2.brk { break-before:page; margin-top:0; }
  #print h3 { font-size:10pt; margin:4mm 0 1.5mm; break-after:avoid; }
  #print h3 small { font-weight:400; color:#444; }
  #print .pmeta { margin:0 0 3mm; font-size:8.5pt; color:#444; }
  #print table { width:100%; border-collapse:collapse; font-size:8.5pt; margin-bottom:3mm; }
  #print th, #print td { border:0.5pt solid #888; padding:1.2mm 1.6mm; }
  #print th { background:#e6e6e6; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  #print tr { break-inside:avoid; }
  #print thead { display:table-header-group; }
  #print .sub td { background:#f2f2f2; font-weight:600; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  #print .tot td { background:#e0e0e0; font-weight:700; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  #print .num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
  #print .neg { color:#b00; }
  #print .ptot { width:auto; }
  #print .ptot td { text-align:right; font-size:10pt; min-width:30mm; }
}
