/* ============================================================
   Nexa — Minimalist Professional Design System
   Mobile-first, no framework, no CDN.
   Palette: single blue accent. Radius: 10px card, 8px control.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.16);
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --radius-card: 10px;
  --radius-control: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -12px rgba(15, 23, 42, 0.14);
  --font: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1120px;
  --sidebar-w: 240px;
  --topbar-h: 64px;
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 0.5rem; overflow-wrap: break-word; min-width: 0; }
h1 { font-size: clamp(1.9rem, 1rem + 5.2vw, 2.75rem); line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.3rem, 1rem + 2vw, 1.625rem); font-weight: 700; }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.8vw, 1.125rem); font-weight: 650; }
p { margin: 0 0 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.25rem; }
small, .small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.875em; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 200;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem;
  border-radius: var(--radius-control); transition: top 0.15s ease;
}
.skip-link:focus { top: 0.75rem; color: #fff; text-decoration: none; }

/* Selection */
::selection { background: var(--primary-ring); }

/* ---------- 3. Layout utilities ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.section { padding: 3.5rem 0; }
.section-sm { padding: 2rem 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.center { text-align: center; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  list-style: none; margin: 0 0 1.25rem; padding: 0;
  font-size: 0.875rem; color: var(--muted);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 0.5rem; }
.breadcrumb li + li::before {
  content: "/";
  color: var(--border-strong);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 500; }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  font: inherit; font-size: 0.9375rem; font-weight: 550;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-secondary {
  background: var(--surface); color: var(--ink); border-color: var(--border);
  box-shadow: var(--shadow);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.875rem; }
.btn-lg { min-height: 52px; padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn svg { flex: none; }

/* ---------- 5. Forms ---------- */
.form-group { margin-bottom: 1rem; }
label, .label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--ink);
}
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], select, textarea {
  display: block; width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  font: inherit; font-size: 0.9375rem; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 110px; resize: vertical; }
.input::placeholder, input::placeholder { color: var(--muted-2); }
.input:hover, input:hover, select:hover, textarea:hover { border-color: var(--muted-2); }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input-error, input[aria-invalid="true"] { border-color: var(--danger); }
.input-error:focus, input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14); }
.field-hint { font-size: 0.8125rem; color: var(--muted); margin-top: 0.375rem; }
.field-error { font-size: 0.8125rem; color: var(--danger); margin-top: 0.375rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row-2 { grid-template-columns: 1fr 1fr; } }

/* Password wrapper */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 3rem; }
.password-toggle {
  position: absolute; right: 0.375rem; top: 50%; transform: translateY(-50%);
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--muted); cursor: pointer;
}
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }

/* Checkbox / radio */
.check {
  display: flex; align-items: flex-start; gap: 0.625rem;
  font-size: 0.9375rem;
}
.check input {
  width: 1.125rem; height: 1.125rem; margin-top: 0.2rem; accent-color: var(--primary);
}

/* Search input */
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none;
}
.search-wrap input { padding-left: 2.5rem; }

