:root {
  --bg: #111111;
  --bg-elevated: rgba(26, 26, 26, 0.96);
  --bg-card: rgba(22, 22, 22, 0.94);
  --bg-hover: rgba(220, 38, 38, 0.12);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(220, 38, 38, 0.42);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #dc2626;
  --accent-hover: #ef4444;
  --accent-dark: #7f1d1d;
  --accent-glow: rgba(220, 38, 38, 0.35);
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  --discord: #5865f2;
  --steam: #1b2838;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Comfortaa', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 2px 16px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --topbar-h: 3.5rem;
  --dock-h: 4rem;
  --sidebar-w: 280px;
  --sidebar-w-collapsed: 72px;
  --touch-min: 44px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app-body {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-content-standalone {
  max-width: 32rem;
  margin: 0 auto;
  padding-top: 3rem;
}

.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;
}

/* ── Sidebar ── */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(18, 18, 18, 0.97);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 300;
  padding-top: env(safe-area-inset-top, 0px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0.85rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand { min-width: 0; }

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-collapse-btn svg { width: 1rem; height: 1rem; }

.sidebar-search {
  padding: 0.65rem 0.85rem;
  position: relative;
}

.input-search {
  width: 100%;
  font-size: 0.85rem;
}

.search-results {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  top: calc(100% - 0.25rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 16rem;
  overflow: auto;
  z-index: 400;
}

.search-hit {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.search-hit span {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.search-hit:hover { background: var(--bg-hover); text-decoration: none; }

.search-empty, .search-loading { padding: 0.75rem; font-size: 0.85rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
}

.sidebar-nav .nav-link {
  width: 100%;
}

.sidebar-roster {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  margin-top: 0.35rem;
}

.sidebar-roster-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
  padding: 0.65rem 0.85rem 0.35rem;
  font-weight: 600;
}

.roster-list {
  list-style: none;
  margin: 0;
  padding: 0 0.45rem 0.5rem;
  overflow: auto;
  flex: 1;
}

.roster-item { margin: 0; }

.roster-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
}

.roster-link:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }

.roster-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  flex-shrink: 0;
  object-fit: cover;
}

.roster-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
}

.roster-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.roster-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-sub {
  display: flex;
  gap: 0.45rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.roster-link-static {
  cursor: default;
}

.roster-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 2px;
  border: 2px solid transparent;
}

.roster-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  border: 2px solid rgba(18, 18, 18, 0.95);
}

.roster-level-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

/* Admin level colors: 1 green, 2 blue, 3 red, 4 dark red, 5 dark blue */
.roster-avatar-wrap.roster-level-1 { border-color: #4ade80; }
.roster-level-badge.roster-level-1 {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(74, 222, 128, 0.55);
}

.roster-avatar-wrap.roster-level-2 { border-color: #60a5fa; }
.roster-level-badge.roster-level-2 {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.55);
}

.roster-avatar-wrap.roster-level-3 { border-color: #ef4444; }
.roster-level-badge.roster-level-3 {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.55);
}

.roster-avatar-wrap.roster-level-4 { border-color: #991b1b; }
.roster-level-badge.roster-level-4 {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.45);
  border-color: #991b1b;
}

.roster-avatar-wrap.roster-level-5 { border-color: #1e40af; }
.roster-level-badge.roster-level-5 {
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.55);
  border-color: #1e3a8a;
}

.roster-avatar-wrap.roster-level-0 { border-color: var(--border); }
.roster-level-badge.roster-level-0 {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.roster-empty { padding: 0.5rem 0.85rem; font-size: 0.8rem; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
}

.sidebar-user:hover, .sidebar-user.active {
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--text);
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top));
  left: max(0.65rem, env(safe-area-inset-left));
  z-index: 250;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.95);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-mobile-toggle svg { width: 1.35rem; height: 1.35rem; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 290;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-roster,
body.sidebar-collapsed .sidebar-search,
body.sidebar-collapsed .sidebar-user-meta,
body.sidebar-collapsed .sidebar-footer .btn {
  display: none;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Breadcrumbs */
.breadcrumbs { margin-bottom: 0.85rem; }

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.breadcrumb-item:not(:last-child)::after {
  content: '›';
  margin-left: 0.5rem;
  opacity: 0.5;
}

.breadcrumb-item a { color: var(--muted); }
.breadcrumb-item a:hover { color: var(--accent-hover); }

/* Toasts */
.toast-stack {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 0.88rem;
  animation: fadeUp 0.25s ease both;
}

.toast-success { border-color: rgba(74, 222, 128, 0.45); }
.toast-error { border-color: rgba(248, 113, 113, 0.45); }
.toast-fade { opacity: 0; transform: translateY(-4px); transition: 0.35s ease; }

/* Dashboard alerts */
.dash-alerts { margin-bottom: 1rem; }

.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.alert-item-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--text);
}

