:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #76746f;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --accent: #256abf;
  --critical: #b42a2a;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --other: #a9a79f;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #96948d;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.06);
    --accent: #6da7ec;
    --critical: #e66767;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --other: #6b6a65;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
}
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 0 0 4px; }
p { margin: 0 0 8px; }
code { font: 12px ui-monospace, Consolas, monospace; background: var(--wash); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.error { color: var(--critical); min-height: 1.5em; margin: 4px 0; }

button, select, input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 34px;
}
button { cursor: pointer; }
button:hover { background: var(--wash); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary { color: #0d0d0d; } }
button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 로그인·승인 화면 */
.gate { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.gate-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; }
.gate-box h1 { margin-bottom: 8px; }
.gate-box ul { padding-left: 18px; margin: 0 0 12px; }
.gate-box label { display: block; margin-top: 12px; font-weight: 600; }
.gate-box input[type="password"] { width: 100%; margin-top: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 대시보드 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
header.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
header.top .sub { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { display: grid; gap: 2px; font-size: 12px; color: var(--ink-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card > .sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.tile .label { color: var(--ink-2); font-size: 12px; }
.tile .value { font-size: 26px; font-weight: 600; line-height: 1.25; }
.tile .hint { color: var(--muted); font-size: 12px; }
.notice { border-left: 3px solid var(--axis); padding: 4px 12px; color: var(--ink-2); margin-bottom: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover, .chart .hit.on { fill: var(--wash); }
.tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 180px;
  background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px;
  font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.tip[hidden] { display: none; }
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 12px; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--ink-2); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
th.text, td.text { text-align: left; }
td.text { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
tbody tr:hover { background: var(--wash); }
td .bar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--s1); vertical-align: middle; margin-right: 8px; }

.rec { border-top: 1px solid var(--grid); padding: 14px 0; }
.rec:first-of-type { border-top: 0; padding-top: 0; }
.rec .saving { display: inline-block; font-size: 12px; color: var(--ink-2); border: 1px solid var(--axis); border-radius: 999px; padding: 0 8px; margin-left: 8px; font-weight: 400; }
.rec details { margin-top: 8px; }
.rec summary { cursor: pointer; color: var(--accent); }
.rec .note { color: var(--muted); font-size: 12px; margin-top: 8px; }