/* ---------- 6. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  min-width: 0;
  overflow-wrap: break-word;
}
.card-title { font-size: 1rem; font-weight: 650; margin: 0 0 0.25rem; }
.card-sub { font-size: 0.875rem; color: var(--muted); margin: 0 0 1rem; }
.card-stat { padding: 1.25rem; }
.stat-label { font-size: 0.8125rem; color: var(--muted); font-weight: 500; margin-bottom: 0.25rem; }
.stat-value { font-size: clamp(1.4rem, 1.1rem + 2vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: break-word; }
.stat-delta { font-size: 0.8125rem; margin-top: 0.25rem; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--muted); }

/* ---------- 7. Badges / alerts / tables ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.75rem; font-weight: 600; line-height: 1;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink);
}
.badge-primary { background: var(--primary-soft); border-color: #bfdbfe; color: var(--primary-hover); }
.badge-success { background: var(--success-soft); border-color: #a7f3d0; color: #047857; }
.badge-danger { background: var(--danger-soft); border-color: #fecaca; color: #b91c1c; }
.badge-warning { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.alert {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}
.alert-success { background: var(--success-soft); border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; }
.alert-icon { flex: none; margin-top: 0.15rem; }
.alert-body { flex: 1; min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.alert-body ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.alert-close {
  flex: none;
  min-width: 44px; min-height: 44px; margin: -0.5rem -0.5rem -0.5rem 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer; color: inherit;
}
.alert-close:hover { background: rgba(15, 23, 42, 0.06); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
table.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; min-width: 640px; }
.table th {
  text-align: left;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted);
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafc; }
.table .cell-main { font-weight: 550; }
.table .cell-sub { font-size: 0.8125rem; color: var(--muted); }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; flex: none;
  border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-hover);
  font-weight: 700; font-size: 0.875rem;
  border: 1px solid #bfdbfe;
  overflow: hidden;
}
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.75rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1.125rem; }
.user-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 0; overflow-wrap: break-word; }
.user-cell .meta { min-width: 0; overflow-wrap: break-word; }
.user-cell .meta .name {
  font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-cell .meta .email { font-size: 0.8125rem; color: var(--muted); overflow-wrap: break-word; word-break: break-word; min-width: 0; }

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.empty-icon {
  width: 3rem; height: 3rem; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.empty h3 { margin-bottom: 0.375rem; }
.empty p { color: var(--muted); font-size: 0.9375rem; }

/* ---------- 8. Navbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.navbar {
  display: flex; align-items: center; gap: 1rem;
  height: 64px;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 750; font-size: 1.125rem; letter-spacing: -0.02em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem;
}
.nav-links {
  display: none;
  align-items: center; gap: 0.25rem;
  margin-left: 1rem;
}
.nav-links a {
  color: var(--muted); font-size: 0.9375rem; font-weight: 500;
  padding: 0.6rem 0.8rem; border-radius: 8px;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.nav-actions { margin-left: auto; display: none; align-items: center; gap: 0.625rem; }
.nav-toggle {
  margin-left: auto;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; color: var(--ink);
}
.nav-toggle:hover { background: var(--surface-2); }
.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem 1rem;
  background: var(--surface);
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: flex; align-items: center;
  min-height: 44px;
  padding: 0.6rem 0.25rem;
  color: var(--ink); font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.mobile-menu a:last-child { border-bottom: 0; }
.mobile-menu a:hover { text-decoration: none; color: var(--primary); }
.mobile-menu .mobile-cta { display: grid; gap: 0.625rem; padding-top: 0.875rem; }
@media (min-width: 860px) {
  .nav-links { display: flex; }
  .nav-actions { display: flex; }
  .nav-toggle { display: none; }
  .mobile-menu.open { display: none; }
}

/* User dropdown */
.user-menu { position: relative; }
.user-button {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 44px;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow);
}
.user-button:hover { border-color: var(--border-strong); }
.user-button .name { font-size: 0.875rem; font-weight: 550; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown {
  display: none;
  position: absolute; right: 0; top: calc(100% + 0.5rem);
  min-width: 13rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  z-index: 120;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 0.625rem; width: 100%;
  min-height: 44px; padding: 0.6rem 0.75rem;
  font-size: 0.9375rem; color: var(--ink);
  border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  text-align: left; font-family: inherit;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .dropdown-meta { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); margin-bottom: 0.375rem; min-width: 0; overflow-wrap: break-word; }
.dropdown .dropdown-meta .email { font-size: 0.8125rem; color: var(--muted); overflow-wrap: break-word; word-break: break-word; min-width: 0; }

/* ---------- 9. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 4rem;
}
.footer-grid {
  display: grid; gap: 2rem;
  grid-template-columns: 1fr 1fr;
  padding: 2.5rem 0;
}
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { color: var(--muted); font-size: 0.9375rem; max-width: 28rem; }
.footer-col h4 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.875rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.footer-col a {
  display: inline-flex; align-items: center; min-height: 32px;
  color: var(--muted); font-size: 0.9375rem;
}
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  display: flex; flex-direction: column; gap: 0.625rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem; color: var(--muted);
}
@media (min-width: 860px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- 10. Landing: hero ---------- */
.hero { padding: 3rem 0 2.5rem; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; grid-template-columns: 1fr; }
.hero-copy p.lead { font-size: 1.125rem; color: var(--muted); max-width: 34rem; }
.hero-actions { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0 1rem; }
.hero-note { font-size: 0.8125rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .hero-actions { flex-direction: row; } }
@media (min-width: 960px) {
  .hero { padding: 4.5rem 0 3.5rem; }
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}

/* Mockup panel */
.mockup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.mockup-bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.dot { width: 0.625rem; height: 0.625rem; border-radius: 999px; background: var(--border-strong); }
.mockup-body { padding: 1.25rem; display: grid; gap: 0.875rem; }
.mockup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.mockup-row .left { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.mockup-pulse { width: 0.625rem; height: 0.625rem; border-radius: 999px; background: var(--success); flex: none; }
.mockup-line { height: 0.625rem; border-radius: 999px; background: var(--surface-2); }
.mockup-chart {
  display: flex; align-items: flex-end; gap: 0.4rem; height: 96px;
  padding: 0.875rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.mockup-chart span { flex: 1; border-radius: 4px 4px 2px 2px; background: #bfdbfe; min-height: 12px; }
.mockup-chart span.tall { background: var(--primary); }

/* Logos / stats / features */
.logo-row {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center;
  padding: 1.25rem 0; color: var(--muted-2); font-weight: 600; font-size: 0.9375rem;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.stats-band { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; padding: 2rem 0; }
.stat-band-value { font-size: clamp(1.5rem, 1.2rem + 2vw, 1.875rem); font-weight: 750; letter-spacing: -0.02em; overflow-wrap: break-word; }
.stat-band-label { font-size: 0.875rem; color: var(--muted); }
@media (min-width: 860px) { .stats-band { grid-template-columns: repeat(4, 1fr); } }

.feature-card { display: flex; flex-direction: column; gap: 0.625rem; }
.feature-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); border: 1px solid #bfdbfe;
}
.feature-card p { color: var(--muted); font-size: 0.9375rem; margin: 0; }

/* Steps / pricing teaser / CTA */
.steps { counter-reset: step; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.8125rem; font-weight: 700;
}
.cta-panel {
  background: var(--ink); color: #fff;
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.cta-panel p { color: #cbd5e1; }
.cta-panel .btn-secondary { border-color: transparent; }
@media (min-width: 860px) { .cta-panel { padding: 3.5rem; } }

/* ---------- 11. Auth ---------- */
.auth-wrap {
  max-width: 440px;
  margin: 2.5rem auto;
  padding-inline: 1.25rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
}
.auth-card h1 { font-size: clamp(1.25rem, 1.1rem + 1.5vw, 1.5rem); margin-bottom: 0.375rem; overflow-wrap: break-word; }
.auth-card .sub { color: var(--muted); font-size: 0.9375rem; margin-bottom: 1.5rem; }
.auth-alt { text-align: center; font-size: 0.9375rem; margin-top: 1.25rem; color: var(--muted); }
.auth-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.25rem 0 1rem; font-size: 0.875rem; }
.error-list {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-radius: var(--radius-control);
  padding: 0.875rem 1rem 0.875rem 2.25rem;
  margin: 0 0 1rem; color: #991b1b; font-size: 0.9375rem;
}
.divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--muted); font-size: 0.8125rem; margin: 1.25rem 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Captcha widgets (Turnstile / reCAPTCHA) */
.captcha-group { margin: 1.125rem 0; display: flex; justify-content: center; }
.captcha-group > div { max-width: 100%; overflow: hidden; }

/* ---------- 12. App shell (dashboard/admin) ---------- */
.app { display: block; }
.app-body { display: block; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar-inner { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; min-height: 100%; }
.side-nav { display: grid; gap: 0.25rem; }
.side-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); padding: 0.75rem 0.625rem 0.375rem; }
.side-link {
  display: flex; align-items: center; gap: 0.625rem;
  min-height: 44px; padding: 0.6rem 0.75rem;
  border-radius: 8px; color: var(--muted); font-size: 0.9375rem; font-weight: 500;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-link.active { background: var(--primary-soft); color: var(--primary-hover); }
.side-card {
  margin-top: auto;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  padding: 1rem; font-size: 0.875rem; color: var(--muted);
}
.main { min-width: 0; padding: 1.25rem 1.25rem 3rem; max-width: 100%; overflow-wrap: break-word; }
.topbar {
  position: sticky; top: 64px; z-index: 50;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar .search-wrap { flex: 1 1 8rem; max-width: 28rem; min-width: 0; }
.topbar .search-wrap input { min-width: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.625rem; min-width: 0; flex-wrap: wrap; }
@media (max-width: 379px) {
  .user-button .name { display: none; }
  .user-button { padding: 0.3rem; gap: 0; }
}
.drawer-toggle {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.page-head .title { flex: 1; min-width: 12rem; }
.page-head h1 { font-size: clamp(1.25rem, 1rem + 2vw, 1.5rem); margin-bottom: 0.25rem; }
.page-head p { color: var(--muted); margin: 0; font-size: 0.9375rem; }
@media (min-width: 960px) {
  .app-body { display: grid; grid-template-columns: var(--sidebar-w) 1fr; align-items: start; }
  .sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100dvh - 64px); overflow: auto; }
  .main { padding: 1.75rem 2rem 4rem; }
  .drawer-toggle { display: none; }
  .topbar { top: 64px; }
}
@media (max-width: 959px) {
  .sidebar {
    position: fixed; inset: 64px auto 0 0; width: min(18rem, 84vw); z-index: 90;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: none; position: fixed; inset: 64px 0 0; z-index: 80;
    background: rgba(15, 23, 42, 0.4);
  }
  .scrim.show { display: block; }
}

/* Activity list */
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li {
  display: flex; gap: 0.75rem; padding: 0.875rem 0;
  border-bottom: 1px solid var(--border); font-size: 0.9375rem;
}
.activity li:last-child { border-bottom: 0; }
.activity-dot { width: 0.625rem; height: 0.625rem; border-radius: 999px; background: var(--border-strong); margin-top: 0.45rem; flex: none; }
.activity-dot.green { background: var(--success); }
.activity-dot.blue { background: var(--primary); }
.activity-dot.amber { background: var(--warning); }
.activity time { display: block; font-size: 0.8125rem; color: var(--muted); }

/* Settings */
.settings-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- 13. Error pages ---------- */
.error-wrap {
  max-width: 36rem; margin: 4rem auto; text-align: center; padding-inline: 1.25rem;
}
.error-code {
  font-size: 0.875rem; font-weight: 600; color: var(--muted);
  display: inline-flex; padding: 0.35rem 0.75rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  margin-bottom: 1rem;
}
.error-wrap h1 { margin-bottom: 0.625rem; }
.error-wrap p { color: var(--muted); }
.error-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- 14. Flash container ---------- */
.flash-stack { display: grid; gap: 0.625rem; margin: 1rem 0; }
.flash-stack:empty { display: none; }

/* ---------- 15. Footer helpers, misc ---------- */
.inline-form { display: inline; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar .left, .toolbar .right { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; }
.pagination { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; margin-top: 1rem; font-size: 0.875rem; color: var(--muted); }
code.inline {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0.15rem 0.4rem; border-radius: 6px;
}
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---------- 16. Responsive refinements (fluid / small screens / wide) ---------- */
/* iOS auto-zoom: keep form text >= 16px below desktop nav breakpoint */
@media (max-width: 859px) {
  .input,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="url"], input[type="number"],
  input[type="tel"], input[type="date"], input[type="time"],
  select, textarea { font-size: 1rem; }
}

/* Stacked table cards below 640px (contract: Tim C adds data-label per td).
   Scoped with :has(td[data-label]) so tables without data-label keep
   normal scroll behaviour via .table-wrap overflow-x:auto fallback. */
@media (max-width: 639px) {
  .section { padding: 2.25rem 0; }
  .section-sm { padding: 1.5rem 0; }
  .hero { padding: 2.25rem 0 2rem; }
  .hero-copy p.lead { font-size: 1rem; }
  .cta-panel { padding: 1.75rem 1.25rem; }
  .stats-band { grid-template-columns: 1fr 1fr; }

  table.table:has(td[data-label]) { min-width: 0; }
  table.table:has(td[data-label]) thead {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .table-wrap:has(table.table td[data-label]) {
    border: 0; background: transparent; box-shadow: none;
    overflow-x: auto;
  }
  table.table:has(td[data-label]),
  table.table:has(td[data-label]) tbody,
  table.table:has(td[data-label]) tr,
  table.table:has(td[data-label]) td {
    display: block; width: 100%;
  }
  table.table:has(td[data-label]) tbody { display: grid; gap: 0.75rem; }
  table.table:has(td[data-label]) tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 0;
    overflow: hidden;
  }
  table.table:has(td[data-label]) tbody tr:hover { background: var(--surface); }
  table.table:has(td[data-label]) td {
    border-bottom: 1px solid var(--border);
    padding: 0.625rem 1rem;
    min-height: 44px;
  }
  table.table:has(td[data-label]) td:last-child { border-bottom: 0; }
  table.table:has(td[data-label]) td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 0.15rem;
    overflow-wrap: break-word;
  }
}

/* Very small screens: tighter auth card */
@media (max-width: 479px) {
  .auth-card { padding: 1.25rem; }
  .container { padding-inline: 1rem; }
  .main { padding: 1rem 1rem 2.5rem; }
}

/* Wide desktop: readability cap kept, slightly more whitespace */
@media (min-width: 1280px) {
  .container { max-width: var(--max); }
  .section { padding: 4rem 0; }
  .hero { padding: 5rem 0 4rem; }
  .main { padding: 2rem 2.5rem 4rem; }
  .hero-grid { gap: 3rem; }
}

/* ---------- 17. Button loading state (form submit feedback) ---------- */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.is-loading::before {
  content: "";
  flex: none;
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
