/* ==========================================================================
   Transport Tycoon — Admin Console
   Hand-written dark theme. Fully usable without Tailwind CDN.
   ========================================================================== */

.render-pending { position: relative; min-height: 240px; isolation: isolate; }
.render-pending::after { content: ''; position: absolute; inset: 0; z-index: 80; border-radius: 12px; background: rgba(15,23,42,.94); }
.render-pending::before { content: attr(data-loading-label); position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 81; color: #22d3ee; font-weight: 600; padding: 20px; border-top: 3px solid #22d3ee; border-radius: 12px; background: #1f2937; }

/* Users: approved tools panel, independent of the optional Tailwind CDN. */
.admin-users-page .card { padding: 24px; border: 1px solid #374151; border-radius: 12px; background: #1f2937; }
.admin-users-page .card-head { padding: 0 0 20px; }
.admin-users-page .card-foot { padding: 20px 0 0; }
.admin-users-page .cell-main { font-weight: 600; }
.admin-users-page tr.clickable:hover { background: #374151; }
.admin-users-page .pagination .btn { padding: 10px 18px; min-height: 42px; }
.admin-users-page .toolbar-group { flex-wrap: wrap; }
@media (max-width: 640px) {
  .admin-users-page .card { padding: 16px; }
  .admin-users-page .pagination-bar { gap: 12px; flex-wrap: wrap; }
}

:root {
  --bg: #0b1220;
  --bg-deep: #070d18;
  --bg-soft: #0e1728;
  --panel: #121c2e;
  --panel-2: #162238;
  --panel-3: #1a2842;
  --border: #22314c;
  --border-soft: #1a2740;
  --text: #e7eefb;
  --text-soft: #c3d1e6;
  --muted: #8ba0bf;
  --dim: #677c9b;
  --accent: #22d3ee;
  --accent-deep: #0891b2;
  --emerald: #34d399;
  --emerald-deep: #059669;
  --danger: #f87171;
  --danger-deep: #b91c1c;
  --amber: #fbbf24;
  --amber-deep: #b45309;
  --violet: #a78bfa;
  --pink: #f472b6;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .75);
  --shadow-soft: 0 8px 24px -16px rgba(0, 0, 0, .7);
  --sidebar-w: 260px;
  --topbar-h: 72px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(34, 211, 238, .09), transparent 60%),
    radial-gradient(900px 600px at -10% 40%, rgba(52, 211, 153, .055), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }
body.no-scroll { overflow: hidden; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: rgba(34, 211, 238, .28); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: #2c3f5e transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3c59; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a5277; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-word { overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.eyebrow {
  color: var(--accent); text-transform: uppercase; letter-spacing: .14em;
  font-size: 10.5px; font-weight: 700;
}

/* --------------------------------------------------------------------------
   Screens & authentication
   -------------------------------------------------------------------------- */
.screen { min-height: 100vh; }
.center-screen {
  display: flex; align-items: center; justify-content: center;
  padding: 28px; min-height: 60vh;
}
#boot-screen, #login-screen, #unauthorized-screen { min-height: 100vh; }

.boot-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 42px 46px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 300px;
}
.boot-text { color: var(--muted); font-size: 13px; }

.auth-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, rgba(22, 34, 56, .96), rgba(18, 28, 46, .98));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .03);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--emerald), transparent);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.auth-brand h1 { font-size: 23px; margin-top: 2px; }
.auth-copy { font-size: 13.5px; margin-bottom: 20px; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12.5px; }
.auth-actions { display: flex; gap: 10px; margin-top: 20px; }
.auth-actions .btn { flex: 1; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 62px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 650; padding: 5px 7px; border-radius: 6px;
}
.password-toggle:hover { color: var(--accent); background: rgba(34, 211, 238, .08); }

.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: -.03em;
  color: #04222a;
  background: linear-gradient(135deg, var(--accent), var(--emerald));
  box-shadow: 0 8px 20px -8px rgba(34, 211, 238, .65);
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 17px; border-radius: 14px; }

