:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fbfcfd;
  --border: #e3e6ea;
  --border-strong: #cdd3da;
  --text: #10151c;
  --text-2: #5b6673;
  --text-3: #8b95a1;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  --warn: #a1620a;
  --warn-soft: #fdf3e3;
  --err: #b42318;
  --err-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 21, 28, .06), 0 8px 24px rgba(16, 21, 28, .05);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --panel: #161b22;
    --panel-2: #1b212a;
    --border: #262d38;
    --border-strong: #38404d;
    --text: #e8edf3;
    --text-2: #9aa5b3;
    --text-3: #6e7987;
    --accent: #5b8cff;
    --accent-soft: #16233f;
    --ok: #4ade80;
    --ok-soft: #10261b;
    --warn: #fbbf24;
    --warn-soft: #2a2113;
    --err: #f87171;
    --err-soft: #2b1615;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: 12.5px; }

/* ---------- 레이아웃 ---------- */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 14px;
}
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.brand-host { font-size: 11px; color: var(--text-3); }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); cursor: pointer; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  font-size: 13.5px; font-family: inherit;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-sep { margin: 10px 8px 4px; font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }

.main { padding: 26px 30px 60px; max-width: 1120px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }

/* ---------- 카드 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--text-3); }

/* ---------- 폼 ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font-size: 13.5px; font-family: inherit;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 8px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 76px; }
.field { margin-bottom: 13px; }
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; font-size: 13.5px; font-weight: 600; font-family: inherit;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); }
.btn.danger { background: var(--err); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 배지 / 알림 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  background: var(--panel-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--accent-soft); color: var(--accent); }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; padding: 0 18px 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-2);
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--text-3); }
.empty { padding: 34px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 온보딩 단계 ---------- */
.step { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text-3);
  border: 1px solid var(--border-strong);
}
.step.done .step-dot { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step.current .step-dot { background: var(--accent); color: #fff; border-color: transparent; }
.step.waiting .step-dot { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.step-title { font-weight: 620; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-summary { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ---------- DNS 레코드 ---------- */
.dns-rec { border: 1px solid var(--border); border-radius: 9px; padding: 13px; background: var(--panel-2); }
.dns-rec + .dns-rec { margin-top: 10px; }
.dns-rec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: start; margin-bottom: 6px; }
.kv-key { font-size: 11.5px; color: var(--text-3); font-weight: 600; padding-top: 4px; }
.kv-val {
  font-family: var(--mono); font-size: 12px; word-break: break-all;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
}
.hint { font-size: 12px; color: var(--text-2); margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--border-strong); }

/* ---------- 로그인 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand { justify-content: center; padding-bottom: 10px; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 9px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 7px; border: none; background: none; border-radius: 6px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* ---------- 코드 블록 ---------- */
pre.code {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 13px; overflow-x: auto; margin: 0; line-height: 1.55;
}

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--border); }
  .brand { padding: 0 10px 0 0; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .nav-sep { display: none; }
  .main { padding: 18px 16px 50px; }
  .field-row { grid-template-columns: 1fr; }
}
