:root {
  color-scheme: dark;
  --fp-bg-deep: #020c1d;
  --fp-bg: #031327;
  --fp-bg-alt: #061a33;
  --fp-surface: #081d36;
  --fp-card: #0b2442;
  --fp-surface-hover: #113252;
  --fp-border: #174669;
  --fp-border-hover: #2575ab;
  --fp-divider: #193652;
  --fp-text: #f2f7ff;
  --fp-muted: #a8bcd5;
  --fp-muted-2: #829ebe;
  --fp-cyan: #20d9f7;
  --fp-blue: #2e9bff;
  --fp-teal: #26e5b4;
  --fp-warning: #f5c564;
  --fp-danger: #ff536f;
  --fp-navy-input: #102945;
  --fp-ink: #031327;
  --fp-header-line: #173452;
  --fp-link: #e4effc;
  --radius-button: 10px;
  --radius-card: 16px;
  --radius-panel: 18px;
  --shadow-panel: 0 12px 35px rgba(0, 0, 0, 0.25);
  --shadow-cyan: 0 0 0 1px rgba(32, 217, 247, 0.2), 0 0 25px rgba(32, 217, 247, 0.12);
  --shadow-primary: 0 8px 24px rgba(32, 217, 247, 0.16);
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--fp-bg);
  color: var(--fp-text);
}

* { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(32, 217, 247, 0.08), transparent 55%),
    var(--fp-bg);
  color: var(--fp-text);
}

a { color: var(--fp-cyan); text-decoration: none; }
a:hover { color: #7eebfb; }

:focus-visible {
  outline: 2px solid var(--fp-cyan);
  outline-offset: 3px;
}

::selection {
  background: rgba(32, 217, 247, 0.35);
  color: #fff;
}

.skip {
  position: absolute;
  left: 8px;
  top: 8px;
  transform: translateY(-140%);
  background: var(--fp-surface);
  color: var(--fp-text);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 50;
}
.skip:focus { transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 72px;
  padding: 0 28px;
  background: rgba(2, 12, 29, 0.94);
  box-shadow: inset 0 -1px 0 var(--fp-header-line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  color: var(--fp-text);
  text-decoration: none;
}
.brand svg { width: 38px; height: 38px; flex: 0 0 auto; }
.wordmark {
  display: block;
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.wordmark span { color: var(--fp-cyan); }
.brand small {
  display: block;
  margin-left: 1px;
  color: #93acc7;
  font-size: 10px;
  line-height: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.nav a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--fp-link);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}
.nav a:hover,
.nav a.is-active {
  background: #0b2944;
  color: #fff;
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.who {
  color: var(--fp-muted);
  font-size: 13px;
  font-weight: 600;
}

main {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--fp-cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
}
h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.lead, .muted { color: var(--fp-muted); font-size: 14px; line-height: 1.55; font-weight: 500; }
.error {
  margin: 12px 0 0;
  color: #ff8fa3;
  font-size: 14px;
  font-weight: 600;
}

a.stat { color: inherit; text-decoration: none; }
a.stat:hover { color: inherit; }
.card, .stat {
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-panel);
  padding: 24px;
}
.card { margin: 0 0 16px; }
.card:hover { border-color: var(--fp-border); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  padding: 20px 18px 18px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.stat:hover {
  border-color: var(--fp-border-hover);
  background: var(--fp-surface-hover);
  transform: translateY(-2px);
}
.stat span {
  display: block;
  color: var(--fp-muted);
  font-size: 13px;
  font-weight: 600;
}
.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat.tone-success strong { color: var(--fp-teal); }
.stat.tone-warning strong { color: var(--fp-warning); }
.stat.tone-danger strong { color: var(--fp-danger); }
.stat.tone-cyan strong { color: var(--fp-cyan); }

main.login-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(720px 360px at 50% 0%, rgba(32, 217, 247, 0.16), transparent 62%),
    radial-gradient(520px 320px at 100% 100%, rgba(46, 155, 255, 0.12), transparent 55%),
    var(--fp-bg);
}
.login-card {
  width: min(440px, 100%);
  padding: 32px 28px 28px;
  border-radius: var(--radius-panel);
  border: 1px solid var(--fp-border);
  background: rgba(8, 29, 54, 0.82);
  box-shadow: var(--shadow-cyan), var(--shadow-panel);
  backdrop-filter: blur(16px);
}
.login-card h1 { font-size: 28px; }
.password-line { display: flex; gap: 8px; align-items: flex-end; }
.password-line input { flex: 1; min-width: 0; }
.password-line .btn { margin-top: 8px; height: 44px; white-space: nowrap; }

label {
  display: block;
  margin: 16px 0 0;
  color: var(--fp-muted);
  font-size: 13px;
  font-weight: 600;
}
input, select {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 8px;
  padding: 0 14px;
  border-radius: var(--radius-button);
  border: 1px solid var(--fp-border);
  background: var(--fp-navy-input);
  color: var(--fp-text);
  font: inherit;
  font-size: 15px;
}
input::placeholder { color: var(--fp-muted-2); }
input:hover, select:hover { border-color: var(--fp-border-hover); }
input:focus, select:focus {
  outline: 2px solid var(--fp-cyan);
  outline-offset: 2px;
  border-color: var(--fp-cyan);
}

.btn, button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-button);
  border: 0;
  background: linear-gradient(90deg, #24e4f3, #078dee);
  color: var(--fp-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: transform 0.2s, filter 0.2s;
}
.btn:hover, button:hover, .button:hover {
  color: var(--fp-ink);
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.btn:active, button:active, .button:active {
  transform: translateY(0);
  filter: brightness(0.95);
}
.btn-lg { height: 52px; width: 100%; margin-top: 22px; }
.btn-secondary, a.btn-secondary {
  border: 1px solid #2478b0;
  background: #071a31;
  color: var(--fp-text);
  box-shadow: none;
}
.btn-secondary:hover, a.btn-secondary:hover {
  color: var(--fp-text);
  border-color: var(--fp-border-hover);
  filter: none;
}
.btn-ghost, button.ghost {
  height: 40px;
  border: 1px solid #1d658e;
  background: #06192c;
  color: #f4f9ff;
  box-shadow: none;
  font-weight: 600;
}
.btn-ghost:hover, button.ghost:hover {
  color: #fff;
  border-color: #22b9ed;
  filter: none;
}
.btn-danger, button.danger {
  background: #bc314b;
  color: #fff;
  box-shadow: none;
}
.btn-danger:hover, button.danger:hover { color: #fff; }

.inline, .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.row-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
}
.row-form > label {
  margin: 0;
  width: auto;
  flex: 0 0 auto;
}
.row-form select,
.row-form input {
  width: 220px;
  max-width: 100%;
  margin-top: 8px;
}
.row-form > select,
.row-form > input {
  margin-top: 0;
}
.row-form button {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}
.card > .actions { margin-top: 10px; }
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  color: var(--fp-muted);
  font-size: 14px;
  font-weight: 600;
}
.pager a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--fp-border);
  border-radius: 8px;
  background: var(--fp-surface);
  color: var(--fp-text);
  font-weight: 700;
}
.inline input, .inline select, .actions input, .actions select {
  width: auto;
  min-width: 180px;
  margin-top: 0;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-panel);
}
.search-bar input {
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  margin: 0;
}
.search-bar button {
  flex: 0 0 auto;
  margin: 0;
}
.stack { display: grid; gap: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 18px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--fp-border);
  border-radius: var(--radius-card);
  background: var(--fp-surface);
  box-shadow: var(--shadow-panel);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--fp-divider);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