/* --------------------------------------------------------------------------
   App layout
   -------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; position: relative; }
.app-shell::before {
  content: ""; position: fixed; inset: 0; z-index: 39;
  background: rgba(3, 7, 15, .66); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, #0d1626 0%, #0a1220 100%);
  border-right: 1px solid var(--border-soft);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; font-weight: 650; }

.side-nav {
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto; flex: 1 1 auto; padding: 4px 0 14px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--muted); font-size: 13.5px; font-weight: 550;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  position: relative; white-space: nowrap;
}
.nav-link:hover { background: rgba(255, 255, 255, .035); color: var(--text); text-decoration: none; }
.nav-link .icon { color: var(--dim); transition: color .15s; }
.nav-link:hover .icon { color: var(--text-soft); }
.nav-link.is-active {
  background: linear-gradient(90deg, rgba(34, 211, 238, .14), rgba(34, 211, 238, .03));
  border-color: rgba(34, 211, 238, .22); color: #d9fbff;
}
.nav-link.is-active .icon { color: var(--accent); }
.nav-link.is-active::before {
  content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 2px;
  border-radius: 2px; background: var(--accent);
}
.sidebar-foot { border-top: 1px solid var(--border-soft); padding-top: 13px; display: grid; gap: 10px; }
.sidebar-status {
  display: flex; align-items: center; gap: 7px; padding: 2px 6px;
  color: var(--dim); font-size: 11px;
}
.sidebar-version { margin-left: auto; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.status-dot.ok { background: var(--emerald); box-shadow: 0 0 0 3px rgba(52, 211, 153, .14); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(251, 191, 36, .14); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, .14); }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
  background: rgba(11, 18, 32, .84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-menu { display: none; }
.topbar-heading { min-width: 0; flex: 1 1 auto; }
.topbar-heading h1 {
  font-size: 19px; line-height: 1.2; font-weight: 680;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-heading p {
  color: var(--muted); font-size: 11.8px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-meta { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.signed-in { color: var(--muted); font-size: 12px; white-space: nowrap; }
.signed-in strong { color: var(--text-soft); font-weight: 650; }
.clock {
  font-family: var(--mono); font-size: 12px; color: var(--text-soft);
  font-variant-numeric: tabular-nums; padding: 6px 9px;
  border: 1px solid var(--border-soft); border-radius: 7px;
  background: rgba(255, 255, 255, .02); white-space: nowrap;
}
.topbar-game { display: inline-flex; }

.health-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--border-soft); background: rgba(255, 255, 255, .02);
  color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.health-pill.ok { color: #b5f7df; border-color: rgba(52, 211, 153, .28); background: rgba(52, 211, 153, .07); }
.health-pill.ok .health-dot { background: var(--emerald); box-shadow: 0 0 0 3px rgba(52, 211, 153, .16); }
.health-pill.degraded { color: #fde68a; border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .07); }
.health-pill.degraded .health-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(251, 191, 36, .16); }
.health-pill.down { color: #fecaca; border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .08); }
.health-pill.down .health-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, .16); }

.mobile-nav-wrap {
  display: none; position: sticky; top: var(--topbar-h); z-index: 25;
  background: rgba(11, 18, 32, .95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.mobile-nav {
  display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.mobile-nav::-webkit-scrollbar { display: none; }
.mobile-nav .nav-link {
  padding: 7px 12px; font-size: 12.5px; flex: 0 0 auto;
  border: 1px solid var(--border-soft); background: rgba(255, 255, 255, .015);
}
.mobile-nav .nav-link .icon { width: 15px; height: 15px; }
.mobile-nav .nav-link.is-active::before { display: none; }

.view { padding: 26px 28px 60px; width: 100%; max-width: 1640px; margin: 0 auto; outline: none; }
.page { display: flex; flex-direction: column; gap: 20px; animation: fade-up .25s ease both; }
.page-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px;
}
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar-sep { width: 1px; height: 22px; background: var(--border); }
.section-title { font-size: 16px; font-weight: 660; }
.section-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.dash-columns { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(22, 34, 56, .62), rgba(18, 28, 46, .92));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .012);
}
.card-head h2 { font-size: 14.5px; font-weight: 660; }
.card-head .section-sub { margin-top: 3px; }
.card-body { padding: 20px; }
.card-body-tight { padding: 14px 16px; }
.card-body-flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); background: rgba(0, 0, 0, .14); }
.card-hover { transition: border-color .15s, transform .15s; }
.card-hover:hover { border-color: #2c4468; }

.panel-note {
  border: 1px dashed var(--border);
  background: rgba(34, 211, 238, .035);
  border-radius: var(--radius);
  padding: 13px 15px;
  color: var(--muted);
  font-size: 12.5px;
}
.panel-note strong { color: var(--text-soft); }
.note {
  color: var(--muted); font-size: 12px; line-height: 1.55;
  background: rgba(255, 255, 255, .018);
  border: 1px solid var(--border-soft);
  border-radius: 9px; padding: 10px 12px;
}
.note code { color: var(--accent); font-family: var(--mono); font-size: 11.5px; }

/* --------------------------------------------------------------------------
   KPI cards
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
  gap: 12px;
}
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(22, 34, 56, .78), rgba(18, 28, 46, .96));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px 14px;
  min-height: 104px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-soft);
}
.kpi::after {
  content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -55px;
  border-radius: 50%; background: radial-gradient(circle, var(--kpi-glow, rgba(34, 211, 238, .16)), transparent 70%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.kpi-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--kpi-bg, rgba(34, 211, 238, .1)); color: var(--kpi-color, var(--accent));
}
.kpi-icon .icon { width: 15px; height: 15px; }
.kpi-value {
  font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.kpi-sub { color: var(--dim); font-size: 11.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi.tone-emerald { --kpi-color: var(--emerald); --kpi-bg: rgba(52, 211, 153, .1); --kpi-glow: rgba(52, 211, 153, .17); }
.kpi.tone-amber { --kpi-color: var(--amber); --kpi-bg: rgba(251, 191, 36, .1); --kpi-glow: rgba(251, 191, 36, .15); }
.kpi.tone-danger { --kpi-color: var(--danger); --kpi-bg: rgba(248, 113, 113, .1); --kpi-glow: rgba(248, 113, 113, .15); }
.kpi.tone-violet { --kpi-color: var(--violet); --kpi-bg: rgba(167, 139, 250, .1); --kpi-glow: rgba(167, 139, 250, .15); }

.kpi.is-loading .kpi-value { color: transparent; background: linear-gradient(90deg, #1b2942, #26395a, #1b2942); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 5px; width: 70%; }
.kpi.is-loading .kpi-sub { color: transparent; background: #1b2942; border-radius: 4px; width: 45%; }

/* --------------------------------------------------------------------------
   Buttons & form controls
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--text-soft);
  font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn .icon { width: 15px; height: 15px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.2px; border-radius: 8px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(180deg, #2ad8f2, #16bad8); color: #04222a;
  border-color: rgba(34, 211, 238, .5);
  box-shadow: 0 10px 22px -14px rgba(34, 211, 238, .85);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #57e3f8, #22c8e4); }
.btn-emerald { background: linear-gradient(180deg, #43dfab, #22c58b); color: #052a20; border-color: rgba(52, 211, 153, .5); }
.btn-emerald:hover:not(:disabled) { background: linear-gradient(180deg, #66e9bd, #34d399); }
.btn-danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .34); color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, .2); color: #fff; }
.btn-danger-solid { background: linear-gradient(180deg, #f87171, #dc2626); color: #fff; border-color: rgba(248, 113, 113, .5); }
.btn-danger-solid:hover:not(:disabled) { background: linear-gradient(180deg, #fb9090, #ef4444); }
.btn-amber { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .32); color: #fde68a; }
.btn-amber:hover:not(:disabled) { background: rgba(251, 191, 36, .2); color: #fff8dd; }
.btn-ghost { border-color: var(--border); background: rgba(255, 255, 255, .025); color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); border-color: #31486d; color: var(--text); }
.btn-subtle { color: var(--muted); }
.btn-subtle:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .045); }
.btn-link { height: auto; padding: 0; color: var(--accent); }
.btn-link:hover { text-decoration: underline; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .02); color: var(--muted);
  display: inline-grid; place-items: center; flex: 0 0 auto;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); border-color: #31486d; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn .icon { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { color: var(--text-soft); font-size: 12px; font-weight: 600; }
.field .hint { color: var(--dim); font-size: 11.5px; line-height: 1.4; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 9px 11px;
  background: #0d1729; color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; line-height: 1.35;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { resize: vertical; min-height: 88px; font-family: var(--font); }
.input:hover, .select:hover, .textarea:hover { border-color: #2c4468; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: rgba(34, 211, 238, .65);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .13);
  background: #0f1b2e;
}
.input::placeholder, .textarea::placeholder { color: #526686; }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }
.input-sm, .select-sm { min-height: 32px; padding: 6px 9px; font-size: 12.2px; border-radius: 8px; }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238ba0bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}
.input[type="number"] { font-variant-numeric: tabular-nums; }
.input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
textarea.input { min-height: 80px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2, .form-grid-3 .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto;
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.check-row {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 9px 11px; border: 1px solid var(--border-soft); border-radius: 9px;
  background: rgba(255, 255, 255, .012);
  transition: border-color .15s, background .15s;
}
.check-row:hover { border-color: #2c4468; background: rgba(255, 255, 255, .03); }
.check-row input { margin-top: 1px; }
.check-text { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }
.check-text strong { font-weight: 600; color: var(--text-soft); }
.check-text .hint { color: var(--dim); font-size: 11.5px; }

.switch-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; }
.switch-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  width: 36px; height: 20px; border-radius: 99px; background: #26364f;
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #b9c8dd; top: 3px; left: 3px; transition: transform .18s, background .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.switch-label input:checked + .switch { background: rgba(52, 211, 153, .75); }
.switch-label input:checked + .switch::after { transform: translateX(16px); background: #fff; }
.switch-label input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.search-box { position: relative; min-width: 220px; }
.search-box .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--dim); pointer-events: none;
}
.search-box .input { padding-left: 33px; }

.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-group .btn { border-radius: 0 9px 9px 0; height: auto; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%; overflow: auto; position: relative;
  border: 1px solid var(--border-soft); border-radius: 11px;
  background: rgba(9, 16, 28, .35);
}
.table-wrap.flush { border: 0; border-radius: 0; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }
.data-table th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; white-space: nowrap;
  padding: 10px 13px;
  background: #162238;
  color: var(--muted);
  font-size: 10.6px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 13px; border-bottom: 1px solid var(--border-soft);
  vertical-align: middle; color: var(--text-soft);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: rgba(255, 255, 255, .028); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover td { background: rgba(34, 211, 238, .045); }
.data-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.data-table .cell-main { color: var(--text); font-weight: 600; }
.data-table .cell-sub { color: var(--dim); font-size: 11.3px; margin-top: 1px; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.actions { text-align: right; white-space: nowrap; }
.data-table .row-actions { display: inline-flex; gap: 5px; justify-content: flex-end; }
.data-table.compact td { padding: 7px 10px; }
.data-table.compact th { padding: 8px 10px; }

.cell-avatar { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 750; letter-spacing: -.03em;
  color: #d6fbff; background: linear-gradient(135deg, #164e63, #0f766e);
  border: 1px solid rgba(34, 211, 238, .25);
}
.avatar-lg { width: 46px; height: 46px; border-radius: 12px; font-size: 15px; }
.avatar-sm { width: 22px; height: 22px; border-radius: 6px; font-size: 9px; }

.empty {
  padding: 38px 20px; text-align: center; color: var(--dim); font-size: 12.5px;
}
.empty.tall { padding: 62px 20px; }
.empty strong { display: block; color: var(--muted); font-size: 13.5px; margin-bottom: 4px; }

.pagination-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 4px 0;
}
.pagination { display: flex; align-items: center; gap: 6px; }
.page-info { color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------------------
   Badges, alerts, status
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 7px; border-radius: 6px;
  font-size: 10.6px; font-weight: 650; letter-spacing: .015em; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.4;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: rgba(139, 160, 191, .1); color: #b9c8dd; border-color: rgba(139, 160, 191, .2); }
.badge-cyan { background: rgba(34, 211, 238, .1); color: #a5f3fc; border-color: rgba(34, 211, 238, .25); }
.badge-emerald { background: rgba(52, 211, 153, .1); color: #a7f3d0; border-color: rgba(52, 211, 153, .25); }
.badge-amber { background: rgba(251, 191, 36, .1); color: #fde68a; border-color: rgba(251, 191, 36, .25); }
.badge-danger { background: rgba(248, 113, 113, .1); color: #fecaca; border-color: rgba(248, 113, 113, .25); }
.badge-violet { background: rgba(167, 139, 250, .1); color: #ddd6fe; border-color: rgba(167, 139, 250, .25); }
.badge-pink { background: rgba(244, 114, 182, .1); color: #fbcfe8; border-color: rgba(244, 114, 182, .25); }
.badge-outline { background: transparent; border-color: var(--border); color: var(--muted); }
.badges { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.alert {
  padding: 12px 14px; border-radius: 10px; font-size: 12.8px; line-height: 1.5;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025); color: var(--text-soft);
}
.alert strong { color: var(--text); }
.alert-danger { border-color: rgba(248, 113, 113, .38); background: rgba(248, 113, 113, .08); color: #fecaca; }
.alert-warning { border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .07); color: #fde68a; }
.alert-success { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .07); color: #a7f3d0; }
.alert-info { border-color: rgba(34, 211, 238, .32); background: rgba(34, 211, 238, .06); color: #a5f3fc; }
.alert + .alert { margin-top: 10px; }

.status-list { display: flex; flex-direction: column; }
.status-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 12.8px;
}
.status-row:last-child { border-bottom: 0; }
.status-row .label { color: var(--muted); }
.status-row .value { color: var(--text-soft); font-weight: 600; text-align: right; }
.status-ok { color: var(--emerald); }
.status-bad { color: var(--danger); }
.status-warn { color: var(--amber); }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; margin: 0 -2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-size: 12.8px; font-weight: 600;
  padding: 10px 12px; white-space: nowrap; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text-soft); }
.tab-btn.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { padding-top: 18px; }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(3, 7, 15, .74);
  backdrop-filter: blur(5px);
  animation: fade-in .16s ease both;
}
.modal {
  width: min(680px, 100%); max-height: min(90vh, 1000px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #152136, #101a2b);
  border: 1px solid #2a3d5d; border-radius: 16px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .04);
  animation: modal-in .2s cubic-bezier(.2, .8, .2, 1) both;
  overflow: hidden;
}
.modal-sm { width: min(440px, 100%); }
.modal-md { width: min(680px, 100%); }
.modal-lg { width: min(880px, 100%); }
.modal-xl { width: min(1120px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 17px 20px; border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .015);
  flex: 0 0 auto;
}
.modal-head h2 { font-size: 16px; font-weight: 660; overflow-wrap: anywhere; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, .16); flex: 0 0 auto; flex-wrap: wrap;
}
.modal-loading { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 50px 20px; color: var(--muted); }
.confirm-text { color: var(--text-soft); font-size: 13.5px; line-height: 1.6; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  display: flex; flex-direction: column; gap: 9px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 13px; border-radius: 11px;
  background: #162238; border: 1px solid var(--border);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8);
  color: var(--text-soft); font-size: 12.8px; line-height: 1.45;
  pointer-events: auto;
  animation: toast-in .22s cubic-bezier(.2, .8, .2, 1) both;
  position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.toast-success::before { background: var(--emerald); }
.toast-error::before { background: var(--danger); }
.toast-warning::before { background: var(--amber); }
.toast-ico {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: rgba(34, 211, 238, .12); color: var(--accent);
}
.toast-success .toast-ico { background: rgba(52, 211, 153, .13); color: var(--emerald); }
.toast-error .toast-ico { background: rgba(248, 113, 113, .13); color: var(--danger); }
.toast-warning .toast-ico { background: rgba(251, 191, 36, .13); color: var(--amber); }
.toast-msg { flex: 1 1 auto; overflow-wrap: anywhere; padding-top: 1px; }
.toast-close {
  border: 0; background: transparent; color: var(--dim); font-size: 12px;
  padding: 2px 1px; border-radius: 4px; flex: 0 0 auto;
}
.toast-close:hover { color: var(--text); }
.toast.is-leaving { animation: toast-out .18s ease both; }

/* --------------------------------------------------------------------------
   Loading & skeleton
   -------------------------------------------------------------------------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .14);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
  display: inline-block; flex: 0 0 auto;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
.loading-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 10, 19, .62); backdrop-filter: blur(3px);
  animation: fade-in .14s ease both;
}
.loading-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-radius: 12px;
  background: #162238; border: 1px solid var(--border);
  color: var(--text-soft); font-size: 13px; box-shadow: var(--shadow);
}
.skeleton {
  background: linear-gradient(90deg, #162238 25%, #1e2e4a 50%, #162238 75%);
  background-size: 220% 100%;
  animation: shimmer 1.35s ease-in-out infinite;
  border-radius: 6px;
}
.sk-row { height: 42px; margin: 8px 14px; }
.sk-kpi { height: 104px; border-radius: var(--radius); }
.sk-chart { height: 250px; border-radius: 9px; }
.sk-line { height: 13px; width: 68%; }
.sk-line.w-40 { width: 40%; }
.sk-line.w-90 { width: 90%; }

.skeleton-page { display: flex; flex-direction: column; gap: 18px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 12px; }

/* --------------------------------------------------------------------------
   Chart
   -------------------------------------------------------------------------- */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; }

