:root {
  --accent: #0891b2;
  --accent-hover: #0e7490;
  --accent-light: rgba(8, 145, 178, 0.08);
  --success: #059669;
  --danger: #dc2626;
  --surface: #ffffff;
  --surface-secondary: #fafafa;
  --border: #e4e4e7;
  --text-primary: #18181b;
  --text-secondary: #71717a;
  --text-tertiary: #a1a1aa;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--surface-secondary);
  color: var(--text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

/* ─── Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-secondary); border-color: #d4d4d8; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #057a55; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }

/* ─── Table ─── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-light); }

.status-active { color: var(--success); font-weight: 500; }
.status-inactive { color: var(--danger); }

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ─── Card (tools page) ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── Modal ─── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal.open { display: flex; }

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.15s ease-out;
}

.modal-content.wide { max-width: 720px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-actions { display: flex; gap: 8px; }

.modal label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.modal input,
.modal select {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal input:focus,
.modal select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.modal .help-text {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.modal .help-text h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal .help-text ul { padding-left: 18px; }
.modal .help-text li { margin-bottom: 4px; line-height: 1.5; }

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.record-fields { margin: 12px 0; }

/* ─── Login ─── */
.login-modal {
  background: rgba(24, 24, 27, 0.6);
  backdrop-filter: blur(4px);
}

.login-content {
  max-width: 380px;
  padding: 36px;
  text-align: center;
}

.login-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}

.remember-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.remember-container input { width: auto; margin: 0; }

.login-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-feedback {
  margin-top: 12px;
  font-size: 0.8125rem;
  min-height: 20px;
}

/* ─── Subdomain table cell overrides ─── */
#subdomainTable td:first-child,
#subdomainTable th:first-child {
  text-align: center;
  width: 48px;
}

#dnsTable .actions-cell { justify-content: center; }

/* ─── Quota / WHOIS ─── */
#quotaBlock {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
}

#whoisResult {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  border: 1px solid var(--border);
  max-height: 320px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container { padding: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  table { font-size: 0.8125rem; }

  thead th, tbody td { padding: 10px 10px; }

  .modal-content { padding: 20px; max-width: 100%; }

  .btn { padding: 8px 14px; font-size: 0.8125rem; }

  .actions-cell { flex-direction: column; gap: 4px; }

  #subdomainTable td:nth-child(6),
  #subdomainTable th:nth-child(6),
  #subdomainTable td:nth-child(8),
  #subdomainTable th:nth-child(8) {
    display: none;
  }
}

@media (max-width: 480px) {
  #subdomainTable td:nth-child(7),
  #subdomainTable th:nth-child(7) {
    display: none;
  }
}
