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

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #edf2f7;
  color: #1a2332;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: #2563eb; text-decoration: none; transition: color 0.15s; }
a:hover { color: #1d4ed8; }

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: #e0e7ff;
  color: #1e3a5f;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

button, input, textarea, select {
  font: inherit;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #c3d0e0;
  background: #fff;
  color: #1a2332;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  background: #2563eb;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
button:hover { background: #1d4ed8; }
button:active { transform: scale(0.98); }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 2px solid #cbd5e1;
  background: #f1f5f9;
}
td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}
.panel table input[readonly] { width: 100%; min-width: 240px; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f0f5ff; }
tbody tr:last-child td { border-bottom: none; }

h1 { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 0 0 0.75rem; }

/* ── Layout ──────────────────────────────────────── */
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }

/* ── Site Header ─────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-bottom: none;
  margin-bottom: 0;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.site-header p { margin: 0.15rem 0 0; }

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff !important;
  letter-spacing: -0.02em;
}

.site-header .subtle {
  color: #94a3b8;
  font-size: 0.85rem;
}

.site-header button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
}
.site-header button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── Navigation ──────────────────────────────────── */
.admin-nav {
  display: flex;
  gap: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.15);
}

.admin-nav.wrap {
  padding-top: 0;
  padding-bottom: 0;
}

.admin-nav a {
  color: #94a3b8;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  border-bottom: 2px solid transparent;
}

.admin-nav a:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.admin-nav a.active {
  color: #fff;
  font-weight: 600;
  border-bottom: 2px solid #60a5fa;
  background: rgba(255, 255, 255, 0.05);
}

/* ── Main Content ────────────────────────────────── */
main.wrap {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

/* ── Panels ──────────────────────────────────────── */
.panel {
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.panel-subtle { background: #f8fafc; }
.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

/* ── Page Head ───────────────────────────────────── */
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

/* ── Stack / Form Layout ─────────────────────────── */
.stack { display: grid; gap: 0.85rem; }
.stack label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}
.stack label input,
.stack label textarea,
.stack label select {
  font-weight: 400;
  color: #1a2332;
}
.field { display: grid; gap: 0.35rem; }
.field > span, label > span {
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}
.form-actions { display: flex; gap: 1rem; align-items: center; }

/* ── Filters ─────────────────────────────────────── */
.filters { display: flex; gap: 0.85rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 180px; }

/* ── Flash Messages ──────────────────────────────── */
.flash-stack { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.flash {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-weight: 500;
}
.flash.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.flash.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ── Pills / Badges ──────────────────────────────── */
.pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ── Grid ────────────────────────────────────────── */
.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* ── Misc ────────────────────────────────────────── */
.pre { white-space: pre-wrap; }
.subtle { color: #64748b; }
.hint { color: #475569; font-size: 0.9rem; }
.inline-links { display: flex; gap: 1rem; margin-bottom: 1rem; }
.inline-links a.active { font-weight: 700; color: #1d4ed8; }

/* ── Form Errors ─────────────────────────────────── */
.field-error { color: #dc2626; font-size: 0.9rem; }
.form-errors {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.form-errors ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

/* ── Pagination ──────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination .subtle { font-size: 0.88rem; }

/* ── Login Special ───────────────────────────────── */
main.wrap:has(.narrow) {
  padding-top: 3rem;
}
