/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface2:    #22263a;
  --border:      #2e3348;
  --accent:      #4f8ef7;
  --accent-dim:  #2d5ab5;
  --green:       #34c97a;
  --green-dim:   #1a6b3e;
  --red:         #f05a5a;
  --red-dim:     #7a2020;
  --yellow:      #f5c542;
  --text:        #e2e6f0;
  --text-muted:  #7a8099;
  --radius:      8px;
  --font:        'Inter', system-ui, sans-serif;
}

html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
}
.tab-nav { display: flex; gap: 4px; }
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active { background: var(--accent-dim); color: #fff; }

/* ── Main layout ──────────────────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tab-pane { display: none; flex-direction: column; gap: 20px; }
.tab-pane.active { display: flex; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title {
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Credentials ──────────────────────────────────────────────────────── */
.creds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}
.creds-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .03em;
}
.creds-note {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Inputs ───────────────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .8rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

/* ── Input row ────────────────────────────────────────────────────────── */
.input-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.input-row-2col {
  grid-template-columns: repeat(2, 1fr);
}
.input-card { display: flex; flex-direction: column; gap: 10px; }
.input-card textarea { flex: 1; }

/* ── NS status ────────────────────────────────────────────────────────── */
.ns-status { font-size: .78rem; line-height: 1.7; }
.ns-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.ns-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ns-dot.ok  { background: var(--green); }
.ns-dot.bad { background: var(--red); }
.ns-dot.loading { background: var(--yellow); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  padding: 8px 18px;
  transition: opacity .15s, transform .1s;
  letter-spacing: .02em;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: var(--accent);     color: #fff; }
.btn-success  { background: var(--green);       color: #000; }
.btn-secondary { background: var(--surface2);  color: var(--text); border: 1px solid var(--border); }
.btn-ghost    { background: transparent;        color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

/* ── Action bar ───────────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.status-msg {
  font-size: .8rem;
  color: var(--text-muted);
  margin-left: 6px;
}
.status-msg.ok  { color: var(--green); }
.status-msg.err { color: var(--red); }

/* ── Badge ────────────────────────────────────────────────────────────── */
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .7rem;
  padding: 1px 7px;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
}

/* ── Table ────────────────────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.table-header .card-title { margin-bottom: 0; }
.table-filters input {
  width: 280px;
  font-family: var(--font);
}
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  padding: 10px 16px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: var(--surface2); }
tbody td {
  padding: 9px 16px;
  font-size: .8rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  white-space: nowrap;
}
.tag {
  display: inline-block;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  letter-spacing: .04em;
}
.tag-ok  { background: var(--green-dim); color: var(--green); }
.tag-bad { background: var(--red-dim);   color: var(--red); }
.tag-warn { background: #5a4a00; color: var(--yellow); }

/* ── Push results ─────────────────────────────────────────────────────── */
.push-results-card {}
.push-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.push-row:last-child { border-bottom: none; }

/* ── Creds warning banner ─────────────────────────────────────────────── */
.creds-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #3a2a00;
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  color: var(--yellow);
  font-size: .82rem;
  font-weight: 500;
  padding: 10px 16px;
}

/* ── PTR block ────────────────────────────────────────────────────────── */
.ptr-card { display: flex; flex-direction: column; gap: 12px; }
.ptr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ptr-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--green);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .78rem;
  line-height: 1.8;
  overflow-x: auto;
  padding: 14px 16px;
  white-space: pre;
  max-height: 320px;
  overflow-y: auto;
}

/* ── History ──────────────────────────────────────────────────────────── */
.history-card { padding: 0; overflow: hidden; }
.history-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.history-item {
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background .12s;
  flex-wrap: wrap;
}
.history-summary:hover { background: var(--surface2); }
.history-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.history-date {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.history-domains {
  font-size: .82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.history-detail {
  display: none;
  padding: 0 20px 16px;
  flex-direction: column;
  gap: 12px;
}
.history-detail.open { display: flex; }
.history-ptr-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--green);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .76rem;
  line-height: 1.8;
  overflow-x: auto;
  padding: 12px 14px;
  white-space: pre;
  max-height: 260px;
  overflow-y: auto;
}
.history-sub-title {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.history-a-table { font-size: .76rem; }
.history-a-table th { font-size: .72rem; }
.history-a-table td { padding: 6px 12px; }

/* ── Settings tab ─────────────────────────────────────────────────────── */
.settings-section { display: flex; flex-direction: column; gap: 14px; }
.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.settings-textarea {
  min-height: 200px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.creds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.btn-sm {
  font-size: .74rem;
  padding: 4px 10px;
}
.show-key-btn {
  margin-top: 4px;
  align-self: flex-start;
}

/* ── Balance display ──────────────────────────────────────────────────── */
.balance-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}
.balance-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.balance-currency {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 600;
}
.balance-label {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Registrant grid ──────────────────────────────────────────────────── */
.registrant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.registrant-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.registrant-grid .span2 { grid-column: span 2; }

/* ── TLD manager ──────────────────────────────────────────────────────── */
.tld-filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tld-filter-bar input[type="text"] { width: 200px; }
.tld-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.tld-manager-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}
.tld-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color .12s;
}
.tld-item:hover { border-color: var(--accent); }
.tld-item.enabled { border-color: var(--green); }
.tld-item input[type="checkbox"] { cursor: pointer; accent-color: var(--green); }
.tld-name { font-weight: 700; font-size: .82rem; flex: 1; }
.tld-price { font-size: .75rem; color: var(--text-muted); }

/* ── Domains tab ──────────────────────────────────────────────────────── */
.dom-controls-card {}
.dom-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.dom-controls-grid label,
.dom-controls-grid select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.dom-controls-grid select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .8rem;
  padding: 8px 10px;
  outline: none;
  cursor: pointer;
}
.dom-budget-display {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.dom-budget-display strong { color: var(--text); }

/* ── Purchase progress bar ───────────────────────────────────────────── */
.dom-progress-wrap {
  margin-bottom: 14px;
}
.dom-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.dom-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Set A Records table ──────────────────────────────────────────────── */
.dom-a-quickfill {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dom-a-quickfill input {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: .85rem;
}
.dom-a-table-wrap {
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.dom-a-field {
  width: 100%;
  padding: 5px 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .83rem;
  font-family: var(--font-mono);
  outline: none;
}
.dom-a-field:focus {
  background: var(--surface);
  border-radius: 3px;
}
.dom-a-del {
  padding: 2px 7px;
  font-size: .8rem;
  opacity: .5;
}
.dom-a-del:hover { opacity: 1; }
.dom-a-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: .8rem;
  font-family: var(--font-mono);
}

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .input-row { grid-template-columns: 1fr; }
  .table-filters input { width: 100%; }
}
