/* ROADZIP 운영자 콘솔 — 바닐라 웹. 팔레트: 블루 계열 1색 강조, 노랑/이모지 UI 금지. */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --border: #e2e8f0;
  --text: #1a2233;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c232d;
    --border: #2a323d;
    --text: #e6edf3;
    --text-muted: #8b98a9;
    --primary: #4f8cff;
    --primary-dark: #3b78f0;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c232d;
  --border: #2a323d;
  --text: #e6edf3;
  --text-muted: #8b98a9;
  --primary: #4f8cff;
  --primary-dark: #3b78f0;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); }
button { font-family: inherit; }

/* ── 로그인 ───────────────────────────────── */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--text-muted); margin: 0 0 24px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px;
}
.field input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border: 1px solid transparent; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer; width: 100%;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: 6px 12px; font-size: 12.5px; }
.divider-or { text-align: center; color: var(--text-muted); font-size: 12px; margin: 16px 0; }
.msg { font-size: 13px; margin-top: 12px; padding: 10px 12px; border-radius: 8px; }
.msg.err { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.msg.info { background: var(--surface-2); color: var(--text-muted); }

/* ── 앱 레이아웃 ────────────────────────────── */
.app { display: none; min-height: 100%; }
.app.active { display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; max-height: 100vh;
}
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); font-weight: 800; padding: 14px 12px 5px;
}
.brand { font-size: 16px; font-weight: 800; padding: 6px 12px 18px; letter-spacing: 0.3px; }
.brand span { color: var(--primary); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600;
  font-size: 13.5px; cursor: pointer; border: none; background: none; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-spacer { flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar .who { font-size: 13px; color: var(--text-muted); }
.content { padding: 24px; overflow: auto; }
.page-title { font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--text-muted); margin: 0 0 20px; font-size: 13px; }

/* ── 카드 / 통계 ────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat .value.muted { color: var(--text-muted); font-size: 18px; }

/* ── 테이블 ─────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 13.5px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; max-width: 340px; }
tbody tr:hover { background: var(--surface-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.ok { background: rgba(22, 163, 74, 0.12); color: var(--ok); }
.pill.warn { background: rgba(180, 83, 9, 0.12); color: var(--warn); }
.pill.off { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.pill.admin { background: rgba(37, 99, 235, 0.12); color: var(--primary); }

.empty, .loading { padding: 40px; text-align: center; color: var(--text-muted); }
.row-actions { display: flex; gap: 6px; }
.pager { display: flex; gap: 10px; justify-content: center; padding: 16px; }

/* 상세 모달 */
.modal-bg {
  position: fixed; inset: 0; background: rgba(8, 12, 20, 0.5);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal-bg.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  width: 100%; max-width: 680px; max-height: 85vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-all; }
.x-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }

@media (max-width: 760px) {
  .app.active { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 10px; }
  .brand { display: none; }
  .nav-spacer { display: none; }
  .content { padding: 16px; }
}
