:root {
  --bg: #0a0c12;
  --card: #141824;
  --card-hover: #191e2c;
  --border: #242a3d;
  --text: #f3f5fb;
  --text-muted: #8b91a8;
  --text-faint: #565c74;
  --critical: #ff6b81;
  --critical-bg: #2f1620;
  --warning: #ffcc66;
  --warning-bg: #332911;
  --ok: #5fe0a0;
  --ok-bg: #10301f;
  --silenced: #8b91a8;
  --silenced-bg: #1c2131;
  --primary: #6d8cff;
  --primary-hover: #8aa3ff;
  --accent2: #a78bfa;
  --gradient-brand: linear-gradient(135deg, var(--primary), var(--accent2));
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sidebar-width: 224px;
  --sidebar-width-collapsed: 64px;
  --content-max: 1140px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 32px -8px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-glow: 0 0 0 1px rgba(109, 140, 255, .16), 0 16px 48px -12px rgba(109, 140, 255, .28);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

* { box-sizing: border-box; }

::selection { background: var(--primary); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

body {
  font-family: var(--font-body);
  margin: 0;
  background:
    radial-gradient(ellipse 70% 40% at 15% -10%, rgba(109, 140, 255, .05), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, .sidebar-nav a:focus-visible { outline: 2px solid var(--primary-hover); outline-offset: 2px; border-radius: 4px; }

h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }

code, pre, .otp-box, input[type="number"] { font-family: var(--font-mono); }

/* ---- App shell / sidebar ---- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  transition: width .18s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar.collapsed { width: var(--sidebar-width-collapsed); padding: 1.25rem .75rem; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: .5rem;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: .55rem;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.radar-dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(109, 140, 255, .6);
  animation: radar-ping 2.2s cubic-bezier(.4, 0, .3, 1) infinite;
}

@keyframes radar-ping {
  0% { box-shadow: 0 0 0 0 rgba(109, 140, 255, .55); }
  70% { box-shadow: 0 0 0 9px rgba(109, 140, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(109, 140, 255, 0); }
}

.sidebar.collapsed .sidebar-label { display: none; }

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.sidebar-toggle:hover { color: var(--text); border-color: var(--text-faint); background: var(--card-hover); }

.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }

.sidebar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: .55rem .65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  font-weight: 500;
  font-size: .92rem;
  transition: background .15s ease, color .15s ease;
}

.sidebar-nav a:hover { background: var(--card-hover); color: var(--text); text-decoration: none; }

.sidebar-nav a.active { background: var(--border); color: var(--text); }

.sidebar-footer form { margin: 0; }

.sidebar-footer button {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.sidebar-footer button:hover { color: var(--critical); border-color: var(--critical); background: var(--critical-bg); }

.main { flex: 1; min-width: 0; padding: 2.5rem 3rem 4rem; max-width: var(--content-max); margin: 0 auto; width: 100%; animation: page-in .4s cubic-bezier(.16, 1, .3, 1); }

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.main--center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  max-width: none;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(109, 140, 255, .16), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(95, 224, 160, .07), transparent 60%),
    var(--bg);
}

/* ---- Login ---- */

.login-box {
  width: fit-content;
  min-width: 320px;
  max-width: min(90vw, 480px);
  padding: 2.5rem 2.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  position: relative;
  z-index: 1;
  animation: login-in .45s cubic-bezier(.16, 1, .3, 1);
}

@keyframes login-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box h1 {
  margin: 0 0 .35rem;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-radar-badge {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border-radius: 50%;
  background: var(--card-hover);
  border: 1px solid var(--border);
  -webkit-text-fill-color: initial;
}

.login-radar-badge::before, .login-radar-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(109, 140, 255, .5);
  animation: radar-sweep 2.6s cubic-bezier(.4, 0, .3, 1) infinite;
}

.login-radar-badge::after { animation-delay: 1.3s; }

@keyframes radar-sweep {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(2.1); opacity: 0; }
}

.login-subtitle {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: .88rem;
}

.error {
  color: var(--critical);
  background: var(--critical-bg);
  border: 1px solid rgba(255, 107, 129, .3);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  font-size: .88rem;
  margin: 0 0 1rem;
}

/* ---- Forms & buttons ---- */

label { font-size: .85rem; color: var(--text-muted); font-weight: 500; }

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:hover, select:hover { border-color: var(--text-faint); }

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 140, 255, .18);
}

.stack-form { display: flex; flex-direction: column; gap: .85rem; max-width: 420px; }

.btn {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease, box-shadow .15s ease;
  box-shadow: 0 2px 8px -2px rgba(109, 140, 255, .5);
}

.btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px -4px rgba(109, 140, 255, .55); }
.btn:active { transform: translateY(0); filter: brightness(.98); }
.btn:focus-visible { outline: 2px solid var(--primary-hover); outline-offset: 2px; }

