:root {
  color-scheme: dark;
  --bg: #07110f;
  --surface: #0d1a17;
  --surface-2: #12231f;
  --line: #213b34;
  --text: #ecf7f2;
  --muted: #91aaa1;
  --mint: #74efbe;
  --amber: #ffc66d;
  --red: #ff7c78;
  --blue: #78b7ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% -10%, rgba(34, 114, 89, .32), transparent 33rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
.topbar, main, footer { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.topbar {
  display: flex; align-items: end; justify-content: space-between;
  padding: 38px 0 24px; border-bottom: 1px solid var(--line);
}
h1, h2, p { margin: 0; }
h1 { margin-top: 5px; font-size: clamp(26px, 3vw, 42px); letter-spacing: -.04em; }
h2 { font-size: 19px; letter-spacing: -.02em; }
.eyebrow, .kicker { color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.connection { color: var(--muted); font-size: 13px; }
.connection i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--amber); }
.connection.ok i { background: var(--mint); box-shadow: 0 0 14px rgba(116, 239, 190, .7); }
.connection.error i { background: var(--red); }
button {
  border: 1px solid #315c4f; border-radius: 9px; padding: 9px 13px;
  background: #143027; color: var(--text); font: inherit; cursor: pointer;
}
button:hover { border-color: var(--mint); }
input, select {
  width: 100%; min-width: 0; border: 1px solid #315c4f; border-radius: 9px;
  padding: 9px 10px; background: #0b211b; color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid rgba(116, 239, 190, .32); border-color: var(--mint); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
code { color: #b7d8cc; }
main { padding: 30px 0 54px; }
section + section { margin-top: 22px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading { margin-bottom: 15px; }
.kicker { margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.metric {
  min-height: 118px; padding: 17px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(145deg, rgba(21, 44, 37, .82), rgba(10, 25, 21, .9));
}
.metric strong { display: block; margin: 12px 0 7px; font-size: 30px; letter-spacing: -.05em; }
.metric span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.metric.alert strong { color: var(--red); }
.metric.warn strong { color: var(--amber); }
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 14px; }
.panel { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: rgba(13, 26, 23, .92); }
.panel-heading { margin-bottom: 15px; }
.filters-panel { margin-top: 22px; }
.filters { display: grid; grid-template-columns: 1.2fr .8fr 1fr .7fr auto; align-items: end; gap: 10px; }
.as-of-tools { display: grid; grid-template-columns: minmax(230px, .7fr) auto 1fr; align-items: end; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.audit-preview { margin-top: 12px; padding: 11px 13px; border-radius: 9px; background: #0a1815; line-height: 1.55; }
.badge, .status {
  display: inline-flex; align-items: center; width: fit-content; border-radius: 999px;
  padding: 4px 8px; font-size: 10px; font-weight: 800; letter-spacing: .04em;
}
.neutral { background: #1b332d; color: #bdd0c9; }
.pass, .healthy, .succeeded, .accepted, .reconciled, .imported, .passed, .available, .active, .current, .unchanged { background: rgba(61, 196, 142, .15); color: var(--mint); }
.review, .warn, .warning, .due, .running, .pending_review, .never_run, .exported, .access_unavailable, .access_restricted, .suspended, .metadata, .content, .structure { background: rgba(255, 198, 109, .14); color: var(--amber); }
.blocked, .fail, .critical, .failing, .failed, .rejected, .remote_removed, .governance_blocked, .expired, .not_effective { background: rgba(255, 124, 120, .14); color: var(--red); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 0 10px 10px; color: #6f8d83; font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 12px 10px; border-top: 1px solid rgba(45, 75, 66, .6); vertical-align: middle; }
td:first-child { padding-left: 0; }
th:first-child { padding-left: 0; }
.source-key { display: block; max-width: 280px; overflow: hidden; color: #d9e9e3; text-overflow: ellipsis; white-space: nowrap; }
.detail-button { padding: 5px 8px; font-size: 10px; }
.queue { display: grid; gap: 8px; max-height: 390px; overflow: auto; }
.queue-item { padding: 13px; border: 1px solid rgba(45, 75, 66, .72); border-radius: 11px; background: var(--surface-2); }
.queue-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.queue-title { overflow: hidden; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.queue-meta { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.warning { margin-top: 8px; color: #d6b98c; font-size: 11px; line-height: 1.45; }
.queue-note { margin-top: 12px; }
.empty { padding: 28px 12px; color: var(--muted); font-size: 12px; text-align: center; }
footer {
  display: flex; justify-content: space-between; gap: 20px; padding: 20px 0 30px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .as-of-tools { grid-template-columns: 1fr auto; }
  .as-of-tools p { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .topbar, main, footer { width: min(100% - 24px, 1440px); }
  .topbar { align-items: start; padding-top: 25px; }
  .connection { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .filters, .as-of-tools { grid-template-columns: 1fr; }
  .metric { min-height: 104px; }
  footer { flex-direction: column; }
}
.nav-links { display: flex; gap: 10px; margin-top: 10px; }
.nav-links a {
  color: var(--mint); font-size: 12px; text-decoration: none; font-weight: 700;
  border: 1px solid #315c4f; border-radius: 8px; padding: 6px 10px;
}
.nav-links a:hover { border-color: var(--mint); }
.legal-banner {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 0;
  padding: 15px 18px; border-radius: 12px; border: 1px solid rgba(255, 124, 120, .6);
  background: rgba(255, 124, 120, .13); color: #ffcac8; font-weight: 800;
  font-size: 13px; line-height: 1.5; letter-spacing: .01em;
}
.legal-banner .dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 14px rgba(255, 124, 120, .8);
}
.duty { background: rgba(255, 124, 120, .16); color: var(--red); }
.discretion { background: rgba(120, 183, 255, .16); color: var(--blue); }
.out_of_scope { background: rgba(145, 170, 161, .2); color: var(--muted); }
.subject_unknown { background: rgba(255, 198, 109, .16); color: var(--amber); }
.unclassified { background: #1b332d; color: #bdd0c9; }
.resolved { background: rgba(61, 196, 142, .15); color: var(--mint); }
.external_law { background: rgba(255, 198, 109, .14); color: var(--amber); }
.unresolved { background: rgba(255, 124, 120, .14); color: var(--red); }
.delegates { background: rgba(120, 183, 255, .16); color: var(--blue); }
.cites { background: #1b332d; color: #bdd0c9; }
.penalizes { background: rgba(255, 124, 120, .16); color: var(--red); }
.amends { background: rgba(255, 198, 109, .16); color: var(--amber); }
.tree-article { font-weight: 800; color: #d9e9e3; }
.tree-clause { padding-left: 18px; color: #c4dad2; }
.tree-item { padding-left: 36px; color: var(--muted); }
.tree-text { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; }
.graph-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.graph-filters button[aria-pressed="true"] { border-color: var(--mint); color: var(--mint); }
.fragment-label {
  margin-top: 10px; color: var(--muted); font-size: 10px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}
.fragment-text {
  margin-top: 6px; padding: 12px 13px; border-radius: 10px; background: #0a1815;
  line-height: 1.65; font-size: 12.5px; white-space: pre-wrap; color: #e4f3ec;
}
.cli-hint {
  margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: #0b211b;
  color: var(--muted); font-size: 11.5px; line-height: 1.6;
}
.cli-hint code {
  display: block; margin-top: 6px; padding: 8px; border-radius: 7px;
  background: #071411; color: #b7d8cc; word-break: break-all; white-space: pre-wrap;
}
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { border-color: #315c4f; }
.queue-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  padding: 5px 10px; font-size: 11.5px; border-radius: 999px;
  border: 1px solid #315c4f; background: #0f241d; color: #c4dad2;
}
.chip:hover { border-color: var(--mint); color: var(--mint); }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.checkbox-label input { width: auto; }
.progress-track { height: 10px; border-radius: 999px; background: #12231f; border: 1px solid var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3dc48e, var(--mint)); width: 0%; transition: width .3s ease; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.queue-item { transition: opacity .22s ease, transform .22s ease, max-height .22s ease; }
.queue-item.active { border-color: var(--mint); box-shadow: 0 0 0 1px rgba(116, 239, 190, .38) inset; }
.queue-item.removing { opacity: 0; transform: translateX(10px) scale(.98); pointer-events: none; }
.fragment-text.collapsed { max-height: 4.4em; overflow: hidden; position: relative; }
.fragment-text.collapsed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2em;
  background: linear-gradient(rgba(10, 24, 21, 0), #0a1815);
}
.expand-toggle { margin-top: 7px; padding: 3px 9px; font-size: 10.5px; }
.kbd {
  display: inline-block; min-width: 16px; padding: 1px 6px; margin-left: 6px; border-radius: 5px;
  border: 1px solid #315c4f; background: #0b211b; font-size: 10.5px; font-weight: 700;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; color: #c4dad2; text-align: center;
}
button .kbd { margin-left: 8px; }
.shortcut-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px;
  padding: 9px 12px; border-radius: 9px; background: #0b211b; color: var(--muted); font-size: 11.5px;
}
.shortcut-hint b { color: var(--text); font-weight: 700; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; max-width: 340px; }
.toast {
  padding: 10px 14px; border-radius: 10px; background: #12231f; border: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.5; box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
  animation: toast-in .16s ease;
}
.toast.ok { border-color: rgba(116, 239, 190, .5); color: var(--mint); }
.toast.error { border-color: rgba(255, 124, 120, .5); color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }