/* ═══════════════════════════════════════════════════════════════
   Askor Panel — matches the visual grammar of the user's existing
   multi-bot admin panel (dark sidebar with grouped nav, status
   pills, icon-chip KPI cards, "Refresh" top bar) reskinned to
   Askor's red brand instead of that panel's purple.
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Unifraktur";
  src: url("/fonts/UnifrakturCook-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo-Variable.ttf") format("truetype-variations");
  font-weight: 100 900;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-weight: 500;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
}

:root {
  --bg: #0d0908;
  --bg-elevated: #150f0d;
  --bg-card: #1a1210;
  --bg-card-top: #1e1512;
  --bg-hover: #211714;
  --border: #2a1d18;
  --border-soft: #201612;
  --border-bright: #3a281f;

  --accent: #d6402c;
  --accent-bright: #f0553e;
  --accent-dim: rgba(214, 64, 44, 0.14);
  --accent-border: rgba(214, 64, 44, 0.4);
  --accent-glow: rgba(214, 64, 44, 0.28);

  --text: #f1e9de;
  --text-dim: #a89484;
  --text-faint: #6b5b4d;

  --gold: #d3a13a;
  --blue: #5b8def;
  --green: #3fb87a;
  --online: #3fb87a;

  --font-display: "Unifraktur", serif;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, monospace;

  --sidebar-w: 240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px rgba(0,0,0,0.28);
  --shadow-card-hover: 0 1px 0 rgba(255,255,255,0.04) inset, 0 16px 40px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}
body {
  min-height: 100vh;
  position: relative;
}
/* ambient glow — depth behind the whole app, not just the login page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 15% -5%, rgba(214,64,44,0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 15%, rgba(211,161,58,0.05), transparent 55%),
    radial-gradient(ellipse 800px 600px at 50% 110%, rgba(214,64,44,0.06), transparent 60%);
}
.shell { position: relative; z-index: 1; }
.login-body::before { display: none; }

a { color: var(--accent); text-decoration: none; }
code { font-family: var(--font-mono); background: rgba(255,255,255,0.06); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.85em; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }

/* thin, on-brand scrollbars instead of the default OS chrome */
* { scrollbar-width: thin; scrollbar-color: var(--border-bright) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 5px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--accent-border); }

/* ─── Shell ───────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-elevated), #120c0a 70%);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 2;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.sidebar-avatar { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); box-shadow: 0 0 0 1px rgba(214,64,44,0.15), 0 4px 14px rgba(214,64,44,0.18); }
.sidebar-title { font-size: 14px; font-weight: 800; color: var(--text); }
.sidebar-subtitle { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; border-top: 1px solid var(--border-soft); }

.nav-group { margin-top: 16px; }
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  padding: 0 8px 6px;
}
.nav-group-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 6px var(--accent-glow); }

.nav-item {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px 8px 13px;
  margin-bottom: 2px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), padding-left 0.15s var(--ease);
}
.nav-item .icon { color: var(--text-faint); transition: color 0.15s var(--ease); }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.is-active { background: linear-gradient(90deg, var(--accent-dim), rgba(214,64,44,0.03)); color: var(--text); padding-left: 16px; }
.nav-item.is-active .icon { color: var(--accent); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 3px var(--border-bright); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 1px 6px;
  border-radius: 4px;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
}
.sidebar-logout:hover { color: var(--accent); }

/* ─── Main content ────────────────────────────────────────────── */
.content { flex: 1; min-width: 0; padding: 30px 34px 90px; max-width: 1120px; }

.panel-section { display: none; }
.panel-section.is-active { display: block; }
.panel-section.is-active > * { animation: rise 0.4s var(--ease) both; }
.panel-section.is-active > *:nth-child(1) { animation-delay: 0.02s; }
.panel-section.is-active > *:nth-child(2) { animation-delay: 0.06s; }
.panel-section.is-active > *:nth-child(3) { animation-delay: 0.1s; }
.panel-section.is-active > *:nth-child(4) { animation-delay: 0.14s; }
.panel-section.is-active > *:nth-child(n+5) { animation-delay: 0.17s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .panel-section.is-active > * { animation: none; } }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-dim); margin: 4px 0 0; }

