*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #020617;
  --bg-1: #0f172a;
  --bg-2: #111827;
  --panel: rgba(15, 23, 42, 0.86);
  --panel-grad: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.72));
  --border: rgba(148, 163, 184, 0.16);
  --border-hover: rgba(77, 141, 255, 0.35);
  --text: #e5eefb;
  --muted: #93a4bc;
  --blue: #4d8dff;
  --blue-soft: rgba(77, 141, 255, 0.14);
  --blue-glow: rgba(77, 141, 255, 0.18);
  --danger: #ef4444;
  --success: #22c55e;
  --mono: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 240px;
}

html { font-size: 15px; }

body {
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(77, 141, 255, 0.16), transparent 30%),
    radial-gradient(circle at bottom left, rgba(29, 78, 216, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1) 48%, var(--bg-2));
  background-attachment: fixed;
}

a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: #fff; text-decoration: underline; }

code {
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid var(--border);
  padding: 2px 7px;
  font-size: .88em;
  font-family: var(--mono);
  color: #dbeafe;
}

/* ── Auth pages ── */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}

.auth-card {
  background: var(--panel-grad);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.34);
  padding: 44px;
  width: 100%; max-width: 420px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-brand-icon {
  height: 30px;
  width: auto;
  filter: drop-shadow(0 0 16px var(--blue-glow));
}

.auth-card h2 {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 28px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.auth-subtitle { color: var(--muted); margin-bottom: 20px; font-size: .93rem; }
.auth-link { text-align: center; margin-top: 22px; color: var(--muted); font-size: .9rem; }
.auth-legal {
  margin-top: 16px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.legal-checks {
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.34);
  padding: 12px 14px;
  margin-bottom: 18px;
}

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group textarea { resize: vertical; min-height: 92px; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(77, 141, 255, 0.45);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.otp-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 10px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}

.resend-form { text-align: center; margin-top: 10px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px;
  border: 1px solid transparent;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(90deg, #2563eb, #4d8dff);
  border-color: rgba(77, 141, 255, 0.4);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-color: rgba(77, 141, 255, 0.6);
  text-decoration: none;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.6);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  color: var(--text);
  border-color: var(--border-hover);
  text-decoration: none;
}

.btn-link {
  background: none; border: none;
  color: var(--blue); cursor: pointer;
  font: inherit; font-size: .9rem;
  padding: 4px;
}
.btn-link:hover { text-decoration: underline; }

.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.22);
}

.alert-success {
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.22);
}

/* ── Dashboard layout ── */
.dashboard { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.sidebar-brand-icon {
  height: 24px;
  width: auto;
  filter: drop-shadow(0 0 16px var(--blue-glow));
}

.sidebar-close {
  display: none;
  background: none; border: none;
  color: var(--muted);
  font-size: 1.5rem; cursor: pointer;
}

.sidebar-nav { flex: 1; padding: 10px 10px; }

.nav-item {
  display: flex; align-items: center;
  padding: 10px 14px;
  color: var(--muted);
  font-size: .93rem;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.6);
  border-color: var(--border);
  text-decoration: none;
}

.nav-item.active {
  color: var(--text);
  background: var(--blue-soft);
  border-color: var(--border-hover);
}

.nav-icon { margin-right: 10px; font-size: 1rem; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

.sidebar-legal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-legal a,
.sidebar-legal span {
  color: var(--muted);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-legal .legal-company,
.legal-links .legal-company,
.legal-checks .legal-company {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.legal-company-line { display: block; }

.sidebar-separator {
  border: 0;
  border-top: 1px solid var(--border);
  width: 100%;
}

.sidebar-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sidebar-email {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono);
}

.sidebar-account-row .btn { flex-shrink: 0; }

/* ── Main content ── */
.main-content { flex: 1; margin-left: var(--sidebar-w); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; gap: 12px;
}

.topbar h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--text);
  font-size: 1.4rem; cursor: pointer;
}

.content-body { padding: 28px; max-width: 1180px; }

/* ── Cards ── */
.card {
  background: var(--panel-grad);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.34);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.card h3 {
  font-size: 12px;
  margin-bottom: 18px;
  color: #bfd7ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
  font-weight: 400;
}

/* ── Info rows ── */
.info-row {
  display: flex; justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }

.info-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

/* ── Section header ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}

.section-header h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.inline-form { display: flex; gap: 8px; align-items: center; }

.inline-form input,
.inline-form select,
.compact-create input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.inline-form input:focus,
.inline-form select:focus,
.compact-create input:focus {
  outline: none;
  border-color: rgba(77, 141, 255, 0.45);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.table tr {
  transition: background 0.15s, border-color 0.15s;
}

.table tr:hover td {
  background: rgba(15, 23, 42, 0.5);
}

.ns-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { text-align: right; width: 150px; }
.inline { display: inline; }

/* ── Nameserver cards ── */
.ns-list { display: grid; gap: 14px; }

.ns-card {
  background: var(--panel-grad);
  border: 1px solid var(--border);
  padding: 18px 20px;
  transition: border-color 0.18s ease;
}

.ns-card:hover { border-color: var(--border-hover); }

