:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-ink: #ffffff;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --surface: #14171d;
    --surface-2: #1b1f27;
    --border: #262b35;
    --border-strong: #353b47;
    --text: #eceef2;
    --muted: #8d94a3;
    --accent: #7c75ff;
    --accent-hover: #918bff;
    --accent-soft: #1f1d3d;
    --ok: #47cd89;
    --ok-bg: #0f2a1d;
    --bad: #f97066;
    --bad-bg: #36160f;
    --warn: #fdb022;
    --warn-bg: #33250a;
    --info: #84caff;
    --info-bg: #102a43;
    --shadow: none;
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.015em; }
h2 { font-size: 16px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.m0 { margin: 0; }
.mt { margin-top: 20px; }
select.auto { width: auto; margin: 0; }
.title { font-weight: 600; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 14px; font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 12px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 180px; margin-bottom: 0; }
.input-group { display: flex; align-items: stretch; margin-top: 5px; }
.input-group input { margin-top: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group select { margin-top: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; width: auto; max-width: 55%; }
.input-group .at { display: flex; align-items: center; padding: 0 8px; border: 1px solid var(--border-strong); border-left: 0; background: var(--surface-2); color: var(--muted); }
.error-text { color: var(--bad); font-size: 13px; margin-top: 8px; }

/* ---------- tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.plain::before { display: none; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font-weight: 700; font-size: 17px; }
.auth .card { padding: 28px; }
.auth h1 { text-align: center; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }
.auth .foot { text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent) url("icon.svg") center / cover; flex: none; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 700; font-size: 15px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }
.sidebar .me { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 10px 0; }
.sidebar .me .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me .email { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px; }
.main { min-width: 0; padding: 28px 36px 64px; }
.page { max-width: 1080px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.banner.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner .grow { flex: 1; min-width: 200px; }

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }
.locked { text-align: center; padding: 40px 24px; }
.locked .icon { font-size: 28px; margin-bottom: 6px; }

/* ---------- onboarding checklist ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--border-strong); color: var(--muted); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.current .dot { border-color: var(--accent); color: var(--accent); }
.steps .t { font-weight: 600; }
.steps .d { color: var(--muted); font-size: 13px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-20 { width: 20%; } .w-30 { width: 30%; } .w-40 { width: 40%; }
.w-50 { width: 50%; } .w-60 { width: 60%; } .w-70 { width: 70%; } .w-80 { width: 80%; } .w-90 { width: 90%; } .w-100 { width: 100%; }

/* ---------- tables & lists ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 550; font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 9px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn { margin-left: 6px; }
.table input { margin: 0; width: 110px; padding: 5px 8px; }
.table-wrap { overflow-x: auto; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }

/* ---------- DNS records ---------- */
.record { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.record-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.record-head .status { margin-left: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; align-items: start; margin-top: 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; padding-top: 6px; }
.kv dd { margin: 0; display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.copybox { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; overflow-wrap: anywhere; }
.kv.stack { grid-template-columns: 1fr; gap: 2px; }
.kv.stack dt { padding-top: 8px; }
.check-detail { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- code & secrets ---------- */
pre { margin: 0; background: #0f1320; color: #e4e7ef; border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; font: 12.5px/1.6 var(--mono); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.secret { border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-bg); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 90px 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 14, 18, .55); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; }
.modal.narrow { max-width: 440px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 12px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 550; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .sidebar .brand { padding: 4px 8px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav-label { display: none; }
  .sidebar .me { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 8px; align-items: center; }
  .sidebar .me .name, .sidebar .me .email { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 80px 1fr; }
  .timeline li > :last-child { grid-column: 1 / -1; }
}