.btn-refresh {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-card);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn-refresh:hover { border-color: var(--accent-border); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,0.3); transform: translateY(-1px); }
.btn-refresh:active { transform: translateY(0); }
.btn-refresh .icon { width: 14px; height: 14px; transition: transform 0.4s var(--ease); }
.btn-refresh:hover .icon { transform: rotate(180deg); }

/* ─── Status card (bot online pill) ──────────────────────────── */
.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(160deg, var(--bg-card-top), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.status-card-left { display: flex; align-items: center; gap: 12px; }
.status-icon { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }
.status-bot-name { font-size: 14.5px; font-weight: 700; color: var(--text); }
.status-online { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--online); margin-top: 2px; }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--online); box-shadow: 0 0 8px rgba(63,184,122,0.8); animation: dot-pulse 2.4s ease-in-out infinite; }
.dot-online.is-offline { background: var(--text-faint); box-shadow: none; animation: none; }
.status-online.is-offline { color: var(--text-faint); }
@keyframes dot-pulse { 0%, 100% { box-shadow: 0 0 6px rgba(63,184,122,0.6); } 50% { box-shadow: 0 0 12px 2px rgba(63,184,122,0.9); } }
@media (prefers-reduced-motion: reduce) { .dot-online { animation: none; } }

.status-card-right { display: flex; align-items: center; gap: 26px; }
.status-stat { text-align: right; }
.status-stat-label { font-size: 10px; letter-spacing: 0.07em; color: var(--text-faint); font-weight: 700; }
.status-stat-value { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; font-family: var(--font-mono); }

