:root {
  --ground: #EDEFF2;
  --surface: #FFFFFF;
  --surface-alt: #F5F7F9;
  --ink: #14181D;
  --ink-soft: #37414D;
  --muted: #626C79;
  --rule: #D2D8DF;
  --rule-soft: #E3E7EC;
  --accent: #0F5C63;
  --accent-ink: #0B4247;
  --accent-soft: #E0EDED;

  --crit: #A81F16; --crit-bg: #F7E4E2;
  --high: #A9501A; --high-bg: #F8EAE0;
  --med:  #7D6410; --med-bg:  #F5F0DC;
  --low:  #27548F; --low-bg:  #E3ECF7;
  --info: #4B5563; --info-bg: #E9ECEF;

  --st-new: #7D6410;      --st-new-bg: #F5F0DC;
  --st-progress: #27548F; --st-progress-bg: #E3ECF7;
  --st-fixed: #0F5C63;    --st-fixed-bg: #E0EDED;
  --st-verified: #1F7A3D; --st-verified-bg: #E1F0E4;
  --st-risk: #6B4FA0;     --st-risk-bg: #EAE3F5;
  --st-fp: #626C79;       --st-fp-bg: #E9ECEF;

  --font: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── topbar ─────────────────────────── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 78rem; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; height: 3.25rem;
}
.brand { font-weight: 700; color: var(--ink); font-size: 1rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 1.1rem; flex: 1; }
.nav a { color: var(--ink-soft); font-size: 0.92rem; font-weight: 500; }
.nav a:hover { color: var(--accent-ink); text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.userbox .uname { color: var(--ink-soft); }
.userbox .logout { color: var(--muted); }

/* ── layout ─────────────────────────── */
.container { max-width: 78rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.sitefooter {
  max-width: 78rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; color: var(--muted);
  font-family: var(--mono); font-size: 0.72rem; display: flex; justify-content: space-between;
}

h1 { font-size: 1.5rem; letter-spacing: -0.01em; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.subtitle { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.92rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* ── card / panel ───────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  padding: 1.25rem 1.4rem; margin-bottom: 1.25rem;
}
.panel-title {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.6rem;
}

/* ── stat tiles ─────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin-bottom: 1.5rem; }
.stat { background: var(--surface); padding: 1rem 1.15rem; }
.stat .label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 0.2rem; }
.stat .value.warn { color: var(--high); }
.stat .value.crit { color: var(--crit); }

/* ── table ──────────────────────────── */
.scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; min-width: 34rem; }
th, td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
thead th {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; background: var(--surface-alt); white-space: nowrap;
  text-align: center;
}
thead th:first-child { text-align: left; }
tbody td:not(:first-child) { text-align: center; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-row td { color: var(--muted); text-align: center; padding: 2rem; }

/* ── chips ──────────────────────────── */
.chip {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.18em 0.6em; border-radius: 100px; white-space: nowrap;
}
.sev-critical, .sev-crit { color: var(--crit); background: var(--crit-bg); }
.sev-high { color: var(--high); background: var(--high-bg); }
.sev-medium, .sev-med { color: var(--med); background: var(--med-bg); }
.sev-low { color: var(--low); background: var(--low-bg); }
.sev-info { color: var(--info); background: var(--info-bg); }

.st-new { color: var(--st-new); background: var(--st-new-bg); }
.st-assigned, .st-in-progress { color: var(--st-progress); background: var(--st-progress-bg); }
.st-fixed { color: var(--st-fixed); background: var(--st-fixed-bg); }
.st-verified { color: var(--st-verified); background: var(--st-verified-bg); }
.st-risk-accepted { color: var(--st-risk); background: var(--st-risk-bg); }
.st-false-positive { color: var(--st-fp); background: var(--st-fp-bg); }

.role-admin { color: var(--accent-ink); background: var(--accent-soft); }
.role-auditor { color: var(--low); background: var(--low-bg); }
.role-owner { color: var(--med); background: var(--med-bg); }
.role-viewer { color: var(--muted); background: var(--info-bg); }

.muted { color: var(--muted); }

/* ── forms ──────────────────────────── */
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin: 0 0 0.3rem; }
.field { margin-bottom: 1rem; max-width: 32rem; }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=file], input[type=search], select, textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--rule); border-radius: 5px;
  background: var(--surface); color: var(--ink); font-size: 0.92rem; font-family: inherit;
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 12rem; }
.hint { color: var(--muted); font-size: 0.78rem; margin-top: 0.25rem; }

.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin-bottom: 0; min-width: 9rem; max-width: 14rem; }

/* ── buttons ────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.05rem;
  border-radius: 5px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-size: 0.88rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-danger { color: var(--crit); border-color: var(--crit); background: var(--crit-bg); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── flash ──────────────────────────── */
.flash { padding: 0.75rem 1rem; border-radius: 5px; margin-bottom: 1rem; font-size: 0.88rem; border: 1px solid transparent; }
.flash-info { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.flash-error { background: var(--crit-bg); color: var(--crit); border-color: var(--crit); }
.flash-success { background: var(--st-verified-bg); color: var(--st-verified); border-color: var(--st-verified); }

/* ── login ──────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-box { width: 100%; max-width: 24rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 2rem; }
.login-box h1 { font-size: 1.2rem; text-align: center; margin-bottom: 1.5rem; }

/* ── misc ───────────────────────────── */
.pre-box {
  background: var(--surface-alt); border: 1px solid var(--rule); border-radius: 5px;
  padding: 0.85rem 1rem; font-family: var(--mono); font-size: 0.82rem; white-space: pre-wrap;
  word-break: break-all; color: var(--ink-soft);
}
.comment { border-top: 1px solid var(--rule-soft); padding: 0.75rem 0; }
.comment .meta { font-size: 0.76rem; color: var(--muted); margin-bottom: 0.25rem; }
.timeline-item { display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.85rem; padding: 0.35rem 0; }
.timeline-item .t { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}
