/* ───────────── Host-Infinity DNS – design tokens ───────────── */
:root {
  --paper: #F1F3F6;
  --card: #FFFFFF;
  --line: #DCE1E9;
  --line-soft: #E9EDF2;
  --ink: #121A2B;
  --ink-2: #3A4459;
  --muted: #667089;
  --brand: #2348C9;
  --brand-ink: #FFFFFF;
  --brand-soft: #E7EDFF;
  --ok: #13A26B;
  --ok-soft: #DDF5EA;
  --warn: #B87A0C;
  --warn-soft: #FDF0D5;
  --bad: #D93B3B;
  --bad-soft: #FCE4E4;
  --side: #121A2B;
  --side-ink: #C5CCDD;
  --side-active: #FFFFFF;

  /* record type slots */
  --t-a: #2348C9; --t-aaaa: #6B4DD8; --t-cname: #0E8C8C; --t-mx: #C2571A;
  --t-txt: #59667F; --t-srv: #13A26B; --t-caa: #A33C82; --t-ns: #8A6A12; --t-soa: #8A93A6;

  --radius-s: 6px;
  --radius-m: 10px;
  --font: 'Instrument Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-pop: 0 12px 32px -8px rgb(18 26 43 / .28), 0 2px 6px rgb(18 26 43 / .08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1320; --card: #151C2D; --line: #263048; --line-soft: #1D2539;
    --ink: #E6EAF4; --ink-2: #C0C7D8; --muted: #8B95AD;
    --brand: #5B7FFF; --brand-soft: #1B2850;
    --ok: #34C98B; --ok-soft: #12302A; --warn: #E2A93B; --warn-soft: #33290F; --bad: #F06464; --bad-soft: #3A1A1D;
    --side: #0A0E18; --side-ink: #9AA4BC;
    --t-a: #5B7FFF; --t-aaaa: #9479F2; --t-cname: #2DB3B3; --t-mx: #E77B3C; --t-txt: #8B95AD; --t-srv: #34C98B; --t-caa: #D267AD; --t-ns: #D1A63A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: .88em; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; font-weight: 700; line-height: 1.15; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────────── shell ───────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 248px, transparent 248px); }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; font-weight: 700; font-size: 1.02rem; }
.logo svg { flex: none; }
.logo small { display: block; font-weight: 500; color: var(--side-ink); font-size: .78rem; }
.side-group { margin-top: 14px; }
.side-title { padding: 6px 10px; font-size: .8rem; color: #7E89A3; }
.side a, .side button.link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-s);
  color: var(--side-ink); background: none; border: 0; cursor: pointer; text-align: left; font-size: .93rem;
}
.side a:hover, .side button.link:hover { background: rgb(255 255 255 / .06); text-decoration: none; color: #fff; }
.side a.on { background: rgb(255 255 255 / .1); color: var(--side-active); font-weight: 600; }
.side .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.side .domain-switch { font-family: var(--mono); font-size: .85rem; }
.side .grow { flex: 1; }
.user-box { border-top: 1px solid rgb(255 255 255 / .08); padding: 14px 10px 4px; margin-top: 12px; font-size: .88rem; }
.user-box b { color: #fff; display: block; font-weight: 600; }

.main { min-width: 0; padding: 28px 40px 60px; max-width: 1240px; width: 100%; }
.topbar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 40; }
  .topbar button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .main { padding: 20px 16px 48px; }
}

/* ───────────── page header ───────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin-top: 6px; color: var(--muted); }
.crumb { font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
.domain-title { font-family: var(--mono); font-weight: 500; font-size: 1.75rem; letter-spacing: -.02em; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); }

/* ───────────── surfaces ───────────── */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-body { padding: 18px 20px; }
.stack > * + * { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ───────────── buttons & inputs ───────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 500; font-size: .92rem; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--line-soft); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--line-soft); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.icon { padding: 6px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .8rem; }
.input, .select, textarea.input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.mono { font-family: var(--mono); font-size: .9rem; }
textarea.input { min-height: 140px; resize: vertical; font-family: var(--mono); font-size: .85rem; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--paper); color: var(--muted); font-family: var(--mono); font-size: .85rem; white-space: nowrap; max-width: 220px; flex: none; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }

/* ───────────── record type slot (the signature element) ───────────── */
.slot {
  --c: var(--t-txt);
  display: inline-grid; place-items: center; min-width: 52px; height: 26px; padding: 0 6px;
  font: 600 .74rem/1 var(--mono); letter-spacing: .02em; color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--c) 22%, transparent);
}
.slot.A { --c: var(--t-a); } .slot.AAAA { --c: var(--t-aaaa); } .slot.CNAME { --c: var(--t-cname); }
.slot.MX { --c: var(--t-mx); } .slot.TXT { --c: var(--t-txt); } .slot.SRV { --c: var(--t-srv); }
.slot.CAA { --c: var(--t-caa); } .slot.NS { --c: var(--t-ns); } .slot.SOA { --c: var(--t-soa); }