/* --------------------------------------------------------------------------
   Dashboard system panel
   -------------------------------------------------------------------------- */
.system-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.system-tile {
  border: 1px solid var(--border-soft); border-radius: 9px;
  background: rgba(255, 255, 255, .018); padding: 10px 11px;
}
.system-tile .lbl { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.system-tile .val { color: var(--text-soft); font-size: 13px; font-weight: 650; margin-top: 2px; }

/* --------------------------------------------------------------------------
   User detail
   -------------------------------------------------------------------------- */
.detail-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.detail-head-main { flex: 1 1 260px; min-width: 0; }
.detail-head h3 { font-size: 19px; font-weight: 680; overflow-wrap: anywhere; }
.detail-head .muted { font-size: 12px; margin-top: 2px; }
.detail-head-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px; margin: 16px 0 18px;
}
.stat-chip {
  border: 1px solid var(--border-soft); border-radius: 9px;
  background: rgba(255, 255, 255, .018); padding: 9px 11px;
}
.stat-chip .lbl { color: var(--dim); font-size: 10.3px; text-transform: uppercase; letter-spacing: .055em; }
.stat-chip .val { color: var(--text); font-size: 13px; font-weight: 650; margin-top: 1px; font-variant-numeric: tabular-nums; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.subsection { display: flex; flex-direction: column; gap: 10px; }
.subsection h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700;
}
.danger-zone {
  border: 1px solid rgba(248, 113, 113, .3); border-radius: 11px;
  background: rgba(248, 113, 113, .035); padding: 14px;
}
.danger-zone h4 { color: #fecaca; }
.mini-list { display: flex; flex-direction: column; gap: 7px; }
.mini-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 8px;
  font-size: 12px; color: var(--text-soft); background: rgba(255, 255, 255, .012);
}
.mini-item .muted { font-size: 11px; }

