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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header / Nav ────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.inline { display: inline; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f0f0f0; text-decoration: none; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-block { display: block; width: 100%; }

/* ── Login ───────────────────────────────────────────────── */
.login-container {
  max-width: 360px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-container h1 {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ── Main content ────────────────────────────────────────── */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem;
}

main h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* ── Domain table ────────────────────────────────────────── */
.domain-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.domain-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.domain-table tr:last-child td { border-bottom: none; }
.domain-table tr:hover td { background: #f8fafc; }

.domain-name {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.domain-actions {
  text-align: right;
  width: 50px;
}

/* ── Add form ────────────────────────────────────────────── */
.add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.add-form input[type="text"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.add-form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* ── Status bar ──────────────────────────────────────────── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.text-muted { color: var(--text-muted); }

/* ── Config links ────────────────────────────────────────── */
.config-links {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.config-links h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.config-links ul {
  list-style: none;
  font-size: 0.875rem;
}

.config-links li {
  padding: 0.25rem 0;
}

.config-links code {
  background: var(--bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.85em;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 1rem; }
  .add-form { flex-direction: column; }
  .add-form .btn { width: 100%; text-align: center; }
  .status-bar { flex-direction: column; gap: 0.25rem; }
}
