/* CH19 통합 관리 시스템 — 공통 디자인 */
@import url("../vendor/pretendard/pretendardvariable-dynamic-subset.css");

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --onair: #e11d48;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --info-soft: #dbeafe;
  --group-blue: #e0ecff;
  --group-yellow: #fff6d6;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 60px;
  --sidebar-w: 236px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #0f1729;
  --surface-3: #18233b;
  --border: #1f2c45;
  --border-strong: #2c3b5a;
  --text: #e5ebf5;
  --text-2: #9fb0c8;
  --text-3: #64748b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: #172a4f;
  --ok-soft: #0f2e1d;
  --warn-soft: #33260b;
  --bad-soft: #3a1419;
  --info-soft: #132a4d;
  --group-blue: #142443;
  --group-yellow: #2e2610;
  --sidebar: #070c18;
  --sidebar-2: #111a2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ───────── 레이아웃 ───────── */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
  transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700;
  font-size: 15.5px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--onair);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .25); }
.brand small { display: block; font-weight: 500; font-size: 11px; color: #7f8ea8; letter-spacing: .02em; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 11px; color: #64748b; padding: 14px 10px 6px; letter-spacing: .06em; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: var(--sidebar-text);
  text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .icon { opacity: .9; }
.sidebar-foot { padding: 12px 18px; font-size: 11.5px; color: #64748b; border-top: 1px solid #1e293b; }
.sidebar-foot a { color: #94a3b8; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--surface-3); color: var(--text); font-size: 13px; text-decoration: none; }
.user-chip:hover { text-decoration: none; background: var(--border); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid;
  place-items: center; font-weight: 700; font-size: 12.5px; }
.content { padding: 22px 24px 40px; flex: 1; min-width: 0; }
.content.wide { padding-left: 18px; padding-right: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.scrim { display: none; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content, .content.wide { padding: 16px 12px 32px; }
  .user-chip .uname { display: none; }
}

/* ───────── 카드/그리드 ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
@media (max-width: 420px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; } }

.stat { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 600; color: var(--text-2); margin-left: 3px; }
.stat .l { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.stat.accent .v { color: var(--accent); }
.stat.onair .v { color: var(--onair); }

/* 홈 서비스 타일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none;
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-height: 140px; }
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.tile .ti { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.tile .ti .icon { width: 22px; height: 22px; }
.tile h3 { font-size: 15.5px; }
.tile p { margin: 0; font-size: 13px; color: var(--text-2); }
.tile .meta { margin-top: auto; font-size: 12.5px; color: var(--text-2); display: flex; gap: 10px; flex-wrap: wrap; }
.tile.primary { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border-color: transparent; }
.tile.primary p, .tile.primary .meta { color: #dbe6ff; }
.tile.primary .ti { background: rgba(255, 255, 255, .16); color: #fff; }

/* ───────── 버튼/폼 ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .12s, border-color .12s; touch-action: manipulation; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: var(--border-strong); }
.btn.danger-ghost:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 48px; font-size: 15.5px; padding: 0 20px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn .count { background: rgba(255, 255, 255, .25); padding: 0 7px; border-radius: 999px; font-size: 11.5px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; }
textarea.input { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.lg { height: 48px; font-size: 16px; border-radius: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--text-3); }
.search .input { padding-left: 34px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: 13px;
  height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff;
  border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ───────── 배지 ───────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--accent); }
.badge.purple { background: #ede9fe; color: #6d28d9; }
:root[data-theme="dark"] .badge.purple { background: #2a1f4d; color: #c4b5fd; }
.badge .pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live .pip { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ───────── 표 (편집 그리드) ───────── */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .total { margin-left: auto; color: var(--text-2); font-size: 13px; }
.title-input { font-size: 18px; font-weight: 700; border: 1px solid transparent; background: transparent; color: var(--text);
  padding: 4px 8px; border-radius: 8px; font-family: inherit; min-width: 0; width: 100%; max-width: 520px; }
.title-input:hover:not([readonly]) { border-color: var(--border-strong); }
.title-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: auto; max-height: calc(100dvh - var(--topbar-h) - 150px); }
table.grid-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.grid-table th, .grid-table td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  padding: 9px 10px; vertical-align: middle; }
.grid-table th:last-child, .grid-table td:last-child { border-right: 0; }
.grid-table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--text-2);
  font-weight: 700; font-size: 12.5px; text-align: center; white-space: pre-line; }
