:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
}
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: inherit; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.admin-link {
  font-size: 0.875rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.15s;
}
.admin-link:hover { color: #fff; border-color: #fff; }

/* ---------- Landing ---------- */
body.landing {
  background: radial-gradient(1200px 600px at 50% -10%, #1e3a8a 0%, var(--bg) 60%);
  color: #fff;
}
body.landing .brand span { color: #60a5fa; }

.center {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}

.entry-card {
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.entry-card h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.entry-card .lead { color: #cbd5e1; margin-bottom: 28px; }

.entry-card form { display: flex; gap: 10px; }
.entry-card form.stack { flex-direction: column; }

.entry-card input {
  flex: 1;
  font-size: 1.15rem;
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #fff;
  color: var(--ink);
  outline: none;
  text-align: center;
  letter-spacing: 0.04em;
}
.entry-card input:focus { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.3); }

.entry-card .error { margin-top: 18px; }

.foot { text-align: center; padding: 20px; font-size: 0.8rem; color: #64748b; }

@media (max-width: 520px) {
  .entry-card form { flex-direction: column; }
}

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.ghost:hover, .btn.ghost:hover { background: #f1f5f9; }
button.danger { background: transparent; color: var(--danger); border: 1px solid #fecaca; }
button.danger:hover { background: #fef2f2; }
.small { font-size: 0.8rem; }
button.small, .btn.small { padding: 5px 10px; border-radius: 8px; }

/* ---------- Messages ---------- */
.error, .notice {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
}
.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ---------- Admin ---------- */
body.admin { background: #f8fafc; }
body.admin .topbar { background: #fff; border-bottom: 1px solid var(--line); }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; display: grid; gap: 20px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.panel h2 { font-size: 1.15rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
details.panel summary { cursor: pointer; font-weight: 600; }
details.panel[open] summary { margin-bottom: 16px; }

.count { background: #eff6ff; color: var(--accent); font-size: 0.8rem; padding: 2px 9px; border-radius: 999px; }

.grid-form { display: grid; grid-template-columns: 1fr 2fr; gap: 14px 18px; }
.grid-form label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; color: #334155; }
.grid-form label small { font-weight: 400; color: var(--muted); }
.grid-form .span-2 { grid-column: span 2; }
.grid-form input:not([type="checkbox"]) {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
}
.grid-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.grid-form .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.grid-form .check input { width: 18px; height: 18px; }
.grid-form .actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }

@media (max-width: 700px) {
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .span-2 { grid-column: auto; }
}

.filter {
  width: 100%;
  max-width: 320px;
  font: inherit;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  margin-bottom: 14px;
}

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.url { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.url a { color: var(--accent); text-decoration: none; }
td.url a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.muted { color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.pill { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill.on { background: #dcfce7; color: var(--ok); }
.pill.off { background: #f1f5f9; color: var(--muted); }

form.inline { display: inline; }

/* ---------- Logo ---------- */
.hero-logo { display: block; width: min(420px, 90%); height: auto; margin: 0 auto 36px; }
.brand img { display: block; height: 34px; width: auto; }