.alert-item-warn { border-color: rgba(251, 191, 36, 0.35); }
.alert-item-danger { border-color: rgba(248, 113, 113, 0.35); }
.alert-item-info { border-color: rgba(220, 38, 38, 0.25); }

/* Notes */
.notes-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.note-body { margin: 0 0 0.35rem; white-space: pre-wrap; }
.note-meta { margin: 0; font-size: 0.78rem; }

.action-history-card { margin-top: 1rem; }

.action-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-history-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent);
}

.action-history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-history-title { font-size: 0.92rem; }

.action-history-time { font-size: 0.75rem; white-space: nowrap; }

.action-history-staff {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}

.action-history-reason,
.action-history-body {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
}

.action-history-body {
  white-space: pre-wrap;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}

.action-history-summary {
  margin: 0.45rem 0 0;
  font-family: var(--font);
  font-size: 0.82rem;
  white-space: pre-wrap;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0;
}

.staff-link-banner {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.alert-conflict {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #fde68a;
  margin-top: 0.75rem;
  max-width: 42rem;
}

.conflict-confirm {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.conflict-confirm-inline {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="light"] .alert-conflict {
  color: #92400e;
  background: rgba(234, 179, 8, 0.15);
}

[data-theme="light"] .conflict-confirm {
  background: rgba(234, 179, 8, 0.1);
  color: #78350f;
}

.badge-cop {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

.license-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.license-chip {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
  text-transform: capitalize;
}

.locker-card { margin-top: 0; }

.locker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.locker-panel h3 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.locker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.locker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.locker-item-name {
  min-width: 0;
  word-break: break-word;
}

.locker-item-qty {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent-hover);
}

@media (max-width: 700px) {
  .locker-grid { grid-template-columns: 1fr; }
}

.role-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.role-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.discord-role-name { display: block; font-weight: 600; }

.audit-details-formatted {
  margin: 0;
  font-family: var(--font);
  font-size: 0.82rem;
  white-space: pre-wrap;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 0;
}

.audit-action-raw {
  display: block;
  font-size: 0.68rem;
  margin-top: 0.15rem;
}

.audit-details-toggle summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-gate-form {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.field-hint { font-size: 0.8rem; margin: 0.35rem 0 0.75rem; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.field-full { grid-column: 1 / -1; }

.maintenance-card {
  margin-top: 3rem;
  text-align: center;
}

.btn-block { width: 100%; }

.row-muted { opacity: 0.65; }

.app-body:has(.mobile-dock) {
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 100% 60% at 50% -20%, rgba(220, 38, 38, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(17, 17, 17, 0.94) 0%, rgba(17, 17, 17, 0.98) 100%),
    url('https://thedarksidegames.com/img/cover.jpg') center / cover no-repeat fixed;
  background-blend-mode: normal, multiply, normal;
}

a { color: var(--accent-hover); text-decoration: none; transition: color var(--transition); }
a:hover { color: #fca5a5; text-decoration: none; }

::selection { background: rgba(220, 38, 38, 0.4); color: #fff; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
}

.page-content {
  animation: fadeUp 0.35s ease both;
  padding-bottom: 1rem;
}

.app-body:has(.mobile-dock) .page-content {
  padding-bottom: 0.5rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Topbar ── */

.topbar {
  background: rgba(20, 20, 20, 0.94);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  padding-top: env(safe-area-inset-top, 0px);
}

.nav-backdrop { display: none !important; }

.nav-toggle { display: none !important; }

.mobile-only { display: none !important; }

.topbar-account {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border-radius: 999px;
  border: 2px solid transparent;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-account.active {
  border-color: var(--accent);
}

.topbar-account .avatar {
  display: block;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand:hover { color: var(--text); }

.brand-logo {
  border-radius: 8px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name { font-size: 0.95rem; }
.brand-tag { font-size: 0.65rem; color: var(--muted); font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; }

.nav-desktop {
  display: flex;
  gap: 0.15rem;
  flex: 1;
  align-items: center;
}

.nav-links {
  display: contents;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
  min-height: 2.25rem;
}

.nav-icon { width: 1.05rem; height: 1.05rem; opacity: 0.8; flex-shrink: 0; }

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
  background: rgba(220, 38, 38, 0.16);
  border-color: rgba(220, 38, 38, 0.35);
}

.nav-link.active .nav-icon { opacity: 1; }

.user-menu-desktop {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.account-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.account-link:hover, .account-link.active {
  color: var(--text);
  background: var(--bg-hover);
}

.avatar {
  border-radius: 50%;
  border: 2px solid var(--border);
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  font-size: 0.7rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.role-badge-root {
  background: rgba(220, 38, 38, 0.2);
  border-color: #ef4444;
  color: #fecaca;
}

/* ── Page layout ── */

.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header .muted { font-size: 0.92rem; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.back-link:hover { color: var(--accent-hover); }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.85em; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; color: #fca5a5; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Hero / dashboard ── */

.hero-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(32, 32, 32, 0.65), rgba(220, 38, 38, 0.12));
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hover);
  font-weight: 600;
}

.hero-title {
  margin: 0 0 0.5rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-sub { margin: 0; color: var(--muted); font-size: 0.92rem; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  position: relative;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  padding: 0.75rem 1.25rem;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.stat-chip:hover {
  border-color: var(--accent);
  background: rgba(220, 38, 38, 0.1);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* ── Cards ── */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h2::before {
  content: '';
  width: 3px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.card-intro {
  margin: -0.5rem 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.card-intro code {
  font-size: 0.82em;
  color: var(--accent-hover);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.card-link:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), 0 0 24px var(--accent-glow);
  text-decoration: none;
  color: inherit;
}

.dash-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.dash-card h2 { margin: 0 0 0.35rem; }
.dash-card h2::before { display: none; }
.dash-card p { margin: 0; font-size: 0.88rem; color: var(--muted); line-height: 1.45; }

.dash-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.dash-card-icon svg { width: 22px; height: 22px; }

.dash-card-icon-players { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.dash-card-icon-vehicles { background: rgba(220, 38, 38, 0.15); color: #f87171; }
.dash-card-icon-audit { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.dash-card-icon-account { background: rgba(220, 38, 38, 0.18); color: var(--accent-hover); }
.dash-card-icon-settings { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.dash-card-icon-leaderboards { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }

.dash-card-arrow {
  font-size: 1.25rem;
  color: var(--muted);
  transition: transform var(--transition), color var(--transition);
}

.card-link:hover .dash-card-arrow {
  transform: translateX(4px);
  color: var(--accent-hover);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.dash-leaderboards {
  margin-bottom: 1.25rem;
}

.dash-leaderboards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-leaderboards-head h2 {
  margin: 0;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.leaderboard-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0;
}

.leaderboard-panel h2,
.leaderboard-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.leaderboard-panel-compact {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.leaderboard-panel-compact h3 {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-sm);
}

.leaderboard-list-compact .leaderboard-row {
  grid-template-columns: 1.25rem 1fr auto;
  gap: 0.35rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.leaderboard-row-top1 { background: rgba(251, 191, 36, 0.12); }
.leaderboard-row-top2 { background: rgba(148, 163, 184, 0.12); }
.leaderboard-row-top3 { background: rgba(180, 83, 9, 0.12); }

.leaderboard-rank {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.leaderboard-row-top1 .leaderboard-rank { color: #fbbf24; }
.leaderboard-row-top2 .leaderboard-rank { color: #94a3b8; }
.leaderboard-row-top3 .leaderboard-rank { color: #d97706; }

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.leaderboard-name {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-name:hover {
  color: var(--accent-hover);
}

.leaderboard-staff {
  flex-shrink: 0;
  font-size: 0.7rem;
}

.leaderboard-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  white-space: nowrap;
}

.nav-link-sub {
  padding-left: 2.35rem;
  font-size: 0.88rem;
}

.nav-link-sub .nav-icon {
  width: 18px;
  height: 18px;
}

.card-accent {
  border-color: rgba(220, 38, 38, 0.5);
  background: linear-gradient(145deg, rgba(32, 32, 32, 0.7), rgba(220, 38, 38, 0.08));
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.dl-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.55rem 1rem;
  margin: 0;
}

.dl-grid dt { color: var(--muted); margin: 0; font-size: 0.88rem; }
.dl-grid dd { margin: 0; }

/* ── Toolbar / filters ── */

.filter-panel {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.toolbar-wrap { align-items: flex-end; }

/* ── Forms ── */

.input, .select, .textarea {
  background: rgba(20, 20, 20, 0.65);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.input[type="search"] { min-width: 200px; }
.select { min-width: 140px; cursor: pointer; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

/* Custom checkbox rows (filters) */
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-size: 0.9rem;
  min-height: var(--touch-min);
}

.check-row-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.check-row-box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(17, 17, 17, 0.7);
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

.check-row-box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}

.check-row-input:checked + .check-row-box {
  background: var(--accent);
  border-color: var(--accent);
}

.check-row-input:checked + .check-row-box::after {
  transform: rotate(45deg) scale(1);
}

.toolbar-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  width: 100%;
}

.mobile-sort-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: 100%;
}

.field-label-inline {
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.85rem;
}

.field-label-inline .select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  text-transform: none;
  font-weight: 400;
}

.audit-staff-name { display: block; font-weight: 600; }
.audit-staff-id { display: block; font-size: 0.75rem; margin-top: 0.15rem; }
.audit-action { font-size: 0.82rem; word-break: break-word; }

.btn-block-mobile { width: auto; }

.field-label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-label .input, .field-label .select, .field-label .textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.textarea { resize: vertical; min-height: 80px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.form-grid .input { width: 100%; }
.form-actions { margin-top: 0.75rem; }

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: rgba(220, 38, 38, 0.22);
  border-color: var(--border-strong);
  text-decoration: none;
  color: var(--text);
}

.btn:active { transform: scale(0.98); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 1.25rem; height: 1.25rem; }

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(145deg, var(--accent-hover), var(--accent));
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-danger { background: rgba(231, 76, 60, 0.15); border-color: rgba(231, 76, 60, 0.5); color: #ffb4ad; }
.btn-danger:hover { background: rgba(231, 76, 60, 0.28); color: #ffc9c4; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-discord { background: var(--discord); border-color: var(--discord); color: #fff; }
.btn-discord:hover { filter: brightness(1.1); color: #fff; }

.btn-steam { background: var(--steam); border-color: #2a475e; color: #c7d5e0; }
.btn-steam:hover { background: #2a475e; color: #fff; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.inline-form { display: inline; }

/* ── Tables ── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.table-wrap-nested {
  margin-top: 1.5rem;
  border: none;
  background: transparent;
  box-shadow: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th, .data-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(20, 20, 20, 0.5);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table-compact { font-size: 0.8rem; }

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover { color: var(--text); background: var(--bg-hover); }

th.sortable::after {
  content: '';
  display: inline-block;
  width: 0.65rem;
  margin-left: 0.25rem;
  opacity: 0.35;
}

th.sortable.sort-asc::after { content: '▲'; opacity: 1; color: var(--accent); }
th.sortable.sort-desc::after { content: '▼'; opacity: 1; color: var(--accent); }

.data-table.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s;
}

.row-warn td { background: rgba(241, 196, 15, 0.05); }
.empty { text-align: center; color: var(--muted); padding: 2.5rem !important; }

/* ── Badges & alerts ── */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-ok { background: rgba(46, 204, 113, 0.15); color: var(--ok); }
.badge-warn { background: rgba(241, 196, 15, 0.15); color: var(--warn); }
.badge-danger { background: rgba(231, 76, 60, 0.15); color: #ff8a7f; }

.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  transition: opacity 0.4s, transform 0.4s;
}

.alert-fade { opacity: 0; transform: translateY(-4px); }
.alert-success { background: rgba(46, 204, 113, 0.1); border-color: rgba(46, 204, 113, 0.35); color: #a9dfbf; }
.alert-error { background: rgba(231, 76, 60, 0.1); border-color: rgba(231, 76, 60, 0.35); color: #ffb4ad; }

/* ── Settings / Discord roles ── */

.settings-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
}

.settings-tab {
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.settings-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.settings-tab.active {
  color: var(--text);
  background: rgba(220, 38, 38, 0.2);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.settings-panel { animation: fadeUp 0.25s ease both; }

.settings-form .card { margin-bottom: 1rem; }
.discord-roles-card { margin-bottom: 1.5rem; }
.dl-grid-compact { margin-bottom: 1rem; }

.discord-role-form-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.discord-role-form-wrap h3 { margin: 0 0 1rem; font-size: 1rem; font-weight: 700; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.perm-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0 0 1rem;
}

.perm-fieldset legend { padding: 0 0.35rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.55rem;
}

/* Custom permission tiles (no native checkbox chrome) */
.perm-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.perm-tile:hover {
  border-color: var(--border-strong);
  background: rgba(220, 38, 38, 0.04);
}

.perm-tile.is-checked,
.perm-tile:has(.perm-tile-input:checked) {
  border-color: var(--accent);
  background: rgba(220, 38, 38, 0.12);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.perm-tile-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.perm-tile-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 0.1rem;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: rgba(20, 20, 20, 0.6);
  display: grid;
  place-items: center;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.perm-tile-icon {
  width: 12px;
  height: 10px;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.perm-tile.is-checked .perm-tile-mark,
.perm-tile:has(.perm-tile-input:checked) .perm-tile-mark {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  border-color: var(--accent);
}

.perm-tile.is-checked .perm-tile-icon,
.perm-tile:has(.perm-tile-input:checked) .perm-tile-icon {
  opacity: 1;
  transform: scale(1);
}

.perm-tile-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.perm-tile-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.perm-code {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.perm-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.perm-cell { vertical-align: middle; }

.perm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.perm-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--mono);
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  line-height: 1.4;
}

/* Role map table — keep actions column aligned */
.role-map-table .col-actions {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
}

.role-map-table .col-label,
.role-map-table .col-role-id {
  vertical-align: middle;
}

.role-map-table .perm-cell {
  vertical-align: middle;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.row-actions .inline-form {
  display: inline-flex;
  margin: 0;
}

.row-actions .btn {
  margin: 0;
}

.perm-list { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; }
.perm-list code { font-size: 0.8rem; color: #fca5a5; }

/* Player profile vehicles */
.player-vehicles-card { margin-bottom: 0; }

.empty-inline {
  margin: 0;
  padding: 0.5rem 0;
}

.vehicle-status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

@media (max-width: 768px) {
  .vehicle-status-cell {
    justify-content: flex-end;
  }

  .data-table-cards .vehicle-status-cell {
    justify-content: flex-start;
  }
}

/* ── Login ── */

.login-page {
  min-height: calc(100dvh - 5rem);
  display: grid;
  place-items: center;
  padding: 1.5rem max(1.25rem, env(safe-area-inset-right)) 2rem max(1.25rem, env(safe-area-inset-left));
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 4px);
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 60px rgba(220, 38, 38, 0.12);
}

.login-card-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.login-logo {
  width: 100px;
  height: auto;
  margin: 0 auto 1.25rem;
  display: block;
  position: relative;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; position: relative; }
.login-tagline { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.92rem; position: relative; }
.login-foot { margin-top: 1.25rem; font-size: 0.85rem; position: relative; }

.login-site-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  position: relative;
}

.login-site-link:hover { color: var(--accent-hover); }

/* ── Error page ── */

.error-page {
  display: grid;
  place-items: center;
  min-height: 50vh;
  padding: 2rem 0;
}

.error-card {
  text-align: center;
  max-width: 420px;
  padding: 2.5rem 2rem;
}

.error-code {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-card h1 { margin: 0 0 0.75rem; font-size: 1.35rem; }
.error-card p { margin: 0 0 1.5rem; }

/* ── Misc ── */

.comp-form {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.comp-form:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.comp-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.comp-form .input { width: 100%; margin-bottom: 0.5rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.5rem 0;
}

.page-info { color: var(--muted); font-size: 0.88rem; }

.json-preview {
  margin: 0;
  max-width: 360px;
  max-height: 120px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  background: rgba(20, 20, 20, 0.6);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

.details-cell { max-width: 380px; }

.mobile-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 180;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(20, 20, 20, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  justify-content: space-around;
  align-items: stretch;
}

.dock-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  min-height: var(--touch-min);
  padding: 0.35rem 0.25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color var(--transition), background var(--transition);
}

.dock-link svg {
  width: 1.35rem;
  height: 1.35rem;
  opacity: 0.75;
}

.dock-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.dock-link.active {
  color: var(--accent-hover);
  background: rgba(220, 38, 38, 0.1);
}

.dock-link.active svg { opacity: 1; }

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Responsive (mobile-first overrides) ── */

@media (max-width: 900px) {
  .user-name { display: none; }
}

@media (max-width: 768px) {
  .mobile-only { display: flex !important; }

  .mobile-sort-bar.mobile-only { display: grid !important; }

  .topbar-account { display: flex !important; }

  .mobile-dock { display: flex; }

  .nav-desktop,
  .user-menu-desktop { display: none !important; }

  .brand-tag { display: none; }

  .page-header h1 { font-size: 1.35rem; }
  .page-header { margin-bottom: 1rem; }

  .hero-card {
    padding: 1.15rem;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1rem;
  }

  .hero-title { font-size: 1.4rem; }

  .stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 0.5rem;
  }

  .stat-chip {
    min-width: 0;
    padding: 0.6rem 0.35rem;
  }

  .stat-value { font-size: 1.05rem; }
  .stat-label { font-size: 0.62rem; }

  .dash-links-desktop { display: none !important; }

  .detail-grid { grid-template-columns: 1fr; }

  .filter-panel { padding: 0.85rem; }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }

  .toolbar-search-row .input {
    width: 100%;
    min-width: 0;
  }

  .toolbar-search-row .btn {
    width: auto;
    min-width: 5.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .toolbar .input,
  .toolbar .select {
    width: 100%;
    min-width: 0;
  }

  .toolbar .btn:not(.toolbar-search-row .btn) {
    width: 100%;
    min-height: var(--touch-min);
  }

  .check-row { width: 100%; }

  .input, .select, .textarea {
    font-size: 16px;
    min-height: var(--touch-min);
  }

  .btn {
    min-height: var(--touch-min);
  }

  .btn-block-mobile {
    width: 100%;
    justify-content: center;
  }

  .form-row,
  .form-grid { grid-template-columns: 1fr; }

  .dl-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .dl-grid dt {
    margin-top: 0.65rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .dl-grid dt:first-child { margin-top: 0; }

  /* Card-style tables — no horizontal scroll */
  .table-wrap:has(.data-table-cards) {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .data-table-cards thead { display: none; }

  .data-table-cards tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .data-table-cards tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
  }

  .data-table-cards tr.row-warn {
    border-color: rgba(255, 202, 40, 0.35);
    background: rgba(255, 202, 40, 0.04);
  }

  .data-table-cards td {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.3rem 0;
    border: none;
    text-align: left !important;
  }

  .data-table-cards td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .data-table-cards td.col-extra { display: none; }

  .data-table-cards td.col-id { display: none; }

  .data-table-cards td.col-action,
  .data-table-cards td.cell-action {
    display: block;
    padding-top: 0.65rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--border);
  }

  .data-table-cards td.cell-action::before,
  .data-table-cards td.col-action::before { display: none; }

  .data-table-cards td.empty {
    display: block;
    text-align: center;
    padding: 1.5rem;
  }

  .data-table-cards td.empty::before { display: none; }

  .data-table-cards td.cell-highlight {
    font-size: 1.05rem;
  }

  .data-table-cards td.cell-highlight.money {
    font-size: 1.15rem;
  }

  .data-table-cards .audit-staff-id { display: none; }

  .pagination {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .pagination .btn {
    flex: 1;
    min-width: 7rem;
  }

  .settings-tabs {
    width: 100%;
    display: flex;
  }

  .settings-tab {
    flex: 1;
    text-align: center;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .perm-grid { grid-template-columns: 1fr; }

  .row-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .row-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .role-map-table .col-actions {
    width: auto;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.85rem max(0.85rem, env(safe-area-inset-right)) 1.25rem max(0.85rem, env(safe-area-inset-left));
  }

  .brand-name { font-size: 0.88rem; }
  .brand-logo { width: 32px; height: 32px; }

  .card { padding: 1rem; }

  .dock-link span { font-size: 0.58rem; }

  .stat-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .mobile-only { display: flex !important; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-collapse-btn { display: none; }

  .app-main .page-content {
    padding-top: calc(var(--touch-min) + 1rem);
  }

  .topbar,
  .mobile-dock,
  .nav-desktop,
  .user-menu-desktop { display: none !important; }
}

@media (hover: none) {
  .card-link:hover,
  .stat-chip:hover {
    transform: none;
  }
}

/* Live list refresh */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.live-indicator.live-pulse .live-dot {
  animation: livePulse 0.6s ease;
}

@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

.data-table.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

/* Quick actions */
.quick-actions-card { margin-bottom: 1rem; }

.quick-actions-grid {
  display: grid;
  gap: 0.65rem;
}

.quick-action-form {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.quick-action-label {
  font-size: 0.88rem;
  font-weight: 600;
}

@media (max-width: 700px) {
  .quick-action-form {
    grid-template-columns: 1fr;
  }
}

.theme-toggle { margin-bottom: 0.25rem; }

/* Light theme */
[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --bg-card: #ffffff;
  --bg-hover: rgba(220, 38, 38, 0.08);
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(220, 38, 38, 0.35);
  --text: #111827;
  --muted: #6b7280;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body::before {
  opacity: 0.35;
  background-blend-mode: normal, soft-light, normal;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.98);
}

[data-theme="light"] .card,
[data-theme="light"] .data-table-cards tr {
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .input,
[data-theme="light"] .select,
[data-theme="light"] .textarea {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

[data-theme="light"] .license-chip {
  color: #166534;
  background: rgba(34, 197, 94, 0.12);
}

[data-theme="light"] .badge-cop {
  color: #1e40af;
}