/* --------------------------------------------------------------------------
   Shop
   -------------------------------------------------------------------------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.product-card {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: 13px;
  background: linear-gradient(180deg, rgba(22, 34, 56, .7), rgba(17, 27, 44, .95));
  padding: 15px; position: relative; overflow: hidden;
}
.product-card.is-inactive { opacity: .62; }
.product-card::after {
  content: ""; position: absolute; width: 100px; height: 100px; border-radius: 50%;
  right: -45px; top: -45px; background: radial-gradient(circle, rgba(34, 211, 238, .1), transparent 70%);
}
.product-top { display: flex; align-items: flex-start; gap: 11px; }
.product-emoji {
  width: 44px; height: 44px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 22px;
  background: rgba(255, 255, 255, .045); border: 1px solid var(--border-soft);
}
.product-name { font-size: 13.5px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.product-sku { font-family: var(--mono); font-size: 10.5px; color: var(--dim); margin-top: 1px; }
.product-desc { color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 34px; }
.product-prices { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.product-price { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.product-price small { font-size: 10.5px; color: var(--dim); font-weight: 600; }
.product-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.product-payload {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  background: rgba(0, 0, 0, .24); border: 1px solid var(--border-soft);
  border-radius: 7px; padding: 6px 8px; max-height: 62px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.product-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }

.sale-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid rgba(251, 191, 36, .28); border-radius: 10px;
  background: rgba(251, 191, 36, .055); padding: 11px 14px;
  color: #fde68a; font-size: 12.5px; flex-wrap: wrap;
}
.sale-banner .switch-label { color: #fde68a; }

/* --------------------------------------------------------------------------
   Economy / settings
   -------------------------------------------------------------------------- */