/* ───────────── status lamps ───────────── */
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--muted); flex: none; }
.lamp.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.lamp.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.lamp.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 500; background: var(--line-soft); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

/* ───────────── tables ───────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: .82rem; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: color-mix(in srgb, var(--brand) 4%, var(--card)); }
.t tr.off td { opacity: .5; }
.t td.actions { text-align: right; white-space: nowrap; width: 1%; }
.t .val { font-family: var(--mono); font-size: .86rem; word-break: break-all; max-width: 460px; }
.t .name { font-family: var(--mono); font-size: .88rem; font-weight: 500; }
.t .name .zone { color: var(--muted); font-weight: 400; }
.t tr.editing td { background: var(--paper); }

.domain-row .dn { font-family: var(--mono); font-weight: 500; font-size: .98rem; color: var(--ink); }
.num { font-variant-numeric: tabular-nums; }

/* ───────────── record editor ───────────── */
.editor { padding: 18px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.editor .row { align-items: flex-start; }
.editor .row + .row { margin-top: 12px; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.type-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.type-picker button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 5px; }
.type-picker button .slot { transition: transform .1s; }
.type-picker button[aria-pressed="false"] .slot { filter: grayscale(.9); opacity: .55; }
.type-picker button:hover .slot { opacity: 1; filter: none; }
.preview-line { font-family: var(--mono); font-size: .82rem; color: var(--muted); word-break: break-all; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.toolbar .tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 3px 10px; border-radius: 999px; font-size: .8rem; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--card); }

/* ───────────── nameserver hand-off box ───────────── */
.ns-box { display: grid; gap: 8px; }
.ns-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-s); font-family: var(--mono); font-size: .92rem; background: var(--paper); }

/* ───────────── metrics ───────────── */
.metric { padding: 16px 20px; }
.metric .label { font-size: .85rem; color: var(--muted); }
.metric .value { font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric .delta { font-size: .82rem; margin-top: 2px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }

.chart { width: 100%; height: 220px; display: block; }
.chart .bar { fill: var(--brand); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .grid { stroke: var(--line-soft); }
.chart text { fill: var(--muted); font: 11px var(--font); }

.bars-h { display: grid; gap: 10px; }
.bars-h .b { display: grid; grid-template-columns: 64px 1fr 70px; align-items: center; gap: 10px; font-size: .88rem; }
.bars-h .track { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bars-h .fill { height: 100%; background: var(--c, var(--brand)); border-radius: 4px; }

/* ───────────── propagation ───────────── */
.prop { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.prop .node { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; background: var(--card); }
.prop .node.own { background: var(--paper); }
.prop .node .head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.prop .node .loc { font-size: .8rem; color: var(--muted); margin: 2px 0 8px; }
.prop .node .ans { font-family: var(--mono); font-size: .8rem; color: var(--ink-2); word-break: break-all; }

/* ───────────── activity ───────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.timeline .what { color: var(--muted); font-size: .84rem; grid-column: 1 / -1; font-family: var(--mono); }

/* ───────────── empty & misc ───────────── */
.empty { text-align: center; padding: 48px 20px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-s); background: var(--brand-soft); color: var(--ink); font-size: .9rem; }
.callout.warn { background: var(--warn-soft); }
.callout.bad { background: var(--bad-soft); }
.callout svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.copy-field { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); font-family: var(--mono); font-size: .82rem; word-break: break-all; }
.copy-field span { flex: 1; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 60px; }
.skeleton { background: linear-gradient(90deg, var(--line-soft), var(--paper), var(--line-soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 4px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ───────────── modal & toast ───────────── */
.modal-back { position: fixed; inset: 0; background: rgb(10 14 24 / .5); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--card); border-radius: var(--radius-m); width: min(520px, 100%); box-shadow: var(--shadow-pop); max-height: 90vh; overflow: auto; }
.modal .panel-head { border-bottom: 1px solid var(--line-soft); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: var(--radius-s); font-size: .9rem; box-shadow: var(--shadow-pop); max-width: 380px; animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ───────────── login ───────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--side); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .zone-ghost { font-family: var(--mono); font-size: .86rem; line-height: 1.9; color: #5E6B8C; white-space: pre; }
.login-art .zone-ghost b { color: #9DB2FF; font-weight: 500; }
.login-art .zone-ghost i { color: #4ED6A0; font-style: normal; }
.login-art h1 { font-size: 2.4rem; max-width: 14ch; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px; max-width: 460px; width: 100%; margin: 0 auto; }
.login-form h2 { font-size: 1.5rem; margin-bottom: 8px; }
.login-form .btn { justify-content: center; padding: 12px 16px; font-size: 1rem; margin-top: 24px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
