/* Bedrock 콘솔 — 한 개의 12칸 격자에 모든 카드를 맞춘다(축 통일). 밝은·어두운 화면 모두 토큰으로만 칠한다. */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --surface: #fcfcfb; --surface-2: #f0f2f5; --line: #e1e4e9; --line-2: #d3d8df;
  --text: #13161b; --text-2: #4f5866; --muted: #6b7482;
  --accent: #2a6fdb; --series-1: #2a6fdb; --series-2: #c2410c;
  --ok: #1f7a4d; --ok-bg: #e5f4ec; --warn: #9a5b00; --warn-bg: #fdf1dc; --bad: #b4232c; --bad-bg: #fbe6e7;
  --grid: #e7eaee; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1115; --surface: #15171c; --surface-2: #1b1e25; --line: #262a33; --line-2: #313744;
    --text: #e9ecf1; --text-2: #b6bdc8; --muted: #8b94a3;
    --accent: #3987e5; --series-1: #3987e5; --series-2: #e06a2e;
    --ok: #4ccf8e; --ok-bg: #12291f; --warn: #f0b552; --warn-bg: #2b2212; --bad: #f2777e; --bad-bg: #2d1618;
    --grid: #22262e; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115; --surface: #15171c; --surface-2: #1b1e25; --line: #262a33; --line-2: #313744;
  --text: #e9ecf1; --text-2: #b6bdc8; --muted: #8b94a3;
  --accent: #3987e5; --series-1: #3987e5; --series-2: #e06a2e;
  --ok: #4ccf8e; --ok-bg: #12291f; --warn: #f0b552; --warn-bg: #2b2212; --bad: #f2777e; --bad-bg: #2d1618;
  --grid: #22262e; --shadow: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; padding-block: 0 48px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }

/* 상단 */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand b { font-size: 15.5px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12.5px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.btn { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: 9px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 격자 — 모든 줄이 같은 12칸, 같은 간격 */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.span-12 { grid-column: span 12; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; }
.kpis { grid-column: span 12; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .span-6, .span-4, .span-8 { grid-column: span 12; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head span { color: var(--muted); font-size: 12.5px; }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { display: block; color: var(--muted); font-size: 12.5px; }
.kpi b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }

/* 상태 칩 — 색만이 아니라 아이콘·문구로도 상태를 알린다 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); }
.chip::before { content: "•"; font-weight: 900; }
.chip.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.chip.ok::before { content: "✓"; }
.chip.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.chip.warn::before { content: "!"; }
.chip.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.chip.bad::before { content: "✕"; }

/* 표 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl-wrap { overflow-x: auto; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.share { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.share i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); margin: 1px 2px 1px 0; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* 차트 */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .s1 { background: var(--series-1); } .legend .s2 { background: var(--series-2); }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; transform: translate(-50%, -110%); display: none; z-index: 3; }
.tip b { font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; margin: 0; }
.note { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin-top: 16px; font-size: 13.5px; }
.skel { height: 120px; border-radius: 14px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sh 1.4s infinite; margin-top: 16px; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 18px; }
.login p { margin: 0; color: var(--muted); font-size: 13px; }
.login input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; }
.login button { padding: 10px 12px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.login .msg { color: var(--bad); font-size: 13px; min-height: 1em; }