.ns-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ns-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ns-card-label {
  color: var(--muted);
  font-size: 14px;
}

.ns-card-servers { display: grid; gap: 6px; }

.ns-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.ns-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 28px;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
  background: var(--blue-soft);
  color: #bfd7ff;
  border: 1px solid rgba(77, 141, 255, 0.25);
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.28);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.28);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
}

/* ── Info box ── */
.info-box {
  background: rgba(2, 6, 23, 0.44);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.info-box strong { color: var(--text); }

/* ── Domains ── */
.domain-protip { margin-top: 0; margin-bottom: 22px; }

.domain-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.domain-column,
.domain-detail {
  min-width: 0;
}

.domain-form,
.record-form,
.zone-import-form,
.settings-form,
.monitor-form,
.secondary-form,
.dnssec-panel {
  background: var(--panel-grad);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

.compact-create {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.compact-create input { min-width: 0; flex: 1; }

.domain-list-header { margin-top: 6px; }

.domain-list {
  display: grid;
  gap: 10px;
}

.domain-item {
  display: grid;
  gap: 6px;
  background: rgba(2, 6, 23, 0.38);
  border: 1px solid var(--border);
  padding: 14px;
  color: var(--text);
  text-decoration: none;
}

.domain-item:hover,
.domain-item.active {
  border-color: var(--border-hover);
  background: rgba(15, 23, 42, 0.68);
  text-decoration: none;
}

.domain-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.domain-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.transfer-panel,
.transfer-code-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.38);
}

.transfer-panel h3,
.transfer-code-panel strong { display: block; margin-bottom: 5px; }

.transfer-panel p,
.transfer-code-panel p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.transfer-code-panel code {
  display: block;
  width: 100%;
  overflow: auto;
  white-space: nowrap;
  margin-bottom: 10px;
}

.transfer-form {
  display: flex;
  gap: 8px;
}

.transfer-form input {
  min-width: 0;
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.transfer-form input:focus {
  outline: none;
  border-color: rgba(77, 141, 255, 0.45);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.domain-meta,
.muted-line {
  color: var(--muted);
  font-size: 13px;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(2, 6, 23, 0.38);
  border: 1px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.status-text {
  color: var(--muted);
  font-size: 14px;
}

.authority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.authority-box {
  display: grid;
  gap: 8px;
  align-content: start;
  background: rgba(2, 6, 23, 0.38);
  border: 1px solid var(--border);
  padding: 14px;
  min-width: 0;
}

.authority-box code {
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#actual-ns-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.authority-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.domain-ns-form {
  justify-content: flex-start;
  margin-bottom: 24px;
}

.dnssec-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dnssec-form,
.dnssec-ds-table {
  margin-top: 14px;
}

.dnssec-panel.compact {
  padding: 14px;
}

.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(6px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  background: var(--panel-grad);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.5);
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.72);
  color: var(--text);
  width: 34px;
  height: 34px;
  font-size: 22px;
  cursor: pointer;
}

.records-header { margin-top: 8px; }

.record-data {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-data code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.record-form {
  margin-top: 18px;
  overflow: hidden;
}

.record-editor-actions,
.record-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.record-editor-actions {
  justify-content: flex-start;
}

.record-base-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 150px 120px;
  gap: 12px;
}

.record-type-panel {
  display: none;
  margin-bottom: 12px;
}

.record-type-panel.active {
  display: block;
}

.record-help {
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.record-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.record-inline-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-inline-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.records-table td,
.records-table th {
  vertical-align: top;
}

.monitor-table td,
.monitor-table th {
  vertical-align: middle;
}

.records-table code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.checkbox-row.compact {
  padding: 10px 0;
}

.checkbox-row:first-child { padding-top: 0; }
.checkbox-row:last-of-type { border-bottom: none; }

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--blue);
}

.checkbox-row strong {
  display: block;
  color: var(--text);
  margin-bottom: 3px;
}

.checkbox-row small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-form .btn {
  margin-top: 16px;
}

.stacked-form + .stacked-form {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.section-header.compact {
  margin-bottom: 14px;
}

.form-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: -8px 0 14px;
}

.monitor-ns-cell {
  max-width: 320px;
}

.monitor-ns-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}

.monitor-ns-list code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: .95rem;
}

.empty-state.compact { padding: 28px 16px; }

/* ── Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  z-index: 90;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .sidebar-overlay.show { display: block; }
  .topbar { padding: 14px 16px; }
  .content-body { padding: 16px; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .inline-form { width: 100%; }
  .inline-form input,
  .inline-form select { flex: 1; min-width: 0; }
  .domain-layout,
  .secondary-grid,
  .authority-grid,
  .record-base-grid,
  .record-inline-grid,
  .record-inline-grid.three,
  .record-inline-grid.four { grid-template-columns: 1fr; }
  .compact-create { width: 100%; }
  .domain-ns-form { align-items: stretch; }
  .transfer-form { flex-direction: column; }
  .table th:nth-child(3), .table td:nth-child(3),
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .info-row { flex-direction: column; gap: 4px; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 1100px) {
  .domain-layout { grid-template-columns: 1fr; }
}