.type-bar {
  height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07);
  overflow: hidden; min-width: 70px;
}
.type-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--emerald)); }

.settings-group { margin-bottom: 4px; }
.settings-group-head {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 20px; border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .012);
}
.settings-group-head h3 { font-size: 13px; text-transform: capitalize; }
.settings-group-head .count { color: var(--dim); font-size: 11px; margin-left: auto; }
.setting-row {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(190px, 1fr);
  gap: 18px; align-items: center; padding: 12px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row:hover { background: rgba(255, 255, 255, .014); }
.setting-info { min-width: 0; }
.setting-label { font-size: 12.8px; font-weight: 600; color: var(--text-soft); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.setting-key { font-family: var(--mono); font-size: 10.5px; color: var(--dim); margin-top: 1px; }
.setting-control { display: flex; justify-content: flex-end; }
.setting-control .input, .setting-control .select { max-width: 260px; }
.setting-row.is-priority {
  background: linear-gradient(90deg, rgba(34, 211, 238, .045), transparent 60%);
  border-left: 2px solid rgba(34, 211, 238, .5);
}
.setting-row.is-priority .setting-label { color: #d9fbff; }
.key-chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(34, 211, 238, .28);
  background: rgba(34, 211, 238, .07); border-radius: 4px; padding: 1px 5px;
}
.save-bar {
  position: sticky; bottom: 12px; z-index: 12;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 16px;
  background: rgba(18, 28, 46, .94); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .9);
}

/* --------------------------------------------------------------------------
   Events, tickets, community
   -------------------------------------------------------------------------- */
.event-card {
  border: 1px solid var(--border); border-radius: 11px;
  background: rgba(255, 255, 255, .018); padding: 13px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.event-card.is-ended { opacity: .68; }
.event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.event-title { font-size: 13.5px; font-weight: 650; color: var(--text); }
.event-mults { display: flex; gap: 6px; flex-wrap: wrap; }
.mult-chip {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 6px;
  background: rgba(0, 0, 0, .18);
}
.event-list { display: flex; flex-direction: column; gap: 9px; max-height: 740px; overflow-y: auto; padding-right: 2px; }

.ticket-card {
  border: 1px solid var(--border); border-radius: 11px;
  background: rgba(255, 255, 255, .015); padding: 14px;
  display: flex; flex-direction: column; gap: 9px;
}
.ticket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ticket-subject { font-size: 13.5px; font-weight: 650; color: var(--text); }
.ticket-message {
  color: var(--text-soft); font-size: 12.3px; line-height: 1.55;
  background: rgba(0, 0, 0, .18); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 9px 11px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ticket-reply {
  color: #a7f3d0; font-size: 12.3px; line-height: 1.55;
  background: rgba(52, 211, 153, .055); border: 1px solid rgba(52, 211, 153, .2);
  border-radius: 8px; padding: 9px 11px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ticket-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--dim); font-size: 11.3px; }

.thread-card {
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, rgba(22, 34, 56, .55), rgba(17, 27, 44, .9));
  padding: 15px 16px; display: flex; flex-direction: column; gap: 9px;
}
.thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.thread-title { font-size: 14px; font-weight: 660; color: var(--text); overflow-wrap: anywhere; }
.thread-body {
  color: var(--text-soft); font-size: 12.4px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
  border-left: 2px solid var(--border); padding-left: 11px;
}
.thread-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.thread-controls .select { width: auto; min-width: 120px; }

/* --------------------------------------------------------------------------
   Broadcast
   -------------------------------------------------------------------------- */
.broadcast-warning {
  display: flex; gap: 11px; align-items: flex-start;
  border: 1px solid rgba(251, 191, 36, .35); border-radius: 11px;
  background: rgba(251, 191, 36, .06); padding: 13px 15px; color: #fde68a;
  font-size: 12.5px; line-height: 1.55;
}
.broadcast-warning .icon { color: var(--amber); margin-top: 1px; }
.broadcast-result {
  border: 1px solid rgba(52, 211, 153, .3); border-radius: 11px;
  background: rgba(52, 211, 153, .06); padding: 15px; color: #a7f3d0;
  font-size: 12.8px;
}
.broadcast-result .big { font-size: 26px; font-weight: 750; letter-spacing: -.03em; }

/* --------------------------------------------------------------------------
   Logs
   -------------------------------------------------------------------------- */
.logs-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.json-details summary {
  cursor: pointer; color: var(--accent); font-size: 11.5px; user-select: none;
  outline: none;
}
.json-details summary:hover { text-decoration: underline; }
.json-details pre {
  margin: 7px 0 0; padding: 10px; border-radius: 8px;
  background: #091120; border: 1px solid var(--border-soft);
  max-width: 520px; max-height: 260px; overflow: auto;
  font-family: var(--mono); font-size: 10.6px; line-height: 1.5;
  color: #a8c0df; white-space: pre-wrap; overflow-wrap: anywhere;
}
.log-message { max-width: 460px; overflow-wrap: anywhere; white-space: pre-wrap; }
.log-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.log-dot.debug { background: var(--dim); }
.log-dot.info { background: var(--accent); }
.log-dot.warning { background: var(--amber); }
.log-dot.error { background: var(--danger); }
.log-dot.critical { background: var(--pink); }

/* --------------------------------------------------------------------------
   Translations
   -------------------------------------------------------------------------- */
.translation-row { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(0, 1.6fr) auto; gap: 9px; align-items: center; }
.translation-key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.table-wrap .translation-row { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.table-wrap .translation-row:last-child { border-bottom: 0; }
.table-wrap .translation-row:hover { background: rgba(255, 255, 255, .02); }
.locale-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.locale-btn {
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .02);
  color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
}
.locale-btn:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.locale-btn.is-active { color: #04222a; background: var(--accent); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Misc utilities
   -------------------------------------------------------------------------- */
.divider { height: 1px; background: var(--border-soft); border: 0; margin: 4px 0; }
.spacer { flex: 1 1 auto; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
.text-emerald { color: var(--emerald); }
.text-danger { color: var(--danger); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--accent); }
.text-violet { color: var(--violet); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-18 { font-size: 18px; }
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

.noscript-warn { position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 200; }

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -20% 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

/* Locations only: keep other admin sections and modal styles unchanged. */
.admin-locations { min-width: 0; }
.admin-locations > .page-toolbar,
.admin-locations > .card { padding: 24px; border: 1px solid #374151; border-radius: 12px; background: #1f2937; }
.admin-locations .toolbar-group { min-width: 0; }
.admin-locations .search-box { flex: 1 1 260px; min-width: 0; }
.admin-locations .card-head { padding: 0 0 20px; margin-bottom: 20px; background: none; flex-wrap: wrap; }
.admin-locations .card-head h2 { font-size: 18px; }
.admin-locations .card-body { min-width: 0; }
.admin-locations .table-wrap { max-width: 100%; max-height: 70vh; border-radius: 10px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.admin-locations .data-table { min-width: 1500px; }
.admin-locations .data-table td { padding: 14px; }
.admin-locations .data-table tbody tr:hover td { background: rgba(34, 211, 238, .055); }
.admin-locations .btn { min-height: 44px; padding-inline: 14px; }
.admin-location-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.admin-location-form .location-form-intro { padding-bottom: 12px; border-bottom: 1px solid #374151; }
.admin-location-form .location-form-intro h3 { font-size: 14px; }
.admin-location-form .location-form-intro p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.admin-location-form .form-grid { margin-top: 0; }
.admin-location-form .form-actions { justify-content: flex-end; padding-top: 16px; border-top: 1px solid #374151; }
.admin-location-form .btn { min-height: 44px; padding-inline: 20px; }
.modal:has(.admin-location-form) { background: #1f2937; border-color: #374151; border-radius: 12px; }
.modal:has(.admin-location-form) .modal-head,
.modal:has(.admin-location-form) .modal-body { padding: 24px; }
@media (max-width: 640px) {
  .admin-locations > .page-toolbar, .admin-locations > .card { padding: 20px; }
  .admin-locations .toolbar-group { width: 100%; }
  .admin-locations .search-box { flex-basis: 100%; }
  .admin-locations .select { flex: 1 1 120px; min-width: 0; max-width: 100%; min-height: 44px; }
  .admin-locations .toolbar-group > .btn { flex: 1; }
  .admin-location-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-location-form .form-actions .btn { width: 100%; }
  .modal:has(.admin-location-form) .modal-head, .modal:has(.admin-location-form) .modal-body { padding: 20px; }
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1360px) {
  .signed-in { display: none; }
  .dash-columns { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); }
}

@media (max-width: 1180px) {
  .split-layout { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  :root { --topbar-h: 64px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 24px 0 60px -30px rgba(0, 0, 0, .9);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open::before { opacity: 1; pointer-events: auto; }
  .topbar-menu { display: inline-grid; }
  .topbar { padding: 0 18px; gap: 11px; }
  .mobile-nav-wrap { display: block; }
  .view { padding: 20px 18px 54px; }
  .topbar-meta { gap: 8px; }
  .clock { display: none; }
  .topbar-game { display: none; }
  .dash-columns { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 820px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3, .form-grid-3 .span-2, .form-grid-3 .span-3 { grid-column: span 1; }
  .topbar-meta .health-pill { display: none; }
  .topbar-heading p { display: none; }
  .setting-row { grid-template-columns: 1fr; gap: 7px; padding: 11px 16px; }
  .setting-control { justify-content: flex-start; }
  .setting-control .input, .setting-control .select { max-width: 100%; }
  .translation-row { grid-template-columns: 1fr auto; }
  .translation-row .translation-key { grid-column: 1 / -1; }
  .translation-row .input { grid-column: 1; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 94vh; width: 100%; }
  .modal-body { padding: 16px; }
  .modal-head, .modal-foot { padding: 13px 16px; }
  .stat-strip { grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); }
  .data-table th, .data-table td { padding: 9px 10px; }
}

@media (max-width: 640px) {
  .view { padding: 15px 12px 46px; }
  .topbar { padding: 0 12px; }
  .topbar-heading h1 { font-size: 16px; }
  .topbar-meta #logout-btn span { display: none; }
  .topbar-meta #logout-btn { padding: 0 9px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi { padding: 12px; min-height: 96px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 10.5px; }
  .product-grid { grid-template-columns: 1fr; }
  .toolbar-group { width: 100%; }
  .search-box { flex: 1 1 100%; }
  .page-toolbar { align-items: stretch; }
  .system-grid { grid-template-columns: 1fr; }
  .toast-root { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .auth-card { padding: 24px 20px; }
  .modal-foot { justify-content: stretch; }
  .modal-foot .btn { flex: 1 1 auto; }
  .detail-head-actions { width: 100%; }
  .detail-head-actions .btn { flex: 1 1 auto; }
  .tabs { margin: 0 -4px; }
  .tab-btn { padding: 9px 10px; }
}

@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(n+9) { display: flex; }
  .topbar-meta .health-pill { display: none; }
  .pagination-bar { justify-content: center; }
  .translation-row { grid-template-columns: 1fr; }
  .translation-row .btn { justify-self: end; }
}
