:root {
  --bg: #f6f7f9; --card: #fff; --ink: #16181d; --muted: #5d6470; --line: #e3e6eb;
  --accent: #0f766e; --accent-ink: #fff; --pos: #047857; --neg: #b91c1c; --ok-bg: #ecfdf5; --bad-bg: #fef2f2;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #171a21; --ink: #e8eaee; --muted: #9aa2ae; --line: #2a2f39;
    --accent: #2dd4bf; --accent-ink: #062b27; --pos: #34d399; --neg: #f87171; --ok-bg: #0c2a22; --bad-bg: #2d1416; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; font-size: 17px; }
.top-actions { display: flex; gap: 8px; }
main { max-width: 1080px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
main > section:nth-child(n+3) { grid-column: 1 / -1; }
@media (max-width: 820px) { main { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
h2 { margin: 0 0 12px; font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.full { margin-bottom: 12px; }
label small { font-size: 12px; }
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
button.secondary, .top button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.top select { width: auto; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.row .grow { flex: 1 1 240px; }
.row input[type=file] { width: auto; flex: 1 1 200px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.breakdown td:last-child { text-align: right; }
.breakdown tr.strong td { font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.scroll { overflow-x: auto; }
.data th, .data td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data th:first-child, .data td:first-child { text-align: left; }
.data th { font-size: 12px; color: var(--muted); font-weight: 600; }
.data tr.ok td { background: var(--ok-bg); } .data tr.bad td { background: var(--bad-bg); }
.foot { max-width: 1080px; margin: 0 auto; padding: 8px 16px 32px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--accent); font-weight: 600; }
