:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
  color: #17242b;
  background: #f2f5f6;
  --ink: #17242b;
  --muted: #65757d;
  --line: #d9e1e4;
  --soft: #edf2f3;
  --surface: #fff;
  --brand: #0d7f89;
  --brand-dark: #075d65;
  --green: #198754;
  --red: #c44236;
  --amber: #9a6700;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #f2f5f6; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }
.login-view { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 34px clamp(20px, 5vw, 72px) 24px; background: linear-gradient(135deg, #f7f9f9 0 60%, #e5eff0 60%); }
.login-brand, .brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 22px; font-weight: 900; }
.login-brand strong, .brand strong { display: block; font-size: 16px; }
.login-brand span, .brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.login-form { align-self: center; justify-self: center; width: min(100%, 410px); padding: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 18px 60px rgba(30, 60, 68, .12); }
.login-form h1 { margin: 4px 0 8px; font-size: 28px; }
.subtext { margin: 0 0 24px; color: var(--muted); }
.login-form label, .dialog-form label { display: grid; gap: 7px; margin-bottom: 15px; color: #34454d; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #bcc9ce; border-radius: 6px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 127, 137, .12); }
.login-view footer { color: var(--muted); font-size: 12px; text-align: center; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; font-weight: 750; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); }
.button.ghost { border-color: var(--line); background: #fff; color: #31434b; }
.button.danger { border-color: #edc9c5; background: #fff7f6; color: var(--red); }
.button.wide { width: 100%; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--brand-dark); font-weight: 700; }
.login-form .text-button { display: block; margin: 12px auto 0; color: var(--muted); font-size: 12px; }
.form-status { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 12px; line-height: 1.5; }
.form-status.success { color: var(--green); }
.admin-view { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; border-right: 1px solid #183f45; background: #12383e; color: #eaf3f4; }
.sidebar .brand { padding: 0 8px 24px; }
.sidebar .brand-mark { background: #eaf7f8; color: var(--brand-dark); }
.sidebar .brand span { color: #9eb7bb; }
nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #b8cbce; text-align: left; font-weight: 700; }
.nav-item:hover, .nav-item.active { background: #20525a; color: #fff; }
.sidebar-account { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid #31565c; }
.sidebar-account strong { display: block; margin: 8px 0 12px; overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; }
.sidebar-account .button { width: 100%; border-color: #3b6268; background: transparent; color: #cfe0e2; }
.role-badge { display: inline-block; padding: 4px 7px; border-radius: 4px; background: #d7f1ed; color: #0a635b; font-size: 11px; font-weight: 800; }
.main-content { min-width: 0; padding: 24px clamp(18px, 3vw, 42px) 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.topbar h1 { margin: 3px 0 0; font-size: 25px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 11px; font-weight: 900; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.last-updated { color: var(--muted); font-size: 12px; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #40535b; }
.global-status { margin: -10px 0 18px; padding: 10px 12px; border: 1px solid #b9d8dc; border-radius: 6px; background: #eaf6f7; color: #155d64; font-size: 13px; }
.global-status.error { border-color: #e9c4bf; background: #fff4f2; color: var(--red); }
.view { display: none; }
.view.active { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-item { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.summary-item .summary-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.summary-item .summary-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: #e9f4f5; color: var(--brand); }
.summary-item strong { display: block; margin-top: 16px; font-size: 28px; }
.summary-item small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .8fr); gap: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.stats-grid .panel { min-width: 0; }
.stats-grid table th:first-child, .stats-grid table td:first-child { padding-left: 12px; }
.stats-summary .summary-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel, .table-panel { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.panel { padding: 18px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-heading h2 { margin: 0 0 3px; font-size: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.activity-list { display: grid; }
.activity-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid #edf1f2; }
.activity-row:first-child { border-top: 0; }
.activity-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--soft); color: var(--brand-dark); }
.activity-row strong, .activity-row span { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.activity-row span, .activity-row time { color: var(--muted); font-size: 11px; }
.health-list { display: grid; gap: 12px; }
.health-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid #e3e9eb; border-radius: 6px; }
.health-item div { display: flex; align-items: center; gap: 9px; }
.health-item .ok { color: var(--green); }
.health-item .warn { color: var(--amber); }
.health-item span { font-size: 13px; font-weight: 700; }
.health-item strong { font-size: 12px; }
.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.search-box { position: relative; width: min(100%, 360px); }
.search-box svg { position: absolute; top: 11px; left: 11px; color: #74848b; }
.search-box input { padding-left: 38px; }
.toolbar-note { margin: 0; color: var(--muted); font-size: 12px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 15px; border-bottom: 1px solid #e8edef; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #f7f9f9; color: #5d6e75; font-size: 11px; font-weight: 850; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; color: #23343c; }
td small { display: block; max-width: 250px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.number { text-align: right; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 4px; background: #e8f5ee; color: #166b45; font-size: 11px; font-weight: 800; }
.status-pill.inactive { background: #f7e9e7; color: #a33b30; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.small-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #40535b; font-size: 11px; font-weight: 750; }
.small-button.danger { border-color: #e9c5c1; color: var(--red); }
.empty-row { padding: 40px; color: var(--muted); text-align: center; }
dialog { width: min(92vw, 520px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 80px rgba(15, 39, 45, .28); }
dialog::backdrop { background: rgba(8, 29, 34, .52); }
.dialog-form { padding: 22px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.dialog-heading h2, .code-result h2 { margin: 0 0 5px; font-size: 19px; }
.dialog-heading p, .code-result p { margin: 0; color: var(--muted); font-size: 12px; }
.dialog-heading .icon-button { border: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.code-result { text-align: center; }
.success-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; background: #e2f3eb; color: var(--green); }
.code-result code { display: block; margin: 20px 0; padding: 14px; border: 1px dashed #91a8ad; border-radius: 6px; background: #f5f8f8; color: #12383e; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.code-result .dialog-actions { justify-content: center; }
.mobile-only { display: none; }
@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-view { display: block; }
  .sidebar { position: fixed; z-index: 20; left: -250px; width: 238px; transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 50px rgba(0, 0, 0, .2); }
  .main-content { padding: 18px 14px 40px; }
  .mobile-only { display: inline-grid; }
  .topbar { justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .last-updated { display: none; }
  .view-toolbar, .usage-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .view-toolbar .button { align-self: flex-end; }
}
@media (max-width: 480px) {
  .login-view { padding: 22px 14px 18px; background: #f3f6f7; }
  .login-form { padding: 24px 18px; box-shadow: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .topbar h1 { font-size: 21px; }
}
