/* mapper — operator console styling.
   Dark, dense, terminal-adjacent: domains and addresses are set in mono so the
   eye can scan them as data rather than prose. */

:root {
  --bg:        #0e1116;
  --surface:   #151a21;
  --surface-2: #1b212a;
  --line:      #252d38;
  --line-soft: #1e252e;
  --text:      #e6e9ee;
  --muted:     #8c96a3;
  --faint:     #5c6673;
  --accent:    #e0a44a;
  --accent-dim:#3a2f1c;
  --ok:        #46b06a;
  --warn:      #e0a44a;
  --bad:       #e0574a;
  --radius:    10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
          "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute only wins over the UA sheet's `[hidden]{display:none}`
   by source order, and a class rule setting `display` (`.login-wrap{display:grid}`,
   `.auth-fields{display:flex}`) has equal specificity — so it silently overrides
   `hidden` and the element stays on screen. Force it. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ─────────────────────────────────────────────── brand */

.brand {
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.brand-dot { color: var(--accent); }

/* ─────────────────────────────────────────────── login */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, #1a2230 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

.login-card h1 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.brand-sub {
  margin: -12px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

/* ─────────────────────────────────────────────── topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-meta { color: var(--faint); font-size: 13px; }
.topbar-meta .sep { margin: 0 6px; }

/* ─────────────────────────────────────────────── shell */

.shell {
  max-width: 1020px;
  margin: 0 auto;
  padding: 26px 22px 80px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─────────────────────────────────────────────── buttons */

.btn {
  font: inherit;
  font-size: 13.5px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary {
  background: var(--accent);
  color: #1a1207;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #efb45e; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--faint);
  background: var(--surface-2);
}

.btn-mini { padding: 4px 10px; font-size: 12.5px; }
.btn-danger:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); }

/* ─────────────────────────────────────────────── notice */

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--muted);
}
.notice.bad { border-left-color: var(--bad); color: #f0b6b1; }
.notice.ok  { border-left-color: var(--ok);  color: #a9dcbb; }

/* ─────────────────────────────────────────────── mapping list */

.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  align-items: center;
}
.card:hover { border-color: #2c3644; }
.card.is-paused { opacity: .58; }

.card-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.card-domain {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
}
.card-domain:hover { color: var(--accent); }

.card-target {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.8px;
}
.arrow { color: var(--faint); }

.tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .04em;
  padding: 1.5px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--faint);
}
.tag.auth { color: var(--accent); border-color: var(--accent-dim); }
.tag.dns  { color: var(--ok); border-color: #24402f; }
.card-note { color: var(--faint); font-size: 12.5px; }

.card-actions { display: flex; gap: 7px; align-items: center; }

/* status pill */
.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--sans);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(255,255,255,.03);
}
.state.active .dot { background: var(--ok); }
.state.pending .dot { background: var(--warn); }
.state.paused .dot  { background: var(--faint); }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}

/* ─────────────────────────────────────────────── logs */

.logs {
  margin-top: 34px;
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}
.logs h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
#logs-body {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.3px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─────────────────────────────────────────────── forms */

label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
label > span { color: var(--muted); }
label small { color: var(--faint); font-size: 12px; }

input[type=text], input[type=password], input[type=number], input:not([type]) {
  font: inherit;
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  width: 100%;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-suffix { display: flex; align-items: stretch; }
.input-suffix input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.input-suffix span {
  display: flex;
  align-items: center;
  padding: 0 11px;
  font-family: var(--mono);
  font-size: 12.8px;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
  white-space: nowrap;
}

.row { display: flex; gap: 12px; align-items: flex-start; }
.row .grow { flex: 1; }
.row .port { width: 120px; }

.check {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.check input { width: auto; accent-color: var(--accent); }
.check span { color: var(--text); }

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg);
}

.probe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: -4px;
}
.probe-result { font-size: 12.8px; font-family: var(--mono); color: var(--muted); }
.probe-result.ok  { color: var(--ok); }
.probe-result.bad { color: var(--bad); }

.form-error {
  margin: 0;
  color: #f0b6b1;
  font-size: 13px;
  background: rgba(224,87,74,.09);
  border: 1px solid rgba(224,87,74,.28);
  border-radius: 8px;
  padding: 9px 12px;
}

/* ─────────────────────────────────────────────── dialog */

.dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.dialog::backdrop { background: rgba(6,8,11,.72); }
.dialog form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 24px 24px 20px;
}
.dialog h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.dialog-lead { margin: -8px 0 0; color: var(--muted); font-size: 13.5px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.dns-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  padding: 8px 14px 8px 0;
  width: 90px;
}
.dns-table td {
  padding: 8px 0;
  font-family: var(--mono);
}
.dns-table tr + tr th, .dns-table tr + tr td { border-top: 1px solid var(--line-soft); }

/* ─────────────────────────────────────────────── settings dialog */

.setting-block {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg);
}
.setting-block h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.setting-status {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}
.setting-status.ok  { color: var(--ok); }
.setting-status.bad { color: var(--bad); }
.setting-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.6;
}

.form-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
.form-hint.ok { color: #a9dcbb; border-color: #24402f; }

/* ─────────────────────────────────────────────── responsive */

@media (max-width: 620px) {
  .card { grid-template-columns: 1fr; }
  .card-actions { justify-content: flex-start; flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-meta { display: none; }
  .row { flex-direction: column; }
  .row .port { width: 100%; }
}
