:root {
  color-scheme: dark light;
  --bg: #0b0d10;
  --fg: #e6e6e6;
  --muted: #8a8f98;
  --card: #14171c;
  --border: #262a31;
  --accent: #5fb3ff;
  --danger: #ff6b6b;
  --error-bg: #3a1f22;
  --ok-bg: #1f3a26;
  --code-bg: #1a1d22;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.shell {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.shell:has(.wide) {
  max-width: 920px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

h1, h2, h3 { margin: 0 0 0.75rem; font-weight: 600; }
h2 { margin-top: 1.5rem; font-size: 1.05rem; }
h3 { margin-top: 1rem; font-size: 0.95rem; color: var(--muted); }

.muted { color: var(--muted); font-size: 0.9rem; }

code, pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  word-break: break-all;
}

pre {
  padding: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }

form.inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg);
}

input[type="text"],
select {
  font: inherit;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
}

select.compact {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

button {
  font: inherit;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #0b0d10;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

button:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); color: #fff; }

.error {
  background: var(--error-bg);
  border: 1px solid #5a2a2f;
  color: #ffd6d6;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.created {
  margin-top: 1rem;
  background: var(--ok-bg);
  border: 1px solid #2a5a36;
  color: #d6ffe1;
  padding: 0.75rem;
  border-radius: 8px;
}

.created img { display: block; margin-top: 0.5rem; max-width: 200px; background: #fff; padding: 0.5rem; border-radius: 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

th, td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 500; }

.row-actions { display: flex; gap: 0.4rem; }
.row-actions form { margin: 0; flex-direction: row; }
.row-actions button { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.inline-promote {
  display: flex;
  flex-direction: row;
  gap: 0.3rem;
  margin: 0;
  align-items: center;
}

.inline-promote input[type="text"] {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  max-width: 10rem;
}

.inline-promote button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.promote {
  display: inline-block;
}

.promote summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: color .12s ease-out, border-color .12s ease-out;
}

.promote summary::-webkit-details-marker { display: none; }
.promote summary::marker { content: ""; }

.promote summary:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.promote[open] summary {
  color: var(--muted);
  border-color: var(--accent);
}

.promote[open] .inline-promote {
  margin-top: 0.4rem;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.foot {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

a { color: var(--accent); }

.admin-head { margin-bottom: 1rem; }
.admin-head h1 { margin-bottom: 0.25rem; }

.tab-strip {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background-color .12s ease-out, color .12s ease-out;
}

.tab:hover {
  color: var(--fg);
  background: var(--code-bg);
}

.tab[aria-selected="true"] {
  color: #0b0d10;
  background: var(--accent);
}

.tab[aria-selected="true"]:hover {
  background: var(--accent);
  filter: brightness(1.05);
}

.tab[aria-selected="true"] .pill {
  background: rgba(0, 0, 0, 0.18);
  border-color: transparent;
  color: #0b0d10;
}

.tab-panel { animation: fade .12s ease-out; }
.tab-panel[hidden] { display: none; }
.tab-panel > h2:first-child { margin-top: 0; }

/* No-JS fallback: deep links via :target still reveal the matching panel. */
.tab-panel:target { display: block !important; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