th {
  color: var(--fp-muted-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #071a31;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(17, 50, 82, 0.72); }
td a { font-weight: 700; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--fp-border);
  background: var(--fp-navy-input);
  color: var(--fp-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--fp-muted);
}
.badge-success { border-color: rgba(38, 229, 180, 0.4); background: rgba(38, 229, 180, 0.1); color: var(--fp-teal); }
.badge-success::before { background: var(--fp-teal); }
.badge-warning { border-color: rgba(245, 197, 100, 0.4); background: rgba(245, 197, 100, 0.1); color: var(--fp-warning); }
.badge-warning::before { background: var(--fp-warning); }
.badge-danger { border-color: rgba(255, 83, 111, 0.4); background: rgba(255, 83, 111, 0.1); color: var(--fp-danger); }
.badge-danger::before { background: var(--fp-danger); }
.badge-cyan { border-color: rgba(32, 217, 247, 0.4); background: rgba(32, 217, 247, 0.1); color: var(--fp-cyan); }
.badge-cyan::before { background: var(--fp-cyan); }

@media (max-width: 960px) {
  .topbar { height: auto; min-height: 68px; flex-wrap: wrap; padding: 12px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  main { width: min(1100px, calc(100% - 32px)); }
  main.login-shell { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; flex-direction: column; }
  .stat:hover { transform: none; }
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(32, 217, 247, 0.16);
  color: var(--fp-cyan);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.page-head .lead { margin: 8px 0 0; max-width: 640px; }
.caption {
  margin: 12px 0 0;
  color: var(--fp-muted-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 6px;
  overflow-x: auto;
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-panel);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--fp-link);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.tabs a:hover,
.tabs a.is-active {
  background: #0b2944;
  color: #fff;
}
.tabs .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(32, 217, 247, 0.12);
  color: var(--fp-cyan);
  font-size: 11px;
  font-weight: 700;
}
.notice {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--radius-card);
  border: 1px solid rgba(38, 229, 180, 0.4);
  background: rgba(38, 229, 180, 0.1);
  color: var(--fp-teal);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}
.notice-warning {
  border-color: rgba(245, 197, 100, 0.4);
  background: rgba(245, 197, 100, 0.1);
  color: var(--fp-warning);
}
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--fp-muted);
  font-size: 14px;
  font-weight: 500;
}
.panels {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 14px; font-weight: 700; }
.table-wrap.flat {
  margin-top: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  margin: 0;
}
.kv dt {
  color: var(--fp-muted);
  font-size: 13px;
  font-weight: 600;
}
.kv dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
td.actions-cell { white-space: normal; min-width: 420px; }
td.manage-cell { white-space: nowrap; }
.inline-delete {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0 8px;
  vertical-align: middle;
}
.inline-delete button { margin: 0; }
.approve-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.approve-form label {
  margin: 0;
  min-width: 132px;
  font-size: 12px;
}
.approve-form select,
.approve-form input {
  width: 100%;
  min-width: 0;
  height: 36px;
  margin-top: 6px;
}
.btn-sm, button.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

@media (max-width: 960px) {
  .panels { grid-template-columns: 1fr; }
  td.actions-cell { min-width: 0; }
  .row-form { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .btn:hover, button:hover, .button:hover, .stat:hover { transform: none; }
}