/* ─── KPI grid ────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg-card-top), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-color: var(--border-bright); }
.kpi-icon {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.kpi-icon .icon { width: 16px; height: 16px; position: relative; z-index: 1; }
.kpi-icon-red { background: radial-gradient(circle at 30% 25%, rgba(214,64,44,0.4), rgba(214,64,44,0.1)); color: var(--accent-bright); box-shadow: 0 0 22px -4px rgba(214,64,44,0.5), inset 0 0 0 1px rgba(214,64,44,0.25); }
.kpi-icon-gold { background: radial-gradient(circle at 30% 25%, rgba(211,161,58,0.4), rgba(211,161,58,0.1)); color: var(--gold); box-shadow: 0 0 22px -4px rgba(211,161,58,0.45), inset 0 0 0 1px rgba(211,161,58,0.25); }
.kpi-icon-blue { background: radial-gradient(circle at 30% 25%, rgba(91,141,239,0.4), rgba(91,141,239,0.1)); color: var(--blue); box-shadow: 0 0 22px -4px rgba(91,141,239,0.45), inset 0 0 0 1px rgba(91,141,239,0.25); }
.kpi-icon-green { background: radial-gradient(circle at 30% 25%, rgba(63,184,122,0.4), rgba(63,184,122,0.1)); color: var(--green); box-shadow: 0 0 22px -4px rgba(63,184,122,0.45), inset 0 0 0 1px rgba(63,184,122,0.25); }

.kpi-label { font-size: 10.5px; letter-spacing: 0.06em; font-weight: 700; color: var(--text-faint); }
.kpi-value { font-size: 27px; font-weight: 800; color: var(--text); margin-top: 4px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-gold { color: var(--gold); }

/* sparkline riding along the bottom edge of the Revenue KPI card */
.kpi-card-spark { padding-bottom: 14px; }
.kpi-spark { margin-top: 10px; height: 28px; }
.kpi-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kpi-period-note { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* ─── Charts (pure SVG, no library) ─────────────────────────── */
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: 190px; overflow: visible; }
.chart-bar { fill: var(--gold); fill-opacity: 0.82; transition: fill-opacity 0.15s var(--ease); }
.chart-bar.is-hover { fill-opacity: 1; }
/* monthly chart: older months recede, the current (in-progress) month is full strength */
.chart-svg.has-current .chart-bar:not(.is-current) { fill-opacity: 0.55; }
.chart-svg.has-current .chart-bar.is-current { fill-opacity: 1; }
.chart-svg.has-current .chart-bar:not(.is-current).is-hover { fill-opacity: 0.9; }
.chart-bar-hit { cursor: crosshair; }
.chart-axis-label { font-family: var(--font-mono); font-size: 10px; fill: var(--text-faint); }
.chart-peak-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; fill: var(--gold); }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-8px);
  transition: opacity 0.12s ease;
  z-index: 5;
  white-space: nowrap;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip-date { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.chart-tooltip-value { font-weight: 800; color: var(--gold); margin-top: 1px; }
.chart-tooltip-sub { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

/* ─── Quick-link pills ────────────────────────────────────────── */
.quicklinks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pill {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-card);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.pill .icon { width: 13px; height: 13px; }
.pill:hover { border-color: var(--accent-border); color: var(--text); background: var(--bg-hover); transform: translateY(-1px); }
.pill:active { transform: translateY(0); }

/* ─── Discord message preview ────────────────────────────────── */
.preview-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin: 8px 0 4px; }
.discord-preview { display: flex; gap: 12px; background: #313338; border-radius: 8px; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.dc-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover; margin-top: 2px; }
.dc-body { flex: 1; min-width: 0; }
.dc-header { display: flex; align-items: baseline; gap: 7px; margin-bottom: 1px; }
.dc-username { font-weight: 600; font-size: 14.5px; color: #f2f3f5; }
.dc-apptag { background: #5865f2; color: #fff; font-size: 8.5px; font-weight: 600; padding: 1px 4px; border-radius: 3px; line-height: 1.4; }
.dc-timestamp { font-size: 11px; color: #949ba4; }
.dc-content { font-size: 14px; line-height: 1.4; color: #dbdee1; white-space: pre-wrap; word-break: break-word; }
.dc-content strong { font-weight: 700; color: #fff; }
.dc-content em { font-style: italic; }
.dc-content code { background: #2b2d31; border-radius: 4px; padding: 0 4px; font-family: var(--font-mono); font-size: 0.85em; color: #dbdee1; }
.dc-mention { background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }

/* ─── Generic panel card ─────────────────────────────────────── */
.panel {
  background: linear-gradient(160deg, var(--bg-card-top), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.panel-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-faint); margin: 0 0 14px; text-transform: uppercase; }
.panel-subtitle { font-size: 12.5px; color: var(--text-dim); margin: -10px 0 16px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ─── Server info grid ───────────────────────────────────────── */
.info-grid { display: flex; flex-direction: column; gap: 12px; }
.info-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.info-row-label { color: var(--text-dim); }
.info-row-value { font-family: var(--font-mono); color: var(--text); font-weight: 600; }

/* ─── Activity feed ──────────────────────────────────────────── */
.activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.activity-feed li { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; transition: background-color 0.15s var(--ease); }
.activity-feed li:hover { background: var(--bg-hover); }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-dot.dot-ticket { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.activity-dot.dot-purchase { background: var(--gold); box-shadow: 0 0 6px rgba(211,161,58,0.5); }
.activity-title { color: var(--text); font-weight: 600; }
.activity-sub { color: var(--text-faint); margin-top: 1px; }
.activity-empty { color: var(--text-faint); font-size: 13px; }

/* ─── Role chips ──────────────────────────────────────────────── */
.role-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.role-chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); background: var(--bg-elevated); transition: border-color 0.15s var(--ease), color 0.15s var(--ease); }
.role-chip:hover { border-color: var(--accent-border); color: var(--text); }

/* ─── Checklist ──────────────────────────────────────────────── */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); padding: 5px 8px; margin: 0 -8px; border-radius: 8px; transition: background-color 0.15s var(--ease); }
.checklist li:hover { background: var(--bg-hover); }
.checklist li.is-done { color: var(--text); }
.check-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); box-shadow: 0 0 6px rgba(63,184,122,0.6); flex-shrink: 0; }
.check-dot.is-off { background: var(--text-faint); box-shadow: none; }

/* ─── Form fields ────────────────────────────────────────────── */
.field-list { display: flex; flex-direction: column; gap: 15px; }
.field-row { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 16px; }
@media (max-width: 620px) { .field-row { grid-template-columns: 1fr; } }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-label .hint { display: block; font-weight: 400; font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.field-select, .field-input, .field-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  appearance: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field-select { background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: calc(100% - 16px) center, calc(100% - 11px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field-select:hover, .field-input:hover, .field-textarea:hover { border-color: var(--text-faint); }
.field-select:focus, .field-input:focus, .field-textarea:focus { border-color: var(--accent); box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 0 0 3px var(--accent-dim); }
.field-textarea { resize: vertical; line-height: 1.45; }

.field-row-col { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field-row-col:last-of-type { margin-bottom: 0; }
.field-row-col[hidden] { display: none; } /* same [hidden]-vs-class specificity tie as the chat modal */

.purchase-form-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lookup-form { display: flex; align-items: flex-end; gap: 12px; }
.lookup-form .field-row-col { flex: 1; }
.lookup-form .btn { height: 39px; flex-shrink: 0; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(160deg, var(--accent-bright), var(--accent)); color: #fff; box-shadow: 0 4px 16px -2px rgba(214,64,44,0.4); }
.btn-primary:hover { box-shadow: 0 6px 22px -2px rgba(214,64,44,0.55); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); margin-top: 4px; align-self: flex-start; }
.btn-ghost:hover { border-color: var(--accent-border); color: var(--text); background: var(--bg-hover); }
.btn-danger { background: transparent; border: 1px solid rgba(214,64,44,0.5); color: var(--accent); padding: 5px 12px; font-size: 12px; }
.btn-danger:hover { background: var(--accent); color: #fff; box-shadow: 0 4px 14px -2px rgba(214,64,44,0.5); }
.btn-block { display: flex; width: 100%; margin-top: 20px; }

/* ─── Lang tabs (Terms) ──────────────────────────────────────── */
.lang-tabs { display: flex; gap: 8px; margin: 0 0 16px; }
.lang-tab {
  all: unset;
  cursor: pointer;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.lang-tab.is-active { border-color: var(--accent-border); color: var(--text); background: var(--accent-dim); }

.terms-section-block { margin-bottom: 16px; }
.terms-section-block .field-label { display: block; margin-bottom: 6px; }

.custom-terms-item { padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 10px; }
.custom-terms-item-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.5px; }
.custom-terms-item-actions { display: flex; gap: 6px; }
.custom-terms-item-actions .btn { margin: 0; padding: 4px 10px; font-size: 11.5px; }
.custom-terms-edit { margin-top: 12px; }

/* ─── Ticket category reference chips ────────────────────────── */
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-ref { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.cat-ref-emoji { font-size: 14px; }
.cat-ref-label { font-weight: 700; color: var(--text); }
.cat-ref-desc { color: var(--text-faint); }

/* ─── Tables ─────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-faint);
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-bright);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text); transition: background-color 0.12s var(--ease); }
.table tbody tr { position: relative; }
.table tbody tr:hover td { background: var(--bg-hover); }
.table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.table tbody tr:last-child td { border-bottom: none; }
.table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.table .gold { color: var(--gold); font-weight: 700; }

/* ─── Category / status pill (used in Tickets & Purchases tables) */
.table-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--text);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}
.table-pill-warn { background: rgba(211,161,58,0.14); border-color: rgba(211,161,58,0.4); color: var(--gold); }
.table-pill-timeout { background: rgba(91,141,239,0.14); border-color: rgba(91,141,239,0.4); color: var(--blue); }
.table-pill-kick { background: rgba(230,126,34,0.14); border-color: rgba(230,126,34,0.4); color: #e67e22; }
.table-pill-ban { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent-bright); }
.table-pill-notebook { background: rgba(211,161,58,0.14); border-color: rgba(211,161,58,0.4); color: var(--gold); }

.empty-note { color: var(--text-faint); font-size: 13px; margin-top: 10px; }

.form-msg { font-size: 12.5px; margin-top: 10px; }
.form-msg.is-ok { color: var(--green); }
.form-msg.is-error { color: var(--accent); }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: linear-gradient(160deg, var(--bg-card-top), var(--bg-card));
  border: 1px solid var(--accent-border);
  border-left-width: 3px;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.is-ok { border-color: rgba(63,184,122,0.4); border-left-color: var(--green); }
.toast.is-error { border-color: var(--accent-border); border-left-color: var(--accent); }
.toast.is-visible { opacity: 1; transform: none; }

/* ─── Ticket chat viewer (live + permanent archive) ─────────────── */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5,3,2,0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
/* [hidden] and .chat-modal-overlay are equal specificity (0,1,0) each —
   without this, the class rule's unconditional `display: flex` above
   wins the cascade (loads after the UA stylesheet) and the modal
   never actually hides, on load OR when "closed". */
.chat-modal-overlay[hidden] { display: none; }
.chat-modal-overlay:not([hidden]) .chat-modal { animation: modal-pop 0.22s var(--ease) both; }
@keyframes modal-pop { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@media (prefers-reduced-motion: reduce) { .chat-modal-overlay:not([hidden]) .chat-modal { animation: none; } }
.chat-modal {
  width: 100%;
  max-width: 760px;
  height: 100%;
  max-height: 780px;
  background: linear-gradient(160deg, #1a100d, var(--bg-elevated));
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.chat-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-modal-title { font-size: 16px; font-weight: 800; color: var(--text); }
.chat-modal-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }
.chat-modal-header-actions { display: flex; align-items: center; gap: 12px; }
.chat-live-badge { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--online); }
.chat-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  background: #1e1512;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg { display: flex; gap: 11px; }
.chat-msg-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-head { display: flex; align-items: baseline; gap: 8px; }
.chat-msg-author { font-size: 13.5px; font-weight: 700; color: var(--text); }
.chat-msg-author.is-bot::after { content: "APP"; font-size: 8.5px; font-weight: 700; background: #5865f2; color: #fff; padding: 1px 4px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.chat-msg-time { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }
.chat-msg-content { font-size: 13.5px; color: #dbdee1; line-height: 1.45; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }

.chat-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-att-img { max-width: 280px; max-height: 220px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; display: block; }
.chat-att-audio { width: 280px; height: 36px; }
.chat-att-video { max-width: 320px; max-height: 220px; border-radius: 8px; border: 1px solid var(--border); }
.chat-att-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-card);
}
.chat-att-file .icon { width: 15px; height: 15px; color: var(--text-faint); flex-shrink: 0; }
.chat-empty { color: var(--text-faint); font-size: 13px; text-align: center; padding: 40px 0; }

@media (max-width: 600px) {
  .chat-modal-overlay { padding: 0; }
  .chat-modal { max-width: none; max-height: none; border-radius: 0; }
  .chat-att-img, .chat-att-audio, .chat-att-video { max-width: 100%; width: 100%; }
}

/* ─── Login page — animated portfolio marquee background ────── */
.login-body { margin: 0; background: var(--bg); overflow-x: hidden; }

.marquee-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  transform: rotate(-4deg) scale(1.15);
  transform-origin: center;
}
.marquee-row { overflow: hidden; width: 100%; }
.marquee-track { display: flex; width: max-content; gap: 18px; }
.marquee-track img { height: 210px; width: auto; border-radius: 10px; border: 1px solid rgba(236,225,206,0.12); flex-shrink: 0; display: block; }

.marquee-row-a .marquee-track { animation: marquee-left 70s linear infinite; }
.marquee-row-b .marquee-track { animation: marquee-right 70s linear infinite; }
@keyframes marquee-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes marquee-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
  .marquee-row-a .marquee-track, .marquee-row-b .marquee-track { animation: none; }
}

.marquee-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at center, rgba(10,5,4,0.28) 0%, rgba(10,5,4,0.62) 60%, rgba(10,5,4,0.8) 100%),
    linear-gradient(rgba(10,5,4,0.12), rgba(10,5,4,0.12));
}

.login-wrap { position: relative; z-index: 2; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

.login-card-float {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 440px;
  /* Faint grain baked into the element's own background (paints below
     all descendants, unlike a ::after which would sit on top of the
     text) for material depth — matches the brand's leather/parchment
     undertone without going back to the rejected full "grimoire" redesign. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-color: rgba(19,12,10,0.78);
  border: 1px solid rgba(236,225,206,0.14);
  border-radius: 20px;
  padding: 46px 42px 40px;
  backdrop-filter: blur(22px);
  box-shadow: 0 10px 40px -6px var(--accent-glow), 0 50px 110px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: login-card-in 0.7s var(--ease) both;
}
.login-card-float::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .login-card-float { animation: none; }
}

.login-title-big { font-size: 34px; margin-top: 4px; letter-spacing: -0.01em; text-shadow: 0 2px 20px rgba(0,0,0,0.35); }

.hero-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.hero-mark { width: 52px; height: 52px; border-radius: 13px; object-fit: cover; box-shadow: 0 6px 18px -4px var(--accent-glow), 0 0 0 1px rgba(236,225,206,0.1); }
.hero-word { font-family: var(--font-display); font-size: 28px; color: var(--accent); line-height: 1; }
.hero-tag { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; margin-top: 4px; }

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 12px;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
}
.login-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--online); box-shadow: 0 0 8px 1px rgba(63,184,122,0.6); flex-shrink: 0; }
.login-title { font-size: 28px; font-weight: 800; color: var(--text); margin: 0 0 8px; }
.login-sub { font-size: 14px; color: var(--text-dim); line-height: 1.55; margin: 0 0 22px; }
.login-msg { font-size: 12.5px; color: var(--accent); margin: 0 0 14px; }
.login-fine { font-size: 11px; color: var(--text-faint); margin-top: 24px; line-height: 1.5; }

.btn-block {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding-top: 17px;
  padding-bottom: 17px;
  font-size: 15px;
  letter-spacing: 0.01em;
  border-radius: 13px;
}
.btn-block::before {
  /* Glossy top highlight — reads as a rounder, more substantial button
     instead of a flat wide bar. */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.discord-mark { width: 21px; height: 21px; flex-shrink: 0; position: relative; }

.hero-features { list-style: none; margin: 0; padding: 0; display: flex; }
.hero-features li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.hero-features .kpi-icon { width: 34px; height: 34px; margin-bottom: 0; }
.hero-features-row { flex-direction: row; justify-content: space-between; margin-top: 30px; padding-top: 24px; border-top: 1px solid rgba(236,225,206,0.1); }
.hero-features-row li { flex: 1; flex-direction: column; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; padding: 10px 6px; border-radius: 12px; transition: background 0.2s var(--ease); }
.hero-features-row li:hover { background: rgba(255,255,255,0.035); }

@media (max-width: 520px) {
  .marquee-track img { height: 140px; }
  .login-card-float { padding: 34px 26px 30px; max-width: 380px; }
  .login-title-big { font-size: 28px; }
}

/* ─── Top buyers leaderboard (Purchases page) ────────────────── */
.leaderboard { display: flex; flex-direction: column; gap: 10px; }
.leaderboard-row { display: flex; align-items: center; gap: 14px; }
.leaderboard-rank {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 800;
}
.leaderboard-rank.is-rank-1 { background: rgba(211,161,58,0.18); border-color: rgba(211,161,58,0.5); color: var(--gold); }
.leaderboard-rank.is-rank-2 { background: rgba(200,200,210,0.14); border-color: rgba(200,200,210,0.35); color: #c9ccd6; }
.leaderboard-rank.is-rank-3 { background: rgba(205,127,50,0.16); border-color: rgba(205,127,50,0.4); color: #cd7f32; }
.leaderboard-info { flex: 1 1 auto; min-width: 0; }
.leaderboard-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-bar { height: 5px; border-radius: 999px; background: var(--accent-dim); overflow: hidden; }
.leaderboard-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, rgba(211,161,58,0.55), var(--gold)); }
.leaderboard-total { flex: 0 0 auto; font-size: 13px; font-weight: 800; white-space: nowrap; }

/* ─── Invoice cell (Purchases table) ──────────────────────────── */
.invoice-cell { display: flex; flex-direction: column; gap: 5px; }
.invoice-cell-number { font-size: 11px; color: var(--text-faint); }
.invoice-cell-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: var(--accent-dim); }

/* ─── Reset Earnings (Purchases page) ─────────────────────────── */
.reset-info { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.reset-info b { color: var(--text); }
.reset-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reset-actions .btn { margin: 0; }

.adjustment-row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.adjustment-inputs { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.adjustment-inputs .btn { margin: 0; }
@media (max-width: 640px) {
  .adjustment-inputs { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Dashboard v2 additions
   ═══════════════════════════════════════════════════════════════ */

/* The `hidden` attribute is used all over the dashboard. Any class that sets
   its own `display` (.btn, .nav-badge, overlays…) silently beats the browser's
   default [hidden] rule at equal specificity — this makes hidden always win. */
[hidden] { display: none !important; }

.topbar { flex-wrap: wrap; gap: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.updated-at { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); white-space: nowrap; }
a.btn-refresh { text-decoration: none; }
.btn-refresh.is-spinning .icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-refresh.is-spinning .icon { animation: none; } }

/* sidebar quick-search + ticket badge */
.nav-search {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-faint);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-search:hover { border-color: var(--accent-border); color: var(--text-dim); }
.nav-search .icon { width: 14px; height: 14px; }
.nav-search-text { flex: 1; }
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-bright);
  background: var(--bg-elevated);
  color: var(--text-dim);
}
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
  line-height: 1.5;
}

/* panel header row (title + actions) */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .panel-title { margin: 0; }
.panel-head-actions { display: flex; gap: 8px; }
.count-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--text);
  font-size: 10.5px;
  letter-spacing: 0;
  font-weight: 800;
  vertical-align: 1px;
}
.count-chip:empty { display: none; }
.count-chip.is-complete { background: rgba(63,184,122,0.14); border-color: rgba(63,184,122,0.4); color: var(--green); }
.hint-inline { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-faint); font-size: 11px; margin-left: 6px; }

/* sales snapshot */
.insight-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.insight { padding: 4px 18px; border-left: 1px solid var(--border-soft); min-width: 0; }
.insight:first-child { padding-left: 0; border-left: none; }
.insight-label { font-size: 10.5px; letter-spacing: 0.06em; font-weight: 700; color: var(--text-faint); }
.insight-value { font-size: 24px; font-weight: 800; margin-top: 4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.insight-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; min-height: 16px; }
.delta { font-weight: 700; white-space: nowrap; }
.delta.is-up { color: var(--green); }
.delta.is-down { color: var(--accent-bright); }
.delta.is-flat { color: var(--text-faint); font-weight: 500; }

/* horizontal bar lists (payment methods, top products) */
.hbar-list { display: flex; flex-direction: column; gap: 13px; }
.hbar-row { min-width: 0; }
.hbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.5px; margin-bottom: 5px; }
.hbar-label { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hbar-count { color: var(--text-faint); font-weight: 500; }
.hbar-value { color: var(--gold); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-share { color: var(--text-faint); font-weight: 600; font-size: 11px; margin-left: 4px; }
.hbar-track { height: 6px; border-radius: 999px; background: var(--accent-dim); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, rgba(211,161,58,0.55), var(--gold)); transition: width 0.5s var(--ease); }
.hbar-empty { color: var(--text-faint); font-size: 13px; margin: 0; }

/* toolbar above tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.search-box { position: relative; flex: 1 1 240px; min-width: 0; }
.search-box > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: flex; pointer-events: none; }
.search-box .icon { width: 14px; height: 14px; }
.search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 12px 9px 33px;
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-input:hover { border-color: var(--text-faint); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 0 0 3px var(--accent-dim); }
.toolbar-select { width: auto; flex: 0 1 auto; min-width: 130px; padding-top: 8px; padding-bottom: 8px; }
.table-summary { font-size: 12.5px; color: var(--text-dim); margin: 2px 0 8px; min-height: 0; }
.table-summary:empty { display: none; }
.table-summary b { color: var(--text); }
.table-summary .gold { color: var(--gold); }
.table-summary-note { color: var(--text-faint); }
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.table-wrap:focus-visible { outline-offset: -2px; }
#purchasesTable { min-width: 880px; }
#purchasesTable td.mono, #archiveTable td.mono, #ticketsTable td.mono { white-space: nowrap; }
#archiveTable { min-width: 780px; }
#ticketsTable { min-width: 640px; }
#modTable { min-width: 560px; }
.show-more-row { display: flex; justify-content: center; margin-top: 12px; }
.show-more-row .btn { margin: 0; }
tr.is-ghost td { opacity: 0.6; }

.btn-sm { padding: 6px 12px; font-size: 12px; margin: 0; }
.btn-danger-solid { background: linear-gradient(160deg, var(--accent-bright), var(--accent)); color: #fff; box-shadow: 0 4px 16px -2px rgba(214,64,44,0.4); }
.btn-danger-solid:hover { box-shadow: 0 6px 22px -2px rgba(214,64,44,0.55); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost.is-dirty { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions .btn { margin: 0; }
.icon-btn { padding: 0; }
.icon-btn .icon { width: 13px; height: 13px; }
.icon-btn-danger { background: transparent; border-color: rgba(214,64,44,0.35); color: var(--accent); }
.icon-btn-danger:hover { background: var(--accent); color: #fff; }
.table-pill-muted { background: transparent; border-color: var(--border-bright); color: var(--text-faint); font-weight: 600; }

.char-count { font-size: 11px; color: var(--text-faint); text-align: right; font-family: var(--font-mono); margin-top: -3px; }
.char-count.is-near { color: var(--gold); }
.form-msg.is-warn { color: var(--gold); }

/* in-page jump links (Purchases) */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 18px; }
.subnav-item {
  all: unset;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.subnav-item:hover { border-color: var(--accent-border); color: var(--text); }
.panel, .two-col { scroll-margin-top: 76px; }

/* segmented control (chart range) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { all: unset; cursor: pointer; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--text-dim); transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--accent-dim); color: var(--text); }

.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); max-width: 480px; }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* dialogs (confirm + form) */
.dialog-overlay, .palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5,3,2,0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  overflow-y: auto;
}
.dialog-overlay { align-items: center; padding: 20px; }
.dialog {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(160deg, #1d1310, var(--bg-elevated));
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: modal-pop 0.2s var(--ease) both;
}
.dialog-title { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.dialog-text { font-size: 13.5px; color: var(--text-dim); line-height: 1.55; margin: 0 0 10px; }
.dialog-text b { color: var(--text); }
.dialog-body:empty { display: none; }
.dialog .field-row-col { margin-bottom: 12px; }
.dialog .form-msg { margin: 0 0 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-actions .btn { margin: 0; }
@media (prefers-reduced-motion: reduce) { .dialog, .palette { animation: none; } }

/* command palette */
.palette {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(160deg, #1d1310, var(--bg-elevated));
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: modal-pop 0.18s var(--ease) both;
}
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-faint); }
.palette-input-row input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 15px; padding: 15px 0; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: var(--text-dim); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.palette-item .icon { color: var(--text-faint); }
.palette-item.is-active { background: var(--accent-dim); color: var(--text); }
.palette-item.is-active .icon { color: var(--accent-bright); }
.palette-label { flex: 1; }
.palette-hint { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.palette-empty { padding: 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-faint); }
.palette-foot kbd { margin-right: 4px; }

/* mobile top bar + drawer (only used below 860px) */
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }
.icon-plain { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; color: var(--text-dim); }
.icon-plain:hover { background: var(--bg-hover); color: var(--text); }
.icon-plain .icon { width: 20px; height: 20px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .insight-grid { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .insight:nth-child(3) { padding-left: 0; border-left: none; }
}
@media (max-width: 860px) {
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 6px 10px;
    background: rgba(13,9,8,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
  }
  .mobile-bar-title { flex: 1; font-size: 15px; font-weight: 800; }
  /* .shell normally forms a stacking context (z-index:1), which would trap the
     fixed drawer underneath the backdrop that lives outside it */
  .shell { display: block; z-index: auto; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw);
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.25s var(--ease);
    z-index: 60;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 18px 0 60px rgba(0,0,0,0.6); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5,3,2,0.6); opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease); }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .content { padding: 18px 16px 70px; }
  .field-row { grid-template-columns: 1fr; }
  .purchase-form-inline { grid-template-columns: 1fr; }
  .status-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .status-card-right { width: 100%; justify-content: space-between; }
  .user-name { max-width: 150px; }
  .updated-at { display: none; }
  .kpi-grid-2, .kpi-grid-3 { max-width: none; }
  .page-title { font-size: 22px; }
  .panel { padding: 16px; }
  .panel, .two-col { scroll-margin-top: 64px; }
}
@media (max-width: 520px) {
  .kpi-grid-2, .kpi-grid-3 { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .insight { padding: 0 0 14px; border-left: none; border-bottom: 1px solid var(--border-soft); }
  .insight:last-child { border-bottom: none; padding-bottom: 0; }
  .toolbar-select { flex: 1 1 100%; }
  .dialog { padding: 18px; }
  .palette-overlay { padding-top: 8vh; }
  .lookup-form { flex-direction: column; align-items: stretch; }
}