.btn-muted {
  background: var(--silenced-bg);
  color: var(--silenced);
  box-shadow: none;
}

.btn-muted:hover { background: var(--border); color: var(--text); box-shadow: none; transform: none; }

.btn-danger {
  background: var(--critical-bg);
  color: var(--critical);
  box-shadow: none;
  border: 1px solid var(--critical);
}

.btn-danger:hover { background: var(--critical); color: #fff; box-shadow: 0 6px 18px -4px rgba(255, 107, 129, .45); transform: translateY(-1px); }

.controls { margin: 1.25rem 0; display: flex; gap: .5rem; flex-wrap: wrap; }

.inline-form { display: inline-flex; gap: .5rem; margin-right: 1rem; align-items: center; }

/* ---- Service detail: header + categorized settings cards ---- */

.service-header { margin-bottom: 1.5rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.service-header h1 { margin: 0 0 .5rem; }

.service-id-row { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.service-id-row code { font-size: .85rem; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
  margin: 0;
}

.settings-card--wide { grid-column: 1 / -1; margin: 1.5rem 0; }
.settings-card--primary { border-left-color: var(--primary); }
.settings-card--ok { border-left-color: var(--ok); }
.settings-card--silenced { border-left-color: var(--silenced); }

.settings-card .inline-form { margin: 0; flex-wrap: wrap; width: 100%; }
.settings-card .controls { margin: 0; }

.settings-card .inline-form select,
.settings-card .inline-form input { min-width: 0; flex: 1 1 160px; }

.settings-card-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1rem; }

.settings-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-card-header h1, .settings-card-header h2 { margin: 0; font-size: 1rem; }

.settings-desc { margin: .25rem 0 0; color: var(--text-muted); font-size: .82rem; line-height: 1.5; }
.settings-desc code { font-size: .85em; }

.content-section { margin: 2rem 0; }
.content-section .settings-card-header { margin-bottom: .85rem; }

.connect-steps {
  list-style: none;
  counter-reset: connect-step;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.connect-steps li {
  counter-increment: connect-step;
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem 1.2rem 3.2rem;
  box-shadow: var(--shadow-sm);
}

.connect-steps li::before {
  content: counter(connect-step);
  position: absolute;
  left: 1.1rem;
  top: 1rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-steps strong { display: block; margin-bottom: .5rem; }
.connect-steps pre { margin: .5rem 0 0; }

.connect-step-action { margin-top: .6rem; display: flex; gap: .6rem; flex-wrap: wrap; }

.connect-manual { margin-top: 1.25rem; }
.connect-manual summary { cursor: pointer; color: var(--text-muted); font-size: .85rem; font-weight: 500; }
.connect-manual summary:hover { color: var(--text); }
.connect-manual pre { margin: .6rem 0 0; }

.form-card {
  max-width: 520px;
  margin: 1.5rem auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.9rem;
  box-shadow: var(--shadow-sm);
}

.form-card .settings-card-header { margin-bottom: 1.5rem; }

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem .5rem;
  box-shadow: var(--shadow-sm);
}

/* ---- Dashboard layout + services sidebar ---- */

.dashboard-layout { display: flex; gap: 1.5rem; align-items: flex-start; margin-top: 1.5rem; }

.dashboard-main { flex: 1; min-width: 0; }

.services-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.services-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.services-sidebar-header h2 { margin: 0; }

.services-count {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
}

.services-list { overflow-y: auto; padding: .5rem; }

.services-empty { padding: .75rem; }

.service-list-item {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .7rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: background .12s ease;
}

.service-list-item:hover { background: var(--card-hover); text-decoration: none; }

.service-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: .4rem;
  flex-shrink: 0;
}

.service-list-dot--ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.service-list-dot--critical { background: var(--critical); box-shadow: 0 0 0 3px var(--critical-bg); }
.service-list-dot--silenced { background: var(--silenced); box-shadow: 0 0 0 3px var(--silenced-bg); }

.service-list-info { min-width: 0; flex: 1; }

.service-list-name {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-list-meta {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; }
  .services-sidebar { width: 100%; position: static; max-height: none; }
}

@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card--wide { margin: 1.25rem 0; }
  .form-card { padding: 1.5rem 1.35rem; }
}

/* ---- Stat cards ---- */

.stat-cards { display: flex; gap: 1rem; margin: 1.25rem 0; }

.stat-card {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.15rem 1.3rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card .stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-card .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; margin-top: .35rem; letter-spacing: -.02em; }

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.stat-card--down { border-left-color: var(--critical); }
.stat-card--down .stat-icon { background: var(--critical-bg); border-color: transparent; }
.stat-card--silenced { border-left-color: var(--silenced); }
.stat-card--silenced .stat-icon { background: var(--silenced-bg); border-color: transparent; }
.stat-card--ok { border-left-color: var(--ok); }
.stat-card--ok .stat-icon { background: var(--ok-bg); border-color: transparent; }

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
}