.grid-table thead tr.sub th { top: var(--head1, 38px); }
.grid-table thead th.g-blue { background: var(--group-blue); }
.grid-table thead th.g-yellow { background: var(--group-yellow); }
.grid-table tbody tr:hover td { background: var(--surface-2); }
.grid-table tbody tr.dirty td { background: #fffbea; }
:root[data-theme="dark"] .grid-table tbody tr.dirty td { background: #2a2410; }
.grid-table tbody tr.dragging { opacity: .4; }
.grid-table tbody tr.drop-above td { box-shadow: inset 0 2px 0 var(--accent); }
.grid-table td { white-space: pre-wrap; word-break: keep-all; overflow-wrap: break-word; }
.grid-table td.c { text-align: center; }
.grid-table td.strong { font-weight: 700; }
.grid-table td.handle { width: 30px; text-align: center; color: var(--text-3); cursor: grab; padding: 0; }
.grid-table td.handle .icon { width: 16px; }
.grid-table td.num { width: 42px; text-align: center; color: var(--text-3); font-size: 12px; }
.grid-table td.actions { width: 1%; white-space: nowrap; text-align: center; }
.grid-table td.edit-cell { padding: 3px; }
.grid-table td.edit-cell .input, .grid-table td.edit-cell textarea { height: auto; min-height: 34px; font-size: 13px; padding: 6px 8px; }
.grid-table td.edit-cell textarea { resize: vertical; min-height: 34px; overflow: hidden; }
.cell-select { height: 30px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 13px; }
.cell-select.v-Yes { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.cell-select.v-No { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.th-toggle { margin-left: 6px; font-size: 11px; height: 20px; padding: 0 7px; border-radius: 999px; border: 0;
  background: rgba(0, 0, 0, .08); color: inherit; cursor: pointer; font-weight: 700; }
.ping { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; margin-left: 6px; }
.ping .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.ping.up { color: var(--ok); } .ping.up .pip { background: var(--ok); }
.ping.down { color: var(--bad); } .ping.down .pip { background: var(--bad); }
.empty { padding: 48px 16px; text-align: center; color: var(--text-3); }

/* 모바일 카드 목록 */
.cards { display: none; flex-direction: column; gap: 10px; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px;
  box-shadow: var(--shadow); cursor: pointer; }
.mcard.dirty { border-color: var(--warn); }
.mcard .t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.mcard .t .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard dl { display: grid; grid-template-columns: 84px 1fr; gap: 4px 10px; margin: 10px 0 0; font-size: 13px; }
.mcard dt { color: var(--text-3); }
.mcard dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .table-wrap.responsive { display: none; }
  .cards { display: flex; }
}

/* ───────── 모달/토스트 ───────── */
.modal { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: none; align-items: center;
  justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 16px; width: 100%; max-width: 480px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal-box.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 560px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-box, .modal-box.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; }
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; max-width: 360px; animation: rise .18s; }
.toast.ok { background: #166534; } .toast.bad { background: #b91c1c; }
@media (max-width: 560px) { #toasts { left: 12px; right: 12px; } .toast { max-width: none; } }

/* 로그 박스 */
.logbox { background: #0b1020; color: #cbd5e1; font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  line-height: 1.55; padding: 12px 14px; border-radius: 10px; height: 260px; overflow: auto; white-space: pre-wrap;
  word-break: break-all; }
.unit-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.unit-row:last-child { border-bottom: 0; }
.unit-row strong { flex: 1; min-width: 120px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; }
.ip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.ip-list .badge { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
table.simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.simple th, table.simple td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
table.simple th { color: var(--text-2); font-weight: 600; font-size: 12.5px; background: var(--surface-2); }
table.simple th.sortable { cursor: pointer; user-select: none; }
.table-scroll { overflow-x: auto; }

/* 사진 갤러리 */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del { position: absolute; top: 4px; right: 4px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 150; display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 86dvh; object-fit: contain; user-select: none; }
.lightbox .lb-btn { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; width: 46px; height: 46px;
  border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lightbox .lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lightbox .prev { left: 14px; top: 50%; } .lightbox .next { right: 14px; top: 50%; }
.lightbox .close { right: 14px; top: 14px; }
.lightbox .lb-tools { position: absolute; top: 16px; left: 16px; display: flex; gap: 8px; }
.lightbox .lb-tools .btn:not(.danger) { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.lightbox .cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #cbd5e1; font-size: 13px; }
.drop-zone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 18px; text-align: center; color: var(--text-2);
  margin-bottom: 14px; cursor: pointer; }
.drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }

/* 로그인 */
.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 20% -10%, #dbe7ff 0%, transparent 60%), var(--bg); }
:root[data-theme="dark"] .auth-page { background: radial-gradient(1200px 600px at 20% -10%, #14254a 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 30px 26px; }
.auth-card .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 6px; }
.auth-card .logo .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--onair); box-shadow: 0 0 0 5px rgba(225, 29, 72, .18); }
.auth-card .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 22px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--accent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* 컬럼 설정 */
.col-list { display: flex; flex-direction: column; gap: 6px; }
.col-row { display: grid; grid-template-columns: 22px 26px minmax(120px, 1.4fr) 110px minmax(90px, 1fr) auto; gap: 8px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.col-row.is-hidden { opacity: .55; background: var(--surface-2); }
.col-row.dragging { opacity: .4; }
.col-row .col-grip { cursor: grab; color: var(--text-3); text-align: center; user-select: none; }
.col-row .col-btns { display: flex; gap: 4px; align-items: center; }
.col-row .col-opts { grid-column: 3 / -1; }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; }
@media (max-width: 640px) {
  .col-row { grid-template-columns: 22px 26px 1fr auto; }
  .col-row [data-f="type"], .col-row [data-f="group"] { grid-column: 3 / -1; }
}

/* 사이드바 운영/중지 스위치 */
.nav-row { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.nav-row > a { flex: 1; min-width: 0; }
.nav-row.off > a { opacity: .45; }
.nav-row.off > a .grow::after { content: " (중지)"; font-size: 11px; }
.nav-switch { transform: scale(.8); margin-right: 4px; }
.nav-switch span { background: #334155; }

/* 표 촘촘하게 */
.grid-table { font-size: 13px; line-height: 1.38; }
.grid-table th, .grid-table td { padding: 5px 8px; }
.grid-table thead th { font-size: 12px; padding: 6px 8px; }
.grid-table td.edit-cell { padding: 2px; }
.grid-table td.edit-cell .input, .grid-table td.edit-cell textarea { min-height: 28px; padding: 4px 6px; }
.cell-select { height: 26px; font-size: 12.5px; }
.grid-table .badge { height: 20px; font-size: 11.5px; padding: 0 8px; }
.grid-table .btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.grid-table .btn.sm.icon-only { width: 26px; }
.grid-table td.photos { white-space: nowrap; }

/* 단독 화면 (/codec, /election) */
.main.solo { margin-left: 0; min-height: 100vh; min-height: 100dvh; }
.solo-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none; white-space: nowrap; }
.solo-brand:hover { text-decoration: none; }
.solo-brand .icon { width: 22px; height: 22px; color: var(--accent); }
.standalone .topbar .menu-btn { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none; } .standalone .user-chip .uname { display: none; } }

/* 단독 화면 상단 여백 축소 */
.standalone .content { padding-top: 8px; }
.standalone .title-input { padding-top: 2px; padding-bottom: 2px; }

/* 시스템 → 백업 파일 목록 (내려받기 버튼) */
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 1px 0; border-bottom: 1px dashed var(--border); }
.bk-row:last-child { border-bottom: 0; }
.bk-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bk-row .btn.icon-only { width: 26px; height: 26px; flex: none; }

/* 이상 알림 배지 */
.alert-dot { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; line-height: 1; color: #fff; background: var(--bad); box-shadow: 0 0 0 2px var(--sidebar, #0f172a); }
.alert-dot.warn { background: #f59e0b; color: #111827; }
.alert-dot.bad { animation: alert-pulse 2s ease-in-out infinite; }
.alert-dot:empty { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.alert-dot.hidden { display: none; }
.nav-row .alert-dot { margin-left: 6px; }
.menu-btn { position: relative; }
.alert-dot.mini { position: absolute; top: 4px; right: 4px; min-width: 9px; width: 9px; height: 9px; padding: 0; font-size: 0; box-shadow: 0 0 0 2px var(--surface); }
.tile { position: relative; }
.tile-alert { position: absolute; top: 12px; right: 12px; margin: 0; box-shadow: 0 0 0 3px var(--surface); }
@keyframes alert-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--sidebar, #0f172a), 0 0 0 0 rgba(239, 68, 68, .55); }
  50% { box-shadow: 0 0 0 2px var(--sidebar, #0f172a), 0 0 0 6px rgba(239, 68, 68, 0); } }
@media (prefers-reduced-motion: reduce) { .alert-dot.bad { animation: none; } }

.auto-upd { font-size: 12.5px; }
@media (max-width: 640px) { .auto-upd { display: none; } }
