/* Apple 스타일 디자인 토큰 — SaMT 대시보드 계열과 같은 팔레트.
   정본: AI-Hub/Wiki/design/apple-report-style.md */
:root {
  --accent: #0071e3;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --surface: #f5f5f7;
  --bg: #ffffff;
  --line: #d2d2d7;
  --ok: #1d8a4e;
  --warn: #b25000;
  --crit: #c9282d;
  --ok-bg: #e7f6ec;
  --warn-bg: #fdf1e3;
  --crit-bg: #fdecec;
  --radius: 12px;
  --font: "Apple SD Gothic Neo", "Malgun Gothic", "Pretendard", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b;
    --surface: #1c1c1e; --bg: #000000; --line: #38383a;
    --ok-bg: #102a1a; --warn-bg: #2a1d10; --crit-bg: #2a1213;
    --ok: #4cd07d; --warn: #ff9f45; --crit: #ff6b6b;
  }
}
:root[data-theme="light"] {
  --ink: #1d1d1f; --ink-2: #6e6e73; --surface: #f5f5f7; --bg: #fff; --line: #d2d2d7;
  --ok-bg: #e7f6ec; --warn-bg: #fdf1e3; --crit-bg: #fdecec;
  --ok: #1d8a4e; --warn: #b25000; --crit: #c9282d;
}
:root[data-theme="dark"] {
  --ink: #f5f5f7; --ink-2: #a1a1a6; --surface: #1c1c1e; --bg: #000; --line: #38383a;
  --ok-bg: #102a1a; --warn-bg: #2a1d10; --crit-bg: #2a1213;
  --ok: #4cd07d; --warn: #ff9f45; --crit: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ── 헤더 ───────────────────────────────────────────────────────────── */
header.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.who { color: var(--ink-2); font-size: 13px; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  appearance: none; border: 0; background: none; font: inherit; cursor: pointer;
  padding: 11px 14px; color: var(--ink-2); border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 18px 20px 60px; max-width: 1600px; margin: 0 auto; }

/* ── 공통 컴포넌트 ─────────────────────────────────────────────────── */
.btn {
  appearance: none; font: inherit; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 7px 14px; border-radius: 980px;
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 980px;
  font-size: 12px; font-weight: 600;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .l { font-size: 12px; color: var(--ink-2); }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.notice.crit { background: var(--crit-bg); border-color: var(--crit); color: var(--crit); }

/* ── 필터 ───────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters label { font-size: 12px; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
textarea { width: 100%; min-height: 130px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ── 표 ─────────────────────────────────────────────────────────────── */
.tablewrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  font-weight: 600; text-align: center; border-bottom: 1px solid var(--line);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center { text-align: center; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface) 60%, transparent); }
tr.subtotal td { background: var(--surface); font-weight: 600; }
tr.eol td { background: var(--crit-bg); color: var(--crit); }
.empty { padding: 40px; text-align: center; color: var(--ink-2); }

/* ── 로그인 ─────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 360px; }
.login h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 6px; }
.login p { color: var(--ink-2); margin: 0 0 20px; font-size: 13px; }
.login input { width: 100%; margin-bottom: 12px; padding: 10px 12px; }
.login .btn { width: 100%; padding: 10px; }
.err { color: var(--crit); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ── 폼 ─────────────────────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select { width: 100%; }
.req::after { content: " *"; color: var(--crit); }