.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-silenced { background: var(--silenced-bg); color: var(--silenced); }

/* ---- Table ---- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}

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

th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Critical feed ---- */

.critical-feed {
  background: var(--critical-bg);
  border: 1px solid rgba(255, 107, 129, .35);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}

.critical-feed h2 { margin-top: 0; }
.critical-feed ul { margin: 0; padding-left: 1.1rem; }
.critical-feed li { margin-bottom: .35rem; }
.critical-feed .ts { color: var(--text-muted); font-size: .85rem; }

/* ---- Misc ---- */

pre {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}

code {
  color: var(--text-muted);
  background: rgba(139, 145, 168, .12);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .9em;
}

pre code { background: none; padding: 0; }

/* ---- highlight.js: blend the CDN theme into our own <pre> card styling instead of stacking backgrounds ---- */
.hljs { background: transparent !important; padding: 0 !important; color: inherit; }

/* ---- OTP boxes ---- */

.otp-group { display: flex; gap: .6rem; flex-wrap: wrap; }

.otp-box {
  width: 3rem;
  height: 3.5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  padding: 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.otp-box:focus { transform: translateY(-1px); }

/* ---- Mobile sidebar overlay ---- */

.sidebar-backdrop { display: none; }

.mobile-menu-toggle { display: none; }

@media (max-width: 640px) {
  .sidebar, .sidebar.collapsed {
    width: min(80vw, 260px);
    padding: 1.25rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar.mobile-open,
  .sidebar.collapsed.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed .sidebar-label { display: inline; }

  .sidebar-toggle { display: none; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 1rem;
    font-size: 1.1rem;
  }
}

/* ---- Mobile stacked tables ---- */

@media (max-width: 640px) {
  table, thead, tbody, tr, th, td { display: block; }

  thead { display: none; }

  table {
    border: none;
    background: none;
    box-shadow: none;
    margin: 1.25rem 0;
  }

  tbody tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: .75rem;
    padding: .25rem .9rem;
  }

  tbody tr:last-child { margin-bottom: 0; }

  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
  }

  td:last-child { border-bottom: none; }

  td::before {
    content: attr(data-label);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
  }
}

/* ---- Mobile layout spacing ---- */

@media (max-width: 640px) {
  .main { padding: 1.25rem; }
  h1 { font-size: 1.35rem; }

  .stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
  }

  .inline-form {
    width: 100%;
    margin-right: 0;
  }

  .inline-form input[type="number"],
  .inline-form input[type="text"] {
    flex: 1;
  }
}

/* ---- Mobile OTP box refinement ---- */

@media (max-width: 480px) {
  .otp-box {
    width: 2.4rem;
    height: 2.8rem;
    font-size: 1.2rem;
  }

  .otp-group { gap: .4rem; }
}

/* ---- Event context (expandable) ---- */

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

details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
}

details summary:hover { color: var(--text); }

details pre {
  margin: .5rem 0 0;
  font-size: .78rem;
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 640px) {
  td:has(details) { flex-direction: column; align-items: flex-start; }
}

/* ---- Docs page ---- */

.docs-layout { display: flex; gap: 2.5rem; align-items: flex-start; margin-top: 1.5rem; }

.docs-toc {
  position: sticky;
  top: 1.5rem;
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.docs-toc a {
  color: var(--text-muted);
  font-size: .85rem;
  padding: .4rem .6rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.docs-toc a:hover { background: var(--card-hover); color: var(--text); text-decoration: none; border-left-color: var(--primary); }

.docs-content { flex: 1; min-width: 0; max-width: 760px; }

.docs-content section { margin-bottom: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--border); }
.docs-content section:last-child { border-bottom: none; }

.docs-content h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.docs-content h4 { font-size: .88rem; font-weight: 700; color: var(--text-muted); margin: 1.25rem 0 .5rem; }

.docs-content p, .docs-content ul, .docs-content ol { line-height: 1.65; color: var(--text-muted); }
.docs-content p { margin: 0 0 .85rem; }
.docs-content ul, .docs-content ol { margin: 0 0 .85rem; padding-left: 1.25rem; }
.docs-content li { margin-bottom: .35rem; }

.docs-content strong { color: var(--text); }

.docs-content pre { margin: .5rem 0 1rem; font-size: .82rem; }

@media (max-width: 640px) {
  .docs-layout { flex-direction: column; gap: 1.25rem; max-width: 100%; }
  .docs-toc {
    position: static;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .35rem;
    padding-bottom: .5rem;
  }

  .docs-toc a { white-space: nowrap; flex-shrink: 0; }

  .docs-content { min-width: 0; max-width: 100%; }
}
