/* =========================================================================
   minerali.senato.eu — design system (tema chiaro/scuro)
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Orbitron:wght@400;500;700;900&display=swap");

:root {
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-strong: #4f46e5;
  --accent-contrast: #ffffff;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --gold: #f59e0b;
  --gold-soft: rgba(245, 158, 11, 0.14);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.12);
  --nav-h: 64px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --maxw: 1760px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-1: 0 1px 2px rgba(8, 11, 22, 0.06);
  --shadow-2: 0 12px 32px rgba(8, 11, 22, 0.10);
  --shadow-3: 0 28px 70px rgba(8, 11, 22, 0.16);
}

/* ---- Tema scuro (default) ---- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c14;
  --bg-grad-1: rgba(99, 102, 241, 0.12);
  --bg-grad-2: rgba(34, 197, 94, 0.06);
  --surface: rgba(20, 23, 36, 0.72);
  --surface-solid: #12141f;
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.07);
  --elev: #161927;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --muted: rgba(238, 241, 248, 0.62);
  --faint: rgba(238, 241, 248, 0.4);
  --accent-soft: rgba(129, 140, 248, 0.16);
  --accent-glow: rgba(99, 102, 241, 0.32);
  --input-bg: rgba(255, 255, 255, 0.04);
  --grid-line: rgba(255, 255, 255, 0.03);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* ---- Tema chiaro ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-grad-1: rgba(99, 102, 241, 0.14);
  --bg-grad-2: rgba(34, 197, 94, 0.10);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-2: rgba(15, 23, 42, 0.03);
  --surface-3: rgba(15, 23, 42, 0.06);
  --elev: #ffffff;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #131829;
  --muted: rgba(19, 24, 41, 0.6);
  --faint: rgba(19, 24, 41, 0.42);
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.22);
  --input-bg: #ffffff;
  --grid-line: rgba(15, 23, 42, 0.035);
}

/* ---- Eclipse Local visual parity (website/css/style.css) ---- */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
  color-scheme: dark;
  --bg: #020617;
  --primary: #0f172a;
  --secondary: #1e293b;
  --tertiary: #263048;
  --accent: #22c55e;
  --accent-2: #4ade80;
  --accent-strong: #16a34a;
  --accent-dark: #16a34a;
  --accent-light: #4ade80;
  --accent-contrast: #000000;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-glow: rgba(34, 197, 94, 0.2);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --gold: #f59e0b;
  --gold-soft: rgba(245, 158, 11, 0.12);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --surface: rgba(15, 23, 42, 0.65);
  --surface-solid: #020617;
  --surface-2: rgba(2, 6, 23, 0.75);
  --surface-3: rgba(30, 41, 59, 0.7);
  --elev: #0f172a;
  --input-bg: #0f172a;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(34, 197, 94, 0.25);
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(34, 197, 94, 0.25);
  --border-gold: rgba(245, 158, 11, 0.25);
  --text: #f8fafc;
  --muted: #94a3b8;
  --faint: #475569;
  --text-muted: #94a3b8;
  --text-dim: #475569;
  --grid-line: rgba(255, 255, 255, 0.035);
  --glass: rgba(2, 6, 23, 0.75);
  --glass-card: rgba(15, 23, 42, 0.65);
  --glass-hover: rgba(30, 41, 59, 0.7);
  --destructive: #ef4444;
  --destructive-bg: rgba(239, 68, 68, 0.1);
  --destructive-glow: rgba(239, 68, 68, 0.2);
  --font-heading: "Orbitron", monospace;
  --font-body: "JetBrains Mono", monospace;
  --nav-h: 72px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --maxw: 1760px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-2: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 0 80px rgba(34, 197, 94, 0.08), 0 32px 64px rgba(0, 0, 0, 0.6);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 450;
  letter-spacing: -0.01em;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 400ms var(--ease), color 400ms var(--ease);
}

/* Sfondo decorativo: gradienti morbidi + griglia tenue */
body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% -5%, var(--bg-grad-1), transparent 60%),
    radial-gradient(55% 45% at 95% 8%, var(--bg-grad-2), transparent 60%),
    radial-gradient(70% 60% at 50% 120%, var(--accent-soft), transparent 70%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---- Barra di caricamento ---- */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), transparent);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 200ms var(--ease), transform 600ms var(--ease);
}

body.is-loading .loading-bar {
  opacity: 1;
  transform: scaleX(1);
}

/* ============================ NAVBAR ============================ */
.navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: grid;
  height: var(--nav-h);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  backdrop-filter: saturate(140%) blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(140deg, var(--accent-2), var(--accent-strong));
  box-shadow: 0 6px 18px var(--accent-glow), inset 0 1px rgba(255, 255, 255, 0.3);
}

.brand-name {
  white-space: nowrap;
  font-size: 1.06rem;
}

.nav-center {
  position: relative;
  display: flex;
  justify-self: center;
  gap: 0.15rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.26rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  scrollbar-width: none;
}

.nav-center::-webkit-scrollbar {
  display: none;
}

.nav-indicator {
  position: absolute;
  top: 0.26rem;
  bottom: 0.26rem;
  left: 0;
  z-index: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px var(--accent-glow);
  transition:
    transform 460ms var(--ease),
    width 460ms var(--ease);
}

.nav-link {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  transition: color 220ms var(--ease), transform 220ms var(--ease);
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: #fff;
}

.nav-link .count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 0.25rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1300;
  font-size: 0.66rem;
  font-weight: 800;
  vertical-align: middle;
}

/* Icona tema: luna crescente (scuro) <-> sole (chiaro) */
.theme-icon {
  position: relative;
  display: block;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: inset -5px -3px 0 0 var(--surface-solid);
  transition: transform 450ms var(--ease), box-shadow 450ms var(--ease), background 450ms var(--ease);
}

:root[data-theme="light"] .theme-icon {
  width: 12px;
  height: 12px;
  background: var(--gold);
  box-shadow:
    inset 0 0 0 0 transparent,
    0 -8px 0 -5px var(--gold), 0 8px 0 -5px var(--gold),
    -8px 0 0 -5px var(--gold), 8px 0 0 -5px var(--gold),
    -6px -6px 0 -5px var(--gold), 6px 6px 0 -5px var(--gold),
    -6px 6px 0 -5px var(--gold), 6px -6px 0 -5px var(--gold);
  transform: rotate(45deg);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* ---- Bottoni base ---- */
.icon-btn,
.profile-trigger,
.discord-login,
.primary-action,
.ghost-action,
.square-action,
.menu-action,
.row-remove,
.picker-trigger,
.picker-option,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  transition:
    transform 200ms var(--ease),
    border-color 200ms var(--ease),
    background 200ms var(--ease),
    box-shadow 200ms var(--ease),
    filter 200ms var(--ease),
    color 200ms var(--ease);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}

.discord-login,
.primary-action,
.ghost-action,
.menu-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 1rem;
}

.primary-action,
.discord-login {
  border-color: transparent;
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-strong));
  box-shadow: 0 10px 24px var(--accent-glow);
}

.ghost-action.compact,
.primary-action.compact {
  min-height: 32px;
  padding-inline: 0.7rem;
  font-size: 0.85rem;
}

.icon-btn:hover,
.profile-trigger:hover,
.ghost-action:hover,
.square-action:hover,
.menu-action:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.primary-action:hover,
.discord-login:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow: 0 14px 30px var(--accent-glow);
}

.primary-action:active,
.ghost-action:active,
.icon-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---- Profilo ---- */
.profile {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.22rem 0.7rem 0.22rem 0.22rem;
  border-radius: 999px;
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  background: linear-gradient(140deg, var(--accent-2), var(--accent-strong));
}

.avatar-large {
  width: 46px;
  height: 46px;
  font-size: 0.95rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trigger-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 80;
  width: min(320px, calc(100vw - 24px));
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--elev);
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top right;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.profile-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.profile-row small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.menu-action {
  width: 100%;
  justify-content: flex-start;
}

.danger {
  color: var(--bad);
}

.menu-action.danger:hover {
  border-color: var(--bad);
  background: var(--bad-soft);
}

/* ============================ LOGIN ============================ */
.login-view {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--nav-h) + 2rem) 1rem 2rem;
}

.login-card {
  width: min(540px, 100%);
  padding: 2.4rem;
  text-align: center;
}

.login-card .eyebrow {
  justify-content: center;
}

.login-card h1 {
  margin: 0.4rem 0 0.7rem;
  font-size: 2.8rem;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--text), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card p {
  color: var(--muted);
}

.login-card .discord-login {
  margin-top: 0.6rem;
  width: 100%;
  min-height: 48px;
}

.setup-note {
  display: grid;
  gap: 0.3rem;
  margin-top: 1.2rem;
  padding: 0.9rem;
  border: 1px solid var(--gold);
  border-radius: var(--r);
  background: var(--gold-soft);
  color: var(--gold);
  text-align: left;
  overflow-wrap: anywhere;
}

/* ============================ LAYOUT ============================ */
.app-shell {
  position: relative;
  z-index: 2;
  width: min(var(--maxw), 100%);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 1.5rem) 1.25rem 4rem;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-in-forward 460ms var(--ease) both;
}

.app-shell[data-transition="back"] .page.active {
  animation-name: page-in-back;
}

.page.active .metric-card,
.page.active .panel-card,
.page.active .load-builder,
.page.active .load-table-card,
.page.active .product-editor,
.page.active .request-card {
  animation: surface-in 500ms var(--ease) both;
}

.page.active .page-head {
  animation: page-head-in 440ms var(--ease) both;
}

.page-head,
.panel-head,
.builder-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-head {
  margin-bottom: 1.4rem;
}

.page-head h1,
.panel-head h2 {
  margin: 0;
}

.page-head h1 {
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.panel-head h2 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Metriche ---- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.metric-card {
  position: relative;
  min-height: 116px;
  display: grid;
  align-content: space-between;
  gap: 0.6rem;
  padding: 1.1rem 1.2rem;
  overflow: hidden;
}

.metric-card::after {
  position: absolute;
  inset: auto -30% -60% auto;
  width: 140px;
  height: 140px;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.metric-card span,
.field span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---- Card / superfici ---- */
.login-card,
.panel-card,
.metric-card,
.load-table-card,
.load-builder,
.request-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(12px);
  transition:
    border-color 260ms var(--ease),
    transform 260ms var(--ease),
    box-shadow 260ms var(--ease);
}

.panel-card:hover,
.metric-card:hover,
.load-table-card:hover {
  border-color: var(--line-strong);
}

.overview-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  gap: 1rem;
}

.panel-card,
.load-builder {
  padding: 1.2rem;
}

.panel-head {
  margin-bottom: 1rem;
}

/* ---- Stock ---- */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.7rem;
}

.compact-stock {
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
}

.stock-item,
.mineral-field,
.simple-row,
.material-line,
.admin-price-row,
.admin-material-row {
  content-visibility: auto;
  contain-intrinsic-size: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 64px;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  transition: border-color 200ms var(--ease), background 200ms var(--ease), transform 200ms var(--ease);
}

.stock-item:hover,
.simple-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateY(-2px);
}

.stock-item.compact {
  min-height: 54px;
}

.stock-item small,
.mineral-label small {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.stock-item b,
.stock-item.positive b {
  color: var(--green);
  font-weight: 800;
}

.stock-item.empty b {
  color: var(--faint);
}

.stock-item.negative b {
  color: var(--bad);
}

.mineral-img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}

.simple-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.simple-row strong {
  color: var(--accent-2);
  font-weight: 800;
}

/* ---- Form ---- */
.form-grid {
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: 0;
  background: var(--input-bg);
  color: var(--text);
  padding: 0.72rem 0.85rem;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

select option {
  background: var(--surface-solid);
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.split-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.42fr);
  gap: 0.8rem;
}

.split-fields.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mineral-inputs,
.admin-price-list,
.admin-materials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.6rem;
}

.admin-price-list > .primary-action {
  grid-column: 1 / -1;
}

.mineral-field {
  grid-template-columns: auto minmax(0, 1fr) 7rem;
}

.mineral-field input,
.admin-price-row input,
.admin-material-row input {
  text-align: center;
  font-weight: 700;
}

.inline-total {
  color: var(--green);
  font-size: 1.6rem;
  font-weight: 800;
}

/* ============================ CARICHI ============================ */
.load-builder {
  position: relative;
  z-index: 40;
  margin-bottom: 1rem;
  overflow: visible;
}

.load-builder:has(.product-picker.open) {
  z-index: 200;
}

.builder-top {
  display: grid;
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.load-rows {
  display: grid;
  gap: 0.7rem;
}

.load-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 42px;
  gap: 0.8rem;
  align-items: end;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  transition: border-color 220ms var(--ease), background 220ms var(--ease), transform 220ms var(--ease), box-shadow 220ms var(--ease);
}

.load-row:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.load-row.picker-open {
  z-index: 120;
}

.load-row-title {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.row-remove,
.square-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.4rem;
}

.row-remove {
  color: var(--bad);
}

.row-remove:hover {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.load-row-preview {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---- Picker prodotti ---- */
.product-picker {
  position: relative;
  z-index: 1;
}

.product-picker.open {
  z-index: 130;
}

.picker-trigger {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.picker-trigger span,
.picker-option span {
  min-width: 0;
}

.picker-trigger strong,
.picker-trigger small,
.picker-option strong,
.picker-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-trigger small,
.picker-option small {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.picker-trigger b {
  transition: transform 220ms var(--ease);
}

.product-picker.open .picker-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.product-picker.open .picker-trigger b {
  transform: rotate(180deg);
}

.picker-menu {
  position: absolute;
  right: 0;
  left: 0;
  top: calc(100% + 0.45rem);
  z-index: 140;
  display: grid;
  gap: 0.45rem;
  max-height: min(420px, 58vh);
  overflow: hidden;
  padding: 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--elev);
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.product-picker.open .picker-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.picker-menu input {
  min-height: 42px;
}

.picker-options {
  display: grid;
  gap: 0.3rem;
  max-height: 330px;
  overflow: auto;
  padding-right: 0.15rem;
}

.picker-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.7rem;
  text-align: left;
}

.picker-option:hover,
.picker-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.picker-option b {
  flex: 0 0 auto;
  color: var(--gold);
}

.picker-empty {
  margin: 0;
  padding: 0.75rem;
  color: var(--muted);
}

.builder-bottom {
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.load-totals {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.load-totals span {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
}

.load-totals strong {
  color: var(--text);
  font-weight: 800;
}

.material-summary {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.material-line {
  min-height: 48px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  padding: 0.5rem 0.65rem;
}

.material-line small {
  color: var(--muted);
}

/* ---- Tabella carichi ---- */
.load-table-card {
  position: relative;
  z-index: 5;
  padding: 0.9rem;
  overflow-x: auto;
}

.loads-table,
.products-table {
  display: grid;
  gap: 0.4rem;
}

.load-table-head,
.load-table-row {
  display: grid;
  grid-template-columns: 70px 86px 168px minmax(160px, 0.8fr) minmax(150px, 0.8fr) 130px 140px 130px 170px;
  gap: 0.85rem;
  align-items: center;
  min-width: 1180px;
  padding: 0.75rem 0.8rem;
}

.load-table-head,
.products-head {
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.load-table-row,
.product-row,
.ledger-row {
  content-visibility: auto;
  contain-intrinsic-size: 58px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
}

.load-table-row:hover,
.product-row:hover,
.ledger-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateX(2px);
}

.mono {
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.status-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--green-soft);
  box-shadow: 0 0 14px var(--green-soft);
}

.family-pill {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.money-ask {
  color: var(--gold);
  font-weight: 700;
}

.money-profit {
  color: var(--green);
  font-weight: 800;
}

.load-table-row button,
.ledger-meta button,
.row-actions button {
  padding: 0.42rem 0.6rem;
  font-size: 0.78rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ============================ PRODUZIONE ============================ */
.production-headline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.production-headline h2 {
  margin: 0;
  font-size: 1.2rem;
}

.production-headline strong {
  color: var(--green);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.production-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}

.production-card {
  content-visibility: auto;
  contain-intrinsic-size: 300px;
  display: grid;
  gap: 0.85rem;
  min-height: 280px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 260ms var(--ease), border-color 260ms var(--ease), box-shadow 260ms var(--ease), opacity 260ms var(--ease);
}

.production-card.ready {
  border-color: color-mix(in srgb, var(--green) 40%, transparent);
}

.production-card.blocked {
  opacity: 0.66;
}

.production-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}

.production-title {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.production-title strong,
.production-title span,
.production-title em {
  display: block;
}

.production-title strong {
  font-size: 1rem;
  font-weight: 700;
}

.production-title span,
.production-title em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.production-title em {
  flex: 0 0 auto;
  color: var(--gold);
}

.production-number {
  display: grid;
  gap: 0.12rem;
}

.production-number b {
  color: var(--green);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 0.9;
}

.production-number span {
  color: var(--text);
  font-weight: 700;
}

.production-number small,
.production-missing {
  color: var(--muted);
}

.production-economy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.production-economy span {
  display: grid;
  gap: 0.14rem;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
}

.production-economy strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.production-material {
  display: grid;
  grid-template-columns: 26px minmax(0, auto);
  column-gap: 0.35rem;
  align-items: center;
  min-width: 126px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.production-material.limit {
  border-color: color-mix(in srgb, var(--gold) 50%, transparent);
  background: var(--gold-soft);
}

.production-material .mineral-img {
  grid-row: span 2;
  width: 26px;
  height: 26px;
}

.production-material span,
.production-material b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-material span {
  font-size: 0.76rem;
}

.production-material b {
  color: var(--muted);
  font-size: 0.72rem;
}

.production-missing {
  margin: auto 0 0;
  font-size: 0.82rem;
}

/* ============================ REGISTRO ============================ */
.ledger-search {
  max-width: 360px;
}

.ledger-list {
  display: grid;
  gap: 0.55rem;
}

.ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 0.95rem 1rem;
}

.ledger-row strong,
.ledger-row small,
.ledger-row p {
  display: block;
  margin: 0.22rem 0 0;
  overflow-wrap: anywhere;
}

.ledger-row strong {
  font-weight: 700;
}

.ledger-row small,
.ledger-row p,
.ledger-meta {
  color: var(--muted);
}

.type-pill {
  display: inline-flex;
  width: fit-content;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 700;
}

.ledger-meta {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 0.35rem;
  text-align: right;
  font-size: 0.82rem;
}

/* ============================ ADMIN ============================ */
.products-head,
.product-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) 140px minmax(280px, 1.3fr) 110px 130px 230px;
  gap: 0.75rem;
  align-items: center;
  min-width: 980px;
  padding: 0.75rem 0.8rem;
}

.products-table {
  overflow-x: auto;
}

.product-row strong {
  font-weight: 700;
}

.product-editor.is-editing {
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow-2);
}

.product-editor.is-editing #productEditorTitle {
  color: var(--gold);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.inline-price {
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  color: var(--gold);
  font-weight: 800;
  text-align: center;
}

/* ============================ RICHIESTE (bot Discord) ============================ */
.requests-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.request-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 200ms var(--ease);
}

.request-filter:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.request-filter.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-strong));
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-glow);
}

.request-filter .count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
}

.request-filter.active .count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.request-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.request-card {
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem;
}

.request-card.status-pending {
  border-color: color-mix(in srgb, var(--gold) 35%, var(--line));
}

.request-card.status-accepted {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.request-card.status-delivered {
  opacity: 0.82;
}

.request-card.status-cancelled {
  opacity: 0.6;
}

.request-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.request-faction {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.request-faction .faction-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 10px var(--accent-glow);
}

.request-requester {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.request-requester .avatar {
  width: 24px;
  height: 24px;
  font-size: 0.62rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.pending {
  background: var(--gold-soft);
  color: var(--gold);
}

.status-badge.accepted {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.status-badge.delivered {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.cancelled {
  background: var(--bad-soft);
  color: var(--bad);
}

.request-items {
  display: grid;
  gap: 0.4rem;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.request-item.unmatched {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
}

.request-item .qty {
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--accent-2);
}

.request-item .tag-unmatched {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 700;
}

.request-note {
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
}

.request-econ {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.request-econ span {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
}

.request-econ strong {
  color: var(--text);
  font-weight: 800;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--faint);
  font-size: 0.76rem;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.2rem;
}

.request-actions button {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 0 0.8rem;
}

.request-actions .btn-deliver {
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #fff;
}

.request-actions .btn-deliver:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.request-actions .btn-accept {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-strong));
  color: #fff;
}

.request-actions .btn-cancel {
  flex: 0 0 auto;
  color: var(--bad);
}

.request-actions .btn-cancel:hover {
  border-color: var(--bad);
  background: var(--bad-soft);
}

/* ---- Stato vuoto ---- */
.empty-state {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 2.2rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  color: var(--muted);
  text-align: center;
}

.crafted-list {
  display: grid;
  gap: 0.5rem;
}

/* ============================ TOAST ============================ */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--elev);
  color: var(--text);
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================ ANIMAZIONI JS ============================ */
.js-page-enter {
  animation: page-in-forward 520ms var(--ease) both;
}

.js-surface-enter {
  animation: surface-in 480ms var(--ease) both;
}

.js-surface-exit {
  animation: surface-out 200ms ease-in both;
  pointer-events: none;
}

.js-row-enter {
  animation: row-in 380ms var(--ease) both;
  animation-delay: var(--enter-delay, 0ms);
}

.js-row-exit {
  animation: row-out 180ms ease-in both;
  pointer-events: none;
}

/* Reveal fluido allo scroll (gestito da IntersectionObserver in app.js) */
.reveal {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition:
    opacity 0.72s var(--ease),
    transform 0.72s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

::view-transition-old(root) {
  animation: view-out 220ms ease-in both;
}

::view-transition-new(root) {
  animation: view-in 440ms var(--ease) both;
}

@keyframes page-in-forward {
  from { opacity: 0; transform: translate3d(20px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes page-in-back {
  from { opacity: 0; transform: translate3d(-20px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes page-head-in {
  from { opacity: 0; transform: translate3d(0, -10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes surface-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes surface-out {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(0, -8px, 0) scale(0.985); }
}

@keyframes row-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes row-out {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(14px, 0, 0) scale(0.98); }
}

@keyframes view-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.994); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes view-out {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(0, -8px, 0) scale(0.996); }
}

/* ============================ ECLIPSE VISUAL OVERRIDES ============================ */
* {
  letter-spacing: 0 !important;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.42) 0%, rgba(2, 6, 23, 0) 38%),
    linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(2, 6, 23, 0) 34%),
    var(--bg);
}

body::before {
  background:
    linear-gradient(115deg, rgba(34, 197, 94, 0.06), transparent 32%),
    linear-gradient(245deg, rgba(245, 158, 11, 0.045), transparent 38%);
  opacity: 0.9;
}

body::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: none;
  opacity: 0.55;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--primary);
}

::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: var(--secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

::selection {
  background: var(--accent-glow);
  color: var(--accent-light);
}

h1,
h2,
.brand-name,
.nav-link,
.eyebrow,
.metric-card span,
.metric-card strong,
.panel-head h2,
.production-headline h2,
.production-headline strong,
.production-number b,
.request-faction,
.status-badge,
.load-table-head,
.products-head,
.page-head h1,
.inline-total,
.toast {
  font-family: var(--font-heading);
}

.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-light), var(--accent), transparent);
}

.navbar {
  height: var(--nav-h);
  padding: 0 48px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand {
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  font-size: 0;
  animation: glowPulse 2s ease-in-out infinite;
}

.brand-name {
  font-size: 0.92rem;
  color: var(--accent);
}

.nav-center {
  gap: 3px;
  padding: 4px;
  border-color: var(--border);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-indicator {
  top: 4px;
  bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  box-shadow: 0 0 25px var(--accent-glow);
}

.nav-link {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--glass-card);
}

.nav-link.active {
  color: #000;
  font-weight: 700;
}

.nav-link .count,
.request-filter .count {
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold);
  border: 1px solid var(--border-gold, rgba(245, 158, 11, 0.25));
}

.nav-right {
  gap: 10px;
}

.theme-icon,
:root[data-theme="light"] .theme-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  transform: none;
}

.icon-btn,
.profile-trigger,
.discord-login,
.primary-action,
.ghost-action,
.square-action,
.menu-action,
.row-remove,
.picker-trigger,
.picker-option,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button,
.request-filter {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-card);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
  transition:
    transform var(--transition),
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition-slow),
    color var(--transition),
    filter var(--transition);
}

.primary-action,
.discord-login,
.request-filter.active,
.request-actions .btn-accept {
  border-color: transparent;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  box-shadow: none;
}

.primary-action:hover,
.discord-login:hover,
.request-filter.active:hover,
.request-actions .btn-accept:hover {
  background: var(--accent-light);
  color: #000;
  box-shadow: 0 0 25px var(--accent-glow);
  transform: translateY(-1px);
}

.icon-btn:hover,
.profile-trigger:hover,
.ghost-action:hover,
.square-action:hover,
.menu-action:hover,
.picker-trigger:hover,
.picker-option:hover,
.product-row button:hover,
.load-table-row button:hover,
.ledger-meta button:hover,
.request-card button:hover,
.request-filter:hover {
  border-color: var(--border-accent, rgba(34, 197, 94, 0.25));
  background: var(--glass-hover, rgba(30, 41, 59, 0.7));
  color: var(--text);
}

.avatar,
.avatar-large,
.user-avatar {
  background: rgba(34, 197, 94, 0.1);
  border: 2px solid var(--border-accent, rgba(34, 197, 94, 0.25));
  color: var(--accent);
  font-family: var(--font-heading);
}

.profile-menu,
.picker-menu {
  border-color: var(--border-accent, rgba(34, 197, 94, 0.25));
  border-radius: var(--radius-lg);
  background: var(--primary);
  box-shadow: var(--shadow-3);
}

.login-view,
.app-shell {
  z-index: 2;
}

.app-shell {
  padding-top: calc(var(--nav-h) + 32px);
}

.login-card,
.panel-card,
.metric-card,
.load-table-card,
.load-builder,
.request-card,
.production-card,
.stock-item,
.mineral-field,
.simple-row,
.material-line,
.admin-price-row,
.admin-material-row,
.load-row,
.product-row,
.ledger-row,
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--glass-card);
  box-shadow: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    border-color var(--transition),
    box-shadow var(--transition-slow),
    transform var(--transition),
    background var(--transition),
    opacity var(--transition);
}

.login-card:hover,
.panel-card:hover,
.metric-card:hover,
.load-table-card:hover,
.request-card:hover,
.production-card:hover,
.stock-item:hover,
.simple-row:hover,
.load-row:hover,
.product-row:hover,
.ledger-row:hover {
  border-color: var(--border-accent, rgba(34, 197, 94, 0.25));
  box-shadow: 0 0 40px var(--accent-glow);
}

.panel-card + .panel-card,
.page > .panel-card + .panel-card {
  margin-top: 1rem;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  color: var(--text);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.1;
}

.panel-head h2,
.production-headline h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow {
  gap: 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 1px;
  background: var(--accent);
}

.login-card .eyebrow::before {
  display: none;
}

.login-card h1 {
  color: var(--text);
  font-family: var(--font-heading);
  font-size: clamp(32px, 7vw, 56px);
  font-weight: 900;
  -webkit-text-fill-color: currentColor;
  background: none;
}

.login-card p,
.setup-note,
.profile-row small,
.metric-card span,
.field span,
.stock-item small,
.mineral-label small,
.picker-trigger small,
.picker-option small,
.load-row-preview,
.production-title span,
.production-title em,
.production-number small,
.production-missing,
.ledger-row small,
.ledger-row p,
.ledger-meta,
.request-requester,
.request-note,
.request-econ span,
.request-meta {
  color: var(--text-muted);
}

.metric-grid {
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  min-height: 132px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--accent), transparent);
}

.metric-card:nth-child(2)::before,
.metric-card:nth-child(5)::before {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--info), transparent);
}

.metric-card:nth-child(4)::before {
  background: linear-gradient(90deg, #a855f7, transparent);
}

.metric-card::after {
  display: none;
}

.metric-card span,
.field span,
.load-row-title,
.stat-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--text);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.overview-grid,
.admin-grid {
  gap: 20px;
}

.panel-card,
.load-builder,
.request-card {
  padding: 24px;
}

.stock-grid,
.production-list,
.request-grid {
  gap: 14px;
}

.stock-item,
.mineral-field,
.simple-row,
.material-line,
.admin-price-row,
.admin-material-row,
.load-row,
.request-item,
.production-material,
.production-economy span,
.load-totals span,
.request-econ span {
  border-color: var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.5);
}

.stock-item:hover,
.simple-row:hover,
.load-row:hover,
.product-row:hover,
.ledger-row:hover {
  transform: translateY(-3px);
}

.stock-item b,
.stock-item.positive b,
.simple-row strong,
.production-number b,
.production-headline strong,
.inline-total,
.money-profit,
.request-item .qty {
  color: var(--accent);
}

.money-ask,
.picker-option b,
.production-title em,
.production-material.limit,
.status-badge.pending {
  color: var(--gold);
}

.mineral-img {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

input,
select,
textarea {
  min-height: 42px;
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus,
.product-picker.open .picker-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select option {
  background: var(--primary);
  color: var(--text);
}

.load-table-card {
  padding: 0;
  overflow: hidden;
}

.loads-table,
.products-table {
  gap: 0;
  overflow-x: auto;
}

.load-table-head,
.products-head {
  border-radius: 0;
  border-bottom: 1px solid var(--border-accent, rgba(34, 197, 94, 0.25));
  background: var(--primary);
  color: var(--text-muted);
  font-size: 10px;
}

.load-table-row,
.product-row,
.ledger-row {
  border-radius: 0;
  border-width: 0 0 1px;
  border-color: var(--border);
  background: transparent;
}

.load-table-row:last-child,
.product-row:last-child {
  border-bottom: 0;
}

.load-table-row:hover,
.product-row:hover,
.ledger-row:hover {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
  transform: none;
}

.family-pill,
.type-pill,
.status-badge,
.badge {
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent);
}

.status-dot,
.request-faction .faction-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.status-badge.accepted,
.status-badge.delivered {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent);
  border-color: var(--border-accent, rgba(34, 197, 94, 0.25));
}

.status-badge.cancelled,
.danger,
.row-remove,
.request-actions .btn-cancel,
.stock-item.negative b {
  color: var(--bad);
}

.request-card.status-pending,
.product-editor.is-editing {
  border-color: rgba(245, 158, 11, 0.25);
}

.request-card.status-accepted,
.production-card.ready {
  border-color: var(--border-accent, rgba(34, 197, 94, 0.25));
}

.request-actions .btn-deliver {
  border-color: transparent;
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.request-actions .btn-deliver:hover {
  background: var(--accent-light);
  color: #000;
  box-shadow: 0 0 25px var(--accent-glow);
}

.empty-state {
  border-style: dashed;
  border-color: var(--border);
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.35);
}

.toast {
  right: 24px;
  bottom: 24px;
  min-width: 280px;
  border-color: var(--border);
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  transform: translateX(120%);
  transition: transform var(--transition-slow);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.page.active {
  animation: fadeIn 0.4s ease forwards;
}

.page.active .metric-card,
.page.active .panel-card,
.page.active .load-builder,
.page.active .load-table-card,
.page.active .product-editor,
.page.active .request-card,
.js-surface-enter,
.js-page-enter {
  animation: fadeIn 0.4s ease forwards;
}

.js-row-enter {
  animation: fadeIn 0.4s ease both;
  animation-delay: var(--enter-delay, 0ms);
}

.js-surface-exit,
.js-row-exit {
  animation: surface-out 180ms ease-in both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1180px) {
  .overview-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .builder-top,
  .split-fields,
  .split-fields.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .navbar {
    grid-template-columns: auto auto;
  }

  .nav-center {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 70;
    justify-content: flex-start;
    border-radius: var(--r);
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
    box-shadow: var(--shadow-3);
  }

  .app-shell {
    padding-bottom: 6rem;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ledger-search {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .brand-name,
  .trigger-name {
    display: none;
  }

  .navbar {
    padding: 0 0.75rem;
  }

  .app-shell {
    padding-inline: 0.85rem;
  }

  .page-head h1 {
    font-size: 1.7rem;
  }

  .login-card h1 {
    font-size: 2.2rem;
  }

  .mineral-inputs,
  .admin-price-list,
  .admin-materials,
  .stock-grid,
  .compact-stock,
  .material-summary,
  .production-list,
  .production-economy,
  .request-grid {
    grid-template-columns: 1fr;
  }

  .mineral-field,
  .load-row,
  .ledger-row {
    grid-template-columns: 1fr;
  }

  .production-headline,
  .production-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .ledger-meta {
    justify-items: start;
    text-align: left;
  }

  .builder-bottom,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* ============================ WEBSITE PARITY V2 ============================ */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
  --bg: #020617;
  --primary: #0f172a;
  --secondary: #1e293b;
  --tertiary: #263048;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --accent-light: #4ade80;
  --accent-glow: rgba(34, 197, 94, 0.2);
  --gold: #f59e0b;
  --gold-dark: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.2);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #475569;
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(34, 197, 94, 0.25);
  --border-gold: rgba(245, 158, 11, 0.25);
  --glass: rgba(2, 6, 23, 0.75);
  --glass-card: rgba(15, 23, 42, 0.65);
  --glass-hover: rgba(30, 41, 59, 0.7);
  --destructive: #ef4444;
  --destructive-bg: rgba(239, 68, 68, 0.1);
  --destructive-glow: rgba(239, 68, 68, 0.2);
  --info: #3b82f6;
  --font-heading: "Orbitron", monospace;
  --font-body: "JetBrains Mono", monospace;
  --sidebar-w: 264px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}

body::before,
body::after {
  display: none;
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 300;
  display: none;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-card);
  color: var(--text);
  backdrop-filter: blur(10px);
}

.sidebar-toggle svg,
.nav-icon svg {
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.navbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  display: flex;
  width: var(--sidebar-w);
  height: 100vh;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: transform var(--transition-slow);
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-heading);
  text-transform: uppercase;
}

.brand::after {
  grid-column: 1 / -1;
  content: "FiveM Minerals Manager v2.0";
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 10px;
  text-transform: none;
}

.brand-mark {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-size: 0;
}

.brand-mark::before {
  content: "⬡";
  font-size: 15px;
}

.brand-name {
  display: block;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.nav-center {
  position: static;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-self: auto;
  gap: 3px;
  max-width: none;
  padding: 16px 12px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.nav-center::before {
  content: "Menu";
  padding: 12px 10px 4px;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 9px;
  text-transform: uppercase;
}

.nav-indicator {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  transition: all var(--transition);
}

.nav-link:hover {
  border-color: var(--border);
  background: var(--glass-card);
  color: var(--text);
}

.nav-link.active {
  border-color: var(--border-accent);
  background: rgba(34, 197, 94, 0.08);
  color: var(--accent);
}

.nav-icon {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
}

.nav-link .count {
  margin-left: auto;
}

.nav-right {
  display: block;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.nav-right .icon-btn,
.nav-login {
  display: none;
}

.profile {
  width: 100%;
}

.profile-trigger {
  display: none;
}

.profile-menu {
  position: static;
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.profile-row {
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-card);
}

.profile-row strong {
  display: block;
  max-width: 150px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row small {
  color: var(--text-dim);
  font-size: 10px;
}

.avatar,
.avatar-large {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border-accent);
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 11px;
}

.avatar-large {
  width: 36px;
  height: 36px;
}

.menu-action {
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-card);
  color: var(--text);
}

.menu-action:hover {
  border-color: var(--border-accent);
  background: var(--glass-hover);
}

.menu-action.danger {
  color: var(--destructive);
}

.app-shell {
  position: relative;
  z-index: auto;
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0 0 0 var(--sidebar-w);
  padding: 0 0 40px;
}

.page {
  min-height: 100vh;
}

.page-head {
  align-items: flex-start;
  margin: 0 0 28px;
  padding: 32px 32px 0;
}

.page-head h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.page > :not(.page-head) {
  margin-right: 32px;
  margin-left: 32px;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 9px;
  text-transform: uppercase;
}

.welcome-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding: 28px 32px;
  overflow: hidden;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%);
}

.welcome-banner::before {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 200px;
  height: 200px;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.12), transparent);
  pointer-events: none;
}

.welcome-title {
  margin-bottom: 6px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 18px;
}

.welcome-sub {
  color: var(--text-muted);
  font-size: 12px;
}

.welcome-badge {
  flex-shrink: 0;
  padding: 12px 20px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background: rgba(34, 197, 94, 0.1);
  text-align: center;
}

.welcome-badge .rank-val {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 20px;
}

.welcome-badge .rank-lbl {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  position: relative;
  min-height: 118px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--glass-card);
  backdrop-filter: blur(20px);
}

.metric-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--accent), transparent);
}

.metric-card:nth-child(2)::before,
.metric-card:nth-child(5)::before {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--info), transparent);
}

.metric-card:nth-child(4)::before {
  background: linear-gradient(90deg, #a855f7, transparent);
}

.metric-card span,
.metric-card small,
.field span {
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 9px;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 22px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  font-family: var(--font-body);
  text-transform: none;
}

.panel-card,
.load-builder,
.load-table-card,
.request-card,
.production-card,
.stock-item,
.simple-row,
.ledger-row,
.product-row,
.admin-price-row,
.admin-material-row,
.mineral-field,
.material-line,
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--glass-card);
  box-shadow: none;
  backdrop-filter: blur(20px);
  transition: border-color var(--transition), box-shadow var(--transition-slow), transform var(--transition);
}

.panel-card:hover,
.load-builder:hover,
.load-table-card:hover,
.request-card:hover,
.production-card:hover,
.stock-item:hover,
.simple-row:hover,
.product-row:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

.panel-card {
  padding: 24px;
}

.panel-head h2,
.production-headline h2,
.section-title {
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 13px;
  text-transform: none;
}

.overview-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.54fr);
  gap: 20px;
}

.stock-grid,
.compact-stock {
  gap: 14px;
}

.stock-item {
  min-height: 90px;
  padding: 16px;
  border-radius: var(--radius);
}

.stock-item:hover {
  transform: translateY(-3px);
}

.stock-item strong,
.simple-row span,
.item-name {
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 12px;
}

.stock-item b,
.simple-row strong,
.production-number b,
.money-profit,
.request-item .qty {
  color: var(--accent);
  font-family: var(--font-heading);
}

.mineral-img {
  width: 44px;
  height: 44px;
}

.ghost-action,
.primary-action,
.discord-login,
.request-filter,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button,
.row-remove,
.square-action,
.picker-trigger,
.picker-option {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-card);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  transition: all var(--transition);
}

.primary-action,
.request-filter.active,
.request-actions .btn-accept,
.request-actions .btn-deliver {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.primary-action:hover,
.request-filter.active:hover,
.request-actions .btn-accept:hover,
.request-actions .btn-deliver:hover {
  background: var(--accent-light);
  box-shadow: 0 0 25px var(--accent-glow);
  color: #000;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus,
.product-picker.open .picker-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.requests-toolbar,
.filter-bar {
  gap: 8px;
  margin-bottom: 20px;
}

.request-filter {
  padding: 6px 16px;
  border-radius: 100px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 11px;
}

.request-grid {
  gap: 14px;
}

.request-card {
  padding: 20px;
}

.request-faction {
  font-family: var(--font-heading);
  font-size: 13px;
}

.status-badge,
.family-pill,
.type-pill,
.cat-badge,
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 10px;
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}

.load-table-card,
.products-table-wrap {
  padding: 0;
  overflow: hidden;
}

.load-table-head,
.products-head {
  border-bottom: 1px solid var(--border-accent);
  background: var(--primary);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 10px;
  text-transform: uppercase;
}

.load-table-row,
.ledger-row {
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
}

.load-table-row:hover,
.ledger-row:hover {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
  transform: none;
}

.production-list {
  gap: 14px;
}

.production-card {
  min-height: 0;
  padding: 20px;
}

.production-card.blocked {
  opacity: 0.42;
}

.production-economy span,
.production-material,
.request-item,
.request-econ span,
.load-totals span,
.material-line {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.5);
}

.admin-grid {
  grid-template-columns: minmax(360px, 0.44fr) minmax(0, 0.56fr);
  gap: 20px;
  margin-bottom: 20px;
}

.admin-stats-grid {
  margin-bottom: 28px;
}

.admin-price-list,
.admin-materials {
  gap: 10px;
}

.admin-material-row {
  grid-template-columns: 44px minmax(86px, 1fr) 96px;
}

.admin-material-row span,
.admin-price-row span {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.admin-material-row input {
  width: 96px;
}

.products-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  overflow: visible;
}

.product-row.item-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.product-row.item-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.product-row.item-card:hover::before {
  opacity: 1;
}

.item-card-top,
.price-row,
.margin-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-desc,
.price-buy,
.margin-label {
  color: var(--text-muted);
  font-size: 11px;
}

.price-row strong,
.price-sell {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 16px;
}

.inline-price {
  width: 110px;
  min-height: 38px;
  padding: 6px 8px;
  color: var(--accent);
  text-align: right;
}

.margin-label .pct {
  color: var(--gold);
  font-weight: 600;
}

.margin-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--secondary);
}

.margin-fill {
  width: 68%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button,
.product-row button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.product-row button[data-delete-product],
.request-actions .btn-cancel,
.row-remove {
  color: var(--destructive);
}

.product-editor.is-editing {
  border-color: var(--border-gold);
}

.toast {
  right: 24px;
  bottom: 24px;
  min-width: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: translateX(120%);
  transition: transform var(--transition-slow);
}

.toast.show {
  transform: translateX(0);
}

.page.active,
.fade-in,
.js-page-enter,
.js-surface-enter,
.js-row-enter {
  animation: fadeIn 0.4s ease both;
}

.js-row-enter {
  animation-delay: var(--enter-delay, 0ms);
}

@media (max-width: 1180px) {
  .overview-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --sidebar-w: 0px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .navbar {
    width: 264px;
    transform: translateX(-264px);
  }

  .navbar.open {
    transform: translateX(0);
  }

  .app-shell {
    margin-left: 0;
  }

  .page-head {
    padding: 60px 20px 0;
  }

  .page > :not(.page-head) {
    margin-right: 20px;
    margin-left: 20px;
  }
}

@media (max-width: 640px) {
  .welcome-banner,
  .page-head,
  .production-headline,
  .builder-bottom,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .stock-grid,
  .compact-stock,
  .production-list,
  .request-grid,
  .products-table,
  .material-summary,
  .mineral-inputs,
  .admin-price-list,
  .admin-materials,
  .production-economy {
    grid-template-columns: 1fr;
  }

  .mineral-field,
  .load-row,
  .ledger-row {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }
}

/* ============================ DRIVE-IN FRONTEND PARITY ============================ */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
  color-scheme: dark;
  --bg-0: #07070e;
  --bg-1: #0d0d1a;
  --bg-2: #131325;
  --bg-3: #1a1a32;
  --violet: #7c3aed;
  --violet-light: #a78bfa;
  --violet-dim: #4c1d95;
  --violet-glow: rgba(124, 58, 237, 0.18);
  --violet-border: rgba(124, 58, 237, 0.25);
  --amber: #f59e0b;
  --amber-light: #fcd34d;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --amber-border: rgba(245, 158, 11, 0.25);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.15);
  --sky: #38bdf8;
  --crimson: #ef4444;
  --crimson-glow: rgba(239, 68, 68, 0.15);
  --text: #edeef8;
  --muted: #7b7d97;
  --faint: #4a4c62;
  --text-muted: #7b7d97;
  --text-dim: #4a4c62;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --bg: var(--bg-0);
  --primary: var(--bg-1);
  --secondary: var(--bg-2);
  --tertiary: var(--bg-3);
  --surface: var(--bg-1);
  --surface-solid: var(--bg-1);
  --surface-2: var(--bg-2);
  --surface-3: var(--bg-3);
  --elev: var(--bg-1);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --accent: var(--violet);
  --accent-2: var(--violet-light);
  --accent-strong: #6d28d9;
  --accent-light: var(--violet-light);
  --accent-contrast: #ffffff;
  --accent-soft: var(--violet-glow);
  --accent-glow: rgba(124, 58, 237, 0.35);
  --border-accent: var(--violet-border);
  --border-gold: var(--amber-border);
  --gold: var(--amber);
  --gold-soft: var(--amber-glow);
  --destructive: var(--crimson);
  --destructive-bg: var(--crimson-glow);
  --destructive-glow: var(--crimson-glow);
  --info: var(--sky);
  --input-bg: var(--bg-2);
  --grid-line: rgba(255, 255, 255, 0.035);
  --glass: var(--bg-1);
  --glass-card: var(--bg-1);
  --glass-hover: var(--bg-3);
  --font-display: "Space Grotesk", sans-serif;
  --font-heading: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --sidebar-w: 258px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 16px;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 260ms cubic-bezier(0.34, 1.2, 0.64, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.34, 1.2, 0.64, 1);
  --shadow-2: 0 8px 32px rgba(0, 0, 0, 0.22);
  --shadow-3: 0 32px 80px rgba(0, 0, 0, 0.6);
}

html {
  scrollbar-color: var(--bg-3) transparent;
}

body {
  min-width: 320px;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--bg-3);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--violet-dim);
}

.loading-bar {
  z-index: 650;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--violet), var(--violet-light), transparent);
}

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
}

.navbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  display: flex;
  width: var(--sidebar-w);
  min-height: 100vh;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: linear-gradient(180deg, var(--bg-1) 0%, rgba(13, 13, 26, 0.97) 100%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  transform: none;
  transition: transform var(--transition-slow);
}

.brand {
  position: relative;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-display);
  text-transform: none;
}

.brand::after {
  position: absolute;
  left: 64px;
  top: 49px;
  content: "Management";
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--violet-border);
  border-radius: 8px;
  background: var(--violet-glow);
  box-shadow: none;
  color: var(--violet-light);
  font-size: 0;
}

.brand-mark::before {
  content: "◈";
  font-size: 14px;
}

.brand-name {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.nav-center {
  position: static;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-self: auto;
  gap: 1px;
  max-width: none;
  padding: 14px 12px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  scrollbar-width: thin;
}

.nav-center::before {
  content: "Navigazione";
  padding: 8px 10px 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-indicator {
  display: none;
}

.nav-link {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
  transition: background 0.22s var(--ease), color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  transform: none;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22) 0%, rgba(124, 58, 237, 0.07) 100%);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.18);
  color: var(--violet-light);
}

.nav-link.active::before {
  position: absolute;
  left: -12px;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--violet-light) 0%, var(--violet) 100%);
  box-shadow: 2px 0 8px rgba(124, 58, 237, 0.45);
  content: "";
}

.nav-icon {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
  color: currentColor;
  opacity: 0.78;
}

.nav-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
}

.nav-link.active .nav-icon {
  opacity: 1;
}

.nav-link .count,
.request-filter .count {
  margin-left: auto;
  border-radius: 99px;
  background: var(--violet-glow);
  color: var(--violet-light);
  font-size: 10px;
}

.nav-right {
  display: block;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

#themeToggle,
.nav-login,
.profile-trigger {
  display: none !important;
}

.profile,
.profile-menu {
  width: 100%;
}

.profile-menu {
  position: static;
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 0;
  background: transparent;
}

.profile-row strong {
  display: block;
  max-width: 145px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.avatar,
.avatar-large {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--violet-border);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-dim), var(--violet));
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.avatar-large {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.menu-action {
  min-height: 30px;
  justify-content: center;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  box-shadow: none;
}

.menu-action:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.menu-action.danger {
  color: #fca5a5;
}

.app-shell {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0 0 0 var(--sidebar-w);
  padding: 0 0 44px;
}

.page {
  min-height: 100vh;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 30px 36px 0;
}

.page > :not(.page-head) {
  margin-right: 36px;
  margin-left: 36px;
}

.page-head h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.15;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.eyebrow,
.metric-card span,
.metric-card small,
.field span,
.price-label,
.item-card-cat {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  margin-bottom: 28px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
}

.welcome-banner::before {
  display: none;
}

.welcome-title {
  margin: 0 0 4px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.welcome-sub {
  color: var(--text-muted);
  font-size: 13px;
}

.welcome-badge {
  flex-shrink: 0;
  padding: 12px 16px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-sm);
  background: var(--violet-glow);
  text-align: center;
}

.welcome-badge .rank-val {
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.welcome-badge .rank-lbl {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 26px;
  margin-bottom: 28px;
}

.metric-card {
  position: relative;
  min-height: 122px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: none;
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}

.metric-card::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--violet-light) 50%, var(--amber) 100%);
  content: "";
  opacity: 1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.metric-card::after {
  display: none;
}

.metric-card:hover {
  border-color: var(--violet-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(124, 58, 237, 0.12);
  transform: translateY(-2px);
}

.metric-card:hover::before {
  transform: scaleX(1);
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
}

.metric-card:nth-child(1) strong,
.metric-card:nth-child(5) strong,
.price-sell,
.stock-item b,
.production-number b,
.money-profit,
.request-item .qty {
  color: var(--violet-light);
}

.metric-card:nth-child(2) strong,
.price-buy {
  color: var(--crimson);
}

.metric-card:nth-child(3) strong,
.margin-label .pct {
  color: var(--amber);
}

.metric-card:nth-child(4) strong,
.td-amount {
  color: var(--emerald);
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
}

.panel-card,
.load-builder,
.load-table-card,
.request-card,
.production-card,
.stock-item,
.simple-row,
.ledger-row,
.product-row,
.admin-price-row,
.admin-material-row,
.mineral-field,
.material-line,
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: none;
  backdrop-filter: none;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease), background 0.18s var(--ease);
}

.panel-card:hover,
.load-builder:hover,
.load-table-card:hover,
.request-card:hover,
.production-card:hover,
.stock-item:hover,
.simple-row:hover,
.product-row:hover {
  border-color: var(--border-strong);
  box-shadow: none;
  transform: none;
}

.panel-card {
  padding: 0;
  overflow: hidden;
}

.panel-head,
.products-head,
.load-table-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.panel-head h2,
.production-headline h2,
.section-title,
.item-card-name,
.request-faction {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  text-transform: none;
}

.panel-card > :not(.panel-head),
.load-builder,
.load-table-card > :not(.load-table-head) {
  padding: 20px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.5fr);
  gap: 20px;
}

.stock-grid,
.compact-stock,
.production-list,
.request-grid,
.products-table,
.mineral-inputs,
.admin-price-list,
.admin-materials,
.material-summary,
.production-economy {
  gap: 14px;
}

.stock-item,
.production-card,
.request-card,
.product-row.item-card {
  padding: 18px;
}

.stock-item:hover,
.production-card:hover,
.request-card:hover,
.product-row:hover {
  border-color: var(--violet-border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.mineral-img {
  width: 44px;
  height: 44px;
}

.primary-action,
.ghost-action,
.discord-login,
.request-filter,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button,
.row-remove,
.square-action,
.picker-trigger,
.picker-option,
.menu-action {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease), color 0.15s var(--ease);
}

.primary-action,
.discord-login,
.request-actions .btn-accept,
.request-actions .btn-deliver {
  border-color: rgba(124, 58, 237, 0.6);
  background: var(--violet);
  box-shadow: none;
  color: #ffffff;
}

.primary-action:hover,
.discord-login:hover,
.request-actions .btn-accept:hover,
.request-actions .btn-deliver:hover {
  background: #6d28d9;
  box-shadow: 0 0 22px rgba(124, 58, 237, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  filter: none;
  transform: translateY(-1px);
}

.ghost-action,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button,
.square-action,
.picker-trigger,
.picker-option {
  border-color: var(--border-strong);
  background: var(--bg-2);
  color: var(--text);
}

.ghost-action:hover,
.product-row button:hover,
.load-table-row button:hover,
.ledger-meta button:hover,
.request-card button:hover,
.square-action:hover,
.picker-trigger:hover,
.picker-option:hover {
  border-color: var(--violet-border);
  background: var(--bg-3);
  transform: none;
}

.ghost-action.compact,
.primary-action.compact {
  min-height: 32px;
  padding-inline: 10px;
}

.request-card button[data-request-action="cancel"],
.request-card button[data-request-delete],
.product-row button[data-delete-product],
.row-remove {
  border-color: rgba(239, 68, 68, 0.2);
  background: var(--crimson-glow);
  color: #fca5a5;
}

input,
select,
textarea,
.inline-price {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

input:focus,
select:focus,
textarea:focus,
.inline-price:focus,
.product-picker.open .picker-trigger {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

.requests-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  margin-bottom: 20px;
}

.request-filter {
  padding: 7px 14px;
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
}

.request-filter:hover {
  background: var(--bg-2);
  color: var(--text);
}

.request-filter.active {
  border-color: var(--violet-border);
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), rgba(124, 58, 237, 0.07));
  color: var(--violet-light);
}

.request-card.status-pending {
  border-color: var(--violet-border);
}

.request-card.status-accepted {
  border-color: var(--amber-border);
}

.request-card.status-delivered {
  border-color: rgba(16, 185, 129, 0.25);
}

.request-card.status-cancelled {
  border-color: rgba(239, 68, 68, 0.25);
}

.status-badge,
.family-pill,
.type-pill,
.cat-badge,
.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 0;
  border-radius: 99px;
  background: var(--violet-glow);
  color: var(--violet-light);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.status-badge.delivered,
.badge-emerald {
  background: var(--emerald-glow);
  color: var(--emerald);
}

.status-badge.accepted,
.badge-amber {
  background: var(--amber-glow);
  color: var(--amber);
}

.status-badge.cancelled,
.badge-crimson {
  background: var(--crimson-glow);
  color: #fca5a5;
}

.load-table-card {
  padding: 0;
  overflow: hidden;
}

.load-table-head,
.products-head {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.load-table-row,
.ledger-row {
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
}

.load-table-row:hover,
.ledger-row:hover {
  background: rgba(124, 58, 237, 0.05);
  box-shadow: none;
  transform: none;
}

.production-card.blocked {
  opacity: 0.48;
}

.production-economy span,
.production-material,
.request-item,
.request-econ span,
.load-totals span,
.material-line,
.price-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
  gap: 20px;
  margin-bottom: 20px;
}

.admin-stats-grid {
  margin-bottom: 28px;
}

.admin-price-list,
.admin-materials {
  gap: 10px;
}

.admin-price-row {
  display: grid;
  grid-template-columns: 44px minmax(90px, 1fr) 120px;
  align-items: center;
  gap: 10px;
}

.admin-price-row span,
.admin-material-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-price-row input {
  width: 120px;
}

.admin-material-row {
  display: grid;
  grid-template-columns: 44px minmax(90px, 1fr) 96px;
  align-items: center;
  gap: 10px;
}

.admin-material-row input {
  width: 96px;
}

.admin-price-row,
.admin-material-row,
.mineral-field,
.material-line {
  padding: 10px 12px;
}

.products-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  overflow: visible;
}

.product-row.item-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.product-row.item-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--violet-light));
  content: "";
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 0.2s var(--ease), transform 0.3s var(--ease);
}

.product-row.item-card:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

.item-card-top,
.price-row,
.margin-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-desc,
.price-buy,
.margin-label {
  color: var(--text-muted);
  font-size: 11px;
}

.price-row strong,
.price-sell {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.inline-price {
  width: 110px;
  min-height: 36px;
  padding: 6px 8px;
  color: var(--violet-light);
  text-align: right;
}

.margin-bar,
.progress-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--bg-3);
}

.margin-fill,
.progress-fill {
  width: 68%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--violet-light));
  transition: width 0.5s ease;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button,
.product-row button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s var(--ease);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.product-editor.is-editing {
  position: fixed !important;
  top: 50%;
  left: 50%;
  z-index: 520;
  width: min(720px, calc(100vw - 40px));
  max-height: 90vh;
  overflow-y: auto;
  border-color: var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  box-shadow: var(--shadow-3);
  transform: translate(-50%, -50%) !important;
  animation: modalIn 0.25s var(--ease-soft) both !important;
}

.product-editor.is-editing:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-3);
  transform: translate(-50%, -50%) !important;
}

.product-editor.is-editing .panel-head {
  padding: 20px 24px;
}

.product-editor.is-editing #productEditorTitle {
  color: var(--text);
}

.product-editor.is-editing form {
  padding: 24px;
}

.product-editor.is-editing .form-actions {
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.product-editor.is-editing .ghost-action,
.product-editor.is-editing .primary-action {
  width: auto;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 12px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  max-width: 320px;
  min-width: 280px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 13px;
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease-soft);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.page.active,
.fade-in,
.js-page-enter,
.js-surface-enter,
.js-row-enter {
  animation: drivePageEnter 0.28s var(--ease) both;
}

.js-row-enter {
  animation-delay: var(--enter-delay, 0ms);
}

.js-surface-exit,
.js-row-exit {
  animation: driveExit 0.18s ease forwards;
}

@keyframes drivePageEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes driveExit {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 1180px) {
  .overview-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --sidebar-w: 64px;
  }

  .navbar {
    width: 64px;
  }

  .brand {
    min-height: auto;
    justify-content: center;
    padding: 14px;
  }

  .brand::after,
  .brand-name,
  .nav-center::before,
  .nav-link span:not(.nav-icon):not(.count),
  .profile-row div,
  .menu-action {
    display: none;
  }

  .nav-center {
    padding: 10px 8px;
  }

  .nav-link {
    justify-content: center;
    padding: 10px;
  }

  .nav-link.active::before {
    left: -8px;
  }

  .nav-right {
    padding: 14px 8px;
  }

  .profile-row {
    justify-content: center;
  }

  .app-shell {
    margin-left: 64px;
  }
}

@media (max-width: 720px) {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --sidebar-w: 0px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .navbar {
    width: 258px;
    transform: translateX(-258px);
  }

  .navbar.open {
    transform: translateX(0);
  }

  .brand {
    justify-content: flex-start;
    padding: 24px 20px 20px;
  }

  .brand::after,
  .brand-name,
  .nav-center::before,
  .nav-link span:not(.nav-icon):not(.count),
  .profile-row div,
  .menu-action {
    display: revert;
  }

  .nav-center {
    padding: 14px 12px;
  }

  .nav-link {
    justify-content: flex-start;
    padding: 9px 10px;
  }

  .nav-right {
    padding: 14px 16px;
  }

  .profile-row {
    justify-content: flex-start;
  }

  .app-shell {
    margin-left: 0;
  }

  .page-head {
    padding: 60px 20px 0;
  }

  .page > :not(.page-head) {
    margin-right: 20px;
    margin-left: 20px;
  }
}

@media (max-width: 640px) {
  .welcome-banner,
  .page-head,
  .production-headline,
  .builder-bottom,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .stock-grid,
  .compact-stock,
  .production-list,
  .request-grid,
  .products-table,
  .material-summary,
  .mineral-inputs,
  .admin-price-list,
  .admin-materials,
  .production-economy {
    grid-template-columns: 1fr;
  }

  .mineral-field,
  .load-row,
  .ledger-row {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }

  .product-editor.is-editing .ghost-action,
  .product-editor.is-editing .primary-action {
    width: 100%;
  }
}

/* ============================ DRIVE-IN EXACT MOTION LOCK ============================ */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
  --bg-0: #07070E;
  --bg-1: #0D0D1A;
  --bg-2: #131325;
  --bg-3: #1A1A32;
  --violet: #7C3AED;
  --violet-light: #A78BFA;
  --violet-dim: #4C1D95;
  --violet-glow: rgba(124,58,237,0.18);
  --violet-border: rgba(124,58,237,0.25);
  --amber: #F59E0B;
  --amber-light: #FCD34D;
  --amber-glow: rgba(245,158,11,0.15);
  --amber-border: rgba(245,158,11,0.25);
  --emerald: #10B981;
  --emerald-glow: rgba(16,185,129,0.15);
  --sky: #38BDF8;
  --crimson: #EF4444;
  --crimson-glow: rgba(239,68,68,0.15);
  --text: #EDEEF8;
  --text-muted: #7B7D97;
  --text-dim: #4A4C62;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --accent: var(--violet);
  --accent-2: var(--violet-light);
  --accent-light: var(--violet-light);
  --accent-strong: #6D28D9;
  --accent-glow: rgba(124,58,237,0.35);
}

.app-shell {
  animation: pageEnter 0.45s cubic-bezier(0.4,0,0.2,1) both;
}

.page.active,
.js-page-enter {
  animation: pageEnter 0.45s cubic-bezier(0.4,0,0.2,1) both !important;
}

.js-row-enter,
.js-surface-enter {
  animation: none !important;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.nav-link {
  transition: background 0.22s cubic-bezier(0.4,0,0.2,1), color 0.22s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.045);
  color: var(--text);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(124,58,237,0.22) 0%, rgba(124,58,237,0.07) 100%);
  box-shadow: inset 0 0 0 1px rgba(124,58,237,0.18);
  color: var(--violet-light);
}

.primary-action,
.discord-login {
  border-color: rgba(124,58,237,0.6);
  background: var(--violet);
  color: #fff;
  box-shadow: none;
}

.primary-action:hover,
.discord-login:hover {
  background: #6D28D9;
  box-shadow: 0 0 22px rgba(124,58,237,0.35), 0 4px 12px rgba(0,0,0,0.25);
  filter: none;
  transform: none;
}

.ghost-action,
.product-row button,
.load-table-row button,
.ledger-meta button,
.request-card button,
.square-action,
.picker-trigger,
.picker-option {
  background: var(--bg-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.ghost-action:hover,
.product-row button:hover,
.load-table-row button:hover,
.ledger-meta button:hover,
.request-card button:hover,
.square-action:hover,
.picker-trigger:hover,
.picker-option:hover {
  background: var(--bg-3);
  border-color: var(--violet-border);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

.primary-action:active,
.ghost-action:active,
.icon-btn:active,
.product-row button:active,
.request-card button:active {
  transform: scale(0.97);
}

.metric-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color 0.35s cubic-bezier(0.4,0,0.2,1), box-shadow 0.35s, transform 0.35s;
}

.metric-card::before {
  background: linear-gradient(90deg, var(--violet) 0%, var(--violet-light) 50%, var(--amber) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}

.metric-card:hover {
  border-color: var(--violet-border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 0 0 1px rgba(124,58,237,0.12);
  transform: translateY(-2px);
}

.metric-card:hover::before {
  transform: scaleX(1);
}

.panel-card,
.load-builder,
.load-table-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.3s cubic-bezier(0.4,0,0.2,1);
}

.panel-card:hover,
.load-builder:hover,
.load-table-card:hover {
  border-color: var(--border-strong);
  box-shadow: none;
  transform: none;
}

.stock-item,
.production-card,
.request-card,
.product-row.item-card,
.admin-price-row,
.admin-material-row,
.mineral-field,
.material-line,
.simple-row {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color 0.2s cubic-bezier(0.4,0,0.2,1), background 0.18s cubic-bezier(0.4,0,0.2,1);
}

.stock-item:hover,
.production-card:hover,
.request-card:hover,
.product-row.item-card:hover,
.admin-price-row:hover,
.admin-material-row:hover,
.mineral-field:hover,
.material-line:hover,
.simple-row:hover {
  border-color: var(--violet-border);
  box-shadow: none;
  transform: none;
}

.product-row.item-card::before {
  display: none;
}

.load-table-row,
.ledger-row {
  transition: background 0.18s cubic-bezier(0.4,0,0.2,1);
}

.load-table-row:hover,
.ledger-row:hover {
  background: rgba(124,58,237,0.05);
  transform: none;
  box-shadow: none;
}

.modal-backdrop {
  background: rgba(0,0,0,0.65);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.product-editor.is-editing {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  animation: modalDriveIn 0.25s cubic-bezier(0.34,1.2,0.64,1) both !important;
}

@keyframes modalDriveIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 12px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.toast {
  animation: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34,1.3,0.64,1);
}

/* ============================ REQUESTS POLISH ============================ */
.request-grid {
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 18px;
}

.request-card {
  position: relative;
  gap: 14px;
  padding: 20px;
  overflow: hidden;
  min-height: 0;
}

.request-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--violet), transparent);
  content: "";
}

.request-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.request-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--violet-border);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-dim), var(--violet));
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.08);
}

.request-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.request-title-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.request-faction {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-requester {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.request-requester strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-requester span {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

.request-kind {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  line-height: 1;
  text-transform: uppercase;
}

.request-kind.sale {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.10);
  color: #86efac;
}

.request-availability {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-sm);
  background: rgba(124,58,237,0.10);
}

.request-availability span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.request-availability strong {
  color: var(--violet-light);
  font-size: 14px;
  font-weight: 600;
}

.request-items {
  display: grid;
  gap: 8px;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.request-item span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.request-item small {
  color: var(--text-dim);
  font-size: 11px;
}

.request-item .qty {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 14px;
}

.request-item .qty small {
  color: var(--text-dim);
  font-size: 10px;
}

.request-materials {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.08), rgba(255, 255, 255, 0.018));
}

.request-materials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-materials-head span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.request-materials-head strong {
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.request-material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
}

.request-material {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(10, 10, 20, 0.42);
}

.request-material .mineral-img {
  width: 24px;
  height: 24px;
}

.request-material span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-material b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.request-materials.empty p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.request-econ {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.request-econ span {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.request-econ strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.request-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.request-actions button {
  min-width: 0;
}

@media (max-width: 640px) {
  .request-grid {
    grid-template-columns: 1fr;
  }

  .request-head {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .request-head .status-badge {
    grid-column: 1 / -1;
  }

  .request-avatar {
    width: 48px;
    height: 48px;
  }

  .request-econ,
  .request-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================ LOGO + CONFIRM MODAL ============================ */
.brand {
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-height: 94px;
  padding: 20px 20px 18px;
}

.brand::after {
  position: static;
  margin-left: 2px;
  content: "Management";
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.2px;
  line-height: 1;
  text-transform: uppercase;
}

.brand-mark {
  display: block;
  width: 168px;
  height: 46px;
  flex: 0 0 auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark::before {
  display: none !important;
  content: none !important;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.22));
}

.brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 680;
  background: rgba(0, 0, 0, 0.66);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(5px);
  transition: opacity 0.22s var(--ease);
}

.confirm-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 690;
  display: grid;
  width: min(460px, calc(100vw - 32px));
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18, 18, 34, 0.98), rgba(10, 10, 20, 0.98));
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(124, 58, 237, 0.10);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
}

.confirm-modal.open {
  animation: confirm-modal-in 0.28s var(--ease-soft) both;
  pointer-events: auto;
}

.confirm-modal.closing {
  animation: confirm-modal-out 0.2s var(--ease) both;
}

.confirm-logo {
  display: flex;
  align-items: center;
  width: 184px;
  height: 48px;
}

.confirm-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 14px rgba(124, 58, 237, 0.22));
}

.confirm-copy {
  display: grid;
  gap: 8px;
}

.confirm-copy .eyebrow {
  margin: 0;
}

.confirm-copy h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.confirm-copy p:last-child {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.confirm-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.confirm-actions button {
  min-height: 42px;
}

.confirm-modal[data-variant="danger"] {
  border-color: rgba(239, 68, 68, 0.28);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(239, 68, 68, 0.12);
}

.confirm-modal[data-variant="danger"] #confirmSubmit {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(127, 29, 29, 0.88);
  color: #fecaca;
}

.confirm-modal[data-variant="danger"] #confirmSubmit:hover {
  background: rgba(153, 27, 27, 0.96);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.22), 0 4px 12px rgba(0, 0, 0, 0.25);
}

@keyframes confirm-modal-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes confirm-modal-out {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  }
}

@media (max-width: 640px) {
  .brand-mark {
    width: 150px;
    height: 42px;
  }

  .confirm-modal {
    padding: 18px;
  }

  .confirm-logo {
    width: 164px;
    height: 44px;
  }

  .confirm-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================ SIDEBAR REFINEMENT ============================ */
.navbar .brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 3px 10px;
  align-items: center;
  justify-content: start;
  min-height: 88px;
  padding: 20px 18px;
}

.navbar .brand::after {
  position: static;
  grid-column: 2;
  margin: 0;
  content: "Black Market";
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.1px;
  line-height: 1;
  text-transform: uppercase;
}

.navbar .brand-mark {
  grid-row: 1 / span 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--violet-border);
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, rgba(167, 139, 250, 0.24), rgba(124, 58, 237, 0.12) 48%, rgba(14, 14, 28, 0.96));
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.08), 0 10px 28px rgba(0, 0, 0, 0.24);
}

.navbar .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: none;
}

.navbar .brand-name {
  position: static;
  display: block;
  width: auto;
  height: auto;
  overflow: hidden;
  clip: auto;
  clip-path: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar .nav-right {
  padding: 14px;
  background: linear-gradient(180deg, transparent, rgba(124, 58, 237, 0.035));
}

.navbar .profile-menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.navbar .profile-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.navbar .profile-row strong {
  max-width: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.15;
}

.navbar .profile-row small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.9px;
}

.navbar .avatar,
.navbar .avatar-large {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border: 2px solid rgba(124, 58, 237, 0.72);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.25);
}

.navbar .menu-action.danger {
  min-width: 0;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 600;
}

.navbar .menu-action.danger:hover {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

/* ============================ REQUEST FILTER CREATION ============================ */
.request-grid.requests-switching {
  transform-origin: top center;
}

.request-card.request-create-enter {
  animation: request-card-create 620ms var(--ease-soft) both;
  animation-delay: var(--request-delay, 0ms);
}

.request-empty-enter {
  animation: request-card-create 520ms var(--ease-soft) both;
}

@keyframes request-card-create {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(14px) scale(0.985);
  }
  58% {
    opacity: 1;
    filter: blur(0);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

@media (max-width: 900px) {
  .navbar .brand {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 68px;
    padding: 12px 9px;
  }

  .navbar .brand-mark {
    grid-row: auto;
    width: 40px;
    height: 40px;
  }

  .navbar .brand-name,
  .navbar .brand::after,
  .navbar .profile-row div,
  .navbar .menu-action.danger {
    display: none;
  }

  .navbar .profile-menu {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .navbar .profile-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .navbar .brand {
    grid-template-columns: 44px minmax(0, 1fr);
    justify-items: start;
    min-height: 88px;
    padding: 20px 18px;
  }

  .navbar .brand-mark {
    grid-row: 1 / span 2;
    width: 44px;
    height: 44px;
  }

  .navbar .brand-name,
  .navbar .brand::after,
  .navbar .profile-row div,
  .navbar .menu-action.danger {
    display: block;
  }

  .navbar .profile-menu {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: stretch;
    padding: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }

  .navbar .profile-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
}

/* ============================ ORIGINAL BRAND LOGO ============================ */
.navbar .brand {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-height: 96px;
  padding: 18px 16px;
}

.navbar .brand-mark {
  position: relative;
  display: block;
  width: 100%;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(237, 233, 254, 0.92), rgba(196, 181, 253, 0.62)),
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.20), transparent 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 0 0 1px rgba(124, 58, 237, 0.10),
    0 12px 32px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(124, 58, 237, 0.20);
}

.navbar .brand-mark::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 34%, rgba(124, 58, 237, 0.08));
}

.navbar .brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  padding: 4px 8px;
  object-fit: contain;
  object-position: center;
  filter: saturate(1.12) contrast(1.08) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.24));
}

.navbar .brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.navbar .brand::after {
  grid-column: auto;
  justify-self: center;
  content: "Management";
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.25px;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .navbar .brand {
    min-height: 68px;
    padding: 12px 8px;
  }

  .navbar .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .navbar .brand-logo {
    width: 320%;
    max-width: none;
    padding: 3px;
    object-fit: contain;
    object-position: left center;
    transform: translateX(-1px);
  }

  .navbar .brand::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .navbar .brand {
    min-height: 96px;
    padding: 18px 16px;
  }

  .navbar .brand-mark {
    width: 100%;
    height: 52px;
  }

  .navbar .brand-logo {
    width: 100%;
    padding: 4px 8px;
    object-position: center;
    transform: none;
  }

  .navbar .brand::after {
    display: block;
  }
}

/* ============================ STATISTICS DRIVE-IN ============================ */
.statistics-page {
  min-width: 0;
}

.stats-page-head {
  align-items: flex-start;
}

.stats-range-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}

.stats-range {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.22s var(--ease), color 0.18s var(--ease), transform 0.1s var(--ease);
}

.stats-range:hover {
  border-color: var(--violet-border);
  background: var(--bg-3);
  color: var(--text);
}

.stats-range.active {
  border-color: rgba(124, 58, 237, 0.55);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.26), rgba(124, 58, 237, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.stats-range:active {
  transform: scale(0.97);
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
  margin-bottom: 28px;
}

.stats-kpi-card,
.stats-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: none;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease), background 0.18s var(--ease);
}

.stats-kpi-card {
  min-height: 122px;
  padding: 22px;
}

.stats-kpi-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--violet-light), var(--amber));
  content: "";
  opacity: 0.92;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.stats-kpi-card:hover,
.stats-panel:hover {
  border-color: var(--violet-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(124, 58, 237, 0.10);
  transform: translateY(-2px);
}

.stats-kpi-card:hover::before {
  transform: scaleX(1);
}

.stats-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.stats-value {
  margin-top: 9px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.stats-value.accent,
.stats-table td.accent {
  color: var(--violet-light);
}

.stats-value.crimson,
.stats-table td.crimson {
  color: var(--crimson);
}

.stats-value.amber,
.stats-table td.amber {
  color: var(--amber);
}

.stats-value.emerald,
.stats-table td.emerald {
  color: var(--emerald);
}

.stats-trend {
  margin-top: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
}

.stats-chart-row,
.stats-detail-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.stats-chart-row.two,
.stats-detail-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.stats-chart-row.main {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.stats-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.stats-panel-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.stats-chart-body {
  position: relative;
  height: 260px;
  padding: 18px 20px 20px;
}

.stats-chart-body.compact {
  height: 240px;
}

.stats-chart-body canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.stats-ranking {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.stats-ranking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.36fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.stats-rank-left {
  display: grid;
  grid-template-columns: 26px 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stats-rank-index {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--violet-border);
  border-radius: 8px;
  background: var(--violet-glow);
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 11px;
}

.stats-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(124, 58, 237, 0.55);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-dim), var(--violet));
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.stats-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-rank-left strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-rank-left small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.stats-rank-right {
  display: grid;
  gap: 7px;
  text-align: right;
}

.stats-rank-right strong {
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 12px;
}

.stats-progress {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.055);
}

.stats-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--violet-light));
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
}

.stats-table th {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.stats-table th:last-child,
.stats-table td:last-child {
  text-align: right;
}

.stats-table td:last-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 600;
}

.stats-table tbody tr:last-child td {
  border-bottom: 0;
}

.stats-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.045);
}

.stats-empty {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 13px;
}

.stats-enter {
  animation: stats-panel-create 620ms var(--ease-soft) both;
  animation-delay: var(--stats-delay, 0ms);
}

@keyframes stats-panel-create {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(14px) scale(0.985);
  }
  58% {
    opacity: 1;
    filter: blur(0);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

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

  .stats-chart-row.two,
  .stats-chart-row.main,
  .stats-detail-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .stats-page-head {
    gap: 16px;
  }

  .stats-range-bar {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .stats-range {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .stats-kpi-grid {
    grid-template-columns: 1fr;
  }

  .stats-kpi-card {
    min-height: 112px;
  }

  .stats-chart-body,
  .stats-chart-body.compact {
    height: 250px;
    padding: 14px;
  }

  .stats-ranking-row {
    grid-template-columns: 1fr;
  }

  .stats-rank-right {
    text-align: left;
  }
}

/* ============================ RICHIESTE — pagamento, modifica ============================ */
.request-actions .btn-edit {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
}

.request-actions .btn-edit:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.request-pay-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pay-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.pay-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pay-chip.clean {
  color: var(--green);
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
}

.pay-chip.dirty {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
}

.pay-chip.voucher {
  color: var(--violet-light);
  background: rgba(124,58,237,0.14);
  border-color: var(--violet-border);
}

.pay-chip.discount {
  color: var(--violet-light);
  background: linear-gradient(135deg, rgba(124,58,237,0.22), rgba(167,139,250,0.12));
  border-color: rgba(167,139,250,0.42);
}

/* ---- Modale di modifica richiesta ---- */
.req-edit-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(4, 6, 12, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.req-edit-backdrop.show {
  opacity: 1;
}

.req-edit-modal {
  position: fixed;
  z-index: 131;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100vw - 2rem));
  max-height: calc(100vh - 2.4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--elev);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.96);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}

.req-edit-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.req-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.3rem 0.6rem;
}

.req-edit-head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.req-edit-body {
  display: grid;
  gap: 1rem;
  padding: 0.6rem 1.3rem 1rem;
  overflow-y: auto;
}

.req-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.3rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.pay-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.pay-opt {
  min-height: 44px;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  transition: all 0.2s var(--ease);
}

.pay-opt:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.pay-opt.active[data-pay="clean"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #fff;
}

.pay-opt.active[data-pay="dirty"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #1a1300;
}

.pay-hint {
  margin-top: 0.4rem;
  color: var(--faint);
  font-size: 0.76rem;
}

.req-edit-items {
  display: grid;
  gap: 0.55rem;
}

.req-edit-item {
  display: grid;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.req-edit-orig {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 600;
}

.req-edit-item-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 40px;
  gap: 0.5rem;
  align-items: center;
}

.req-edit-product,
.req-edit-qty {
  min-height: 42px;
}

.req-edit-qty {
  text-align: center;
  font-weight: 700;
}

.req-edit-remove {
  display: grid;
  place-items: center;
  width: 40px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--bad);
  font-size: 1rem;
  transition: all 0.2s var(--ease);
}

.req-edit-remove:hover {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.req-edit-add {
  justify-self: start;
}

@media (max-width: 540px) {
  .req-edit-item-fields {
    grid-template-columns: minmax(0, 1fr) 72px 40px;
  }
}

/* ============================ SIDEBAR COLLASSABILE (hover) ============================ */
:root { --sidebar-collapsed: 80px; }

.nav-icon svg {
  width: 18px;
  height: 18px;
}

@media (min-width: 1025px) {
  .navbar {
    width: var(--sidebar-collapsed);
    overflow: hidden;
    transition: width var(--transition-slow, 350ms cubic-bezier(0.4,0,0.2,1)),
                box-shadow var(--transition-slow, 350ms cubic-bezier(0.4,0,0.2,1));
  }

  .navbar:hover {
    width: var(--sidebar-w);
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.55);
  }

  .app-shell {
    margin-left: var(--sidebar-collapsed) !important;
  }

  /* Stato collassato: solo icone, etichette nascoste */
  .navbar:not(:hover) .nav-label,
  .navbar:not(:hover) .brand-name,
  .navbar:not(:hover) .brand::after,
  .navbar:not(:hover) .nav-center::before {
    display: none;
  }

  .navbar:not(:hover) .brand {
    grid-template-columns: auto;
    justify-items: center;
    padding-inline: 0;
  }

  .navbar:not(:hover) .nav-center {
    padding-inline: 14px;
  }

  .navbar:not(:hover) .nav-link {
    justify-content: center;
    position: relative;
  }

  /* Badge richieste come puntino sull'icona quando la sidebar è chiusa */
  .navbar:not(:hover) .nav-link .count {
    position: absolute;
    top: 6px;
    right: 14px;
    min-width: 9px;
    width: 9px;
    height: 9px;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.9);
  }

  /* Footer profilo: in stato chiuso resta centrato e compatto */
  .navbar:not(:hover) .nav-right {
    padding-inline: 0;
    text-align: center;
  }

  /* Logo dedicato per la sidebar collassata */
  .navbar:not(:hover) .brand-mark,
  .navbar:not(:hover) .brand-logo {
    display: none;
  }

  .navbar:not(:hover) .brand-logo-mini {
    display: block;
    width: 46px;
    height: 46px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 12px;
  }
}

.brand-logo-mini {
  display: none;
}

/* ============================ ADMIN: configurazione permessi ============================ */
.admin-config .config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.admin-config textarea {
  resize: vertical;
  font-family: var(--font-body, ui-monospace), monospace;
  line-height: 1.5;
}

.cfg-hint {
  color: var(--faint, rgba(238, 241, 248, 0.4));
  font-size: 0.75rem;
  line-height: 1.4;
}

.cfg-hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3, rgba(255, 255, 255, 0.07));
  font-size: 0.72rem;
}

.row-locked {
  color: var(--faint, rgba(238, 241, 248, 0.4));
}

/* ============================ LISTINO VISIBILITY ============================ */
.listino-toggle {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.listino-toggle input {
  width: 20px;
  height: 20px;
  justify-self: center;
  accent-color: var(--violet);
}

.listino-toggle span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.listino-toggle strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.listino-toggle small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.item-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.listino-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.listino-badge.on {
  background: var(--violet-glow);
  color: var(--violet-light);
}

.listino-badge.off {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.product-row.hidden-listino {
  border-color: rgba(239, 68, 68, 0.18);
}

.product-row.hidden-listino .item-name {
  color: var(--text-muted);
}

/* ============================ SIDEBAR MOTION POLISH ============================ */
:root {
  --sidebar-collapsed: 82px;
  --sidebar-motion: 560ms cubic-bezier(0.22, 0.86, 0.28, 1);
  --sidebar-fade: 460ms cubic-bezier(0.22, 0.86, 0.28, 1);
}

@media (min-width: 1025px) {
  .navbar {
    width: var(--sidebar-collapsed);
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(10, 10, 22, 0.96), rgba(7, 7, 14, 0.98)),
      var(--bg-0);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
    transition:
      width var(--sidebar-motion),
      box-shadow var(--sidebar-motion),
      background 420ms var(--ease);
    will-change: width;
  }

  .navbar:hover,
  .navbar:has(:focus-visible) {
    width: var(--sidebar-w);
    box-shadow:
      24px 0 70px rgba(0, 0, 0, 0.55),
      inset -1px 0 0 rgba(124, 58, 237, 0.16);
  }

  .app-shell {
    margin-left: var(--sidebar-collapsed) !important;
    transition: margin-left var(--sidebar-motion);
  }

  .navbar .brand {
    position: relative;
    min-height: 94px;
    padding: 17px 15px 14px;
    transition: padding var(--sidebar-motion), min-height var(--sidebar-motion);
  }

  .navbar:hover .brand,
  .navbar:has(:focus-visible) .brand {
    min-height: 96px;
    padding: 18px 16px;
  }

  .navbar .brand-mark {
    display: block !important;
    opacity: 1;
    transform: none;
    transition:
      opacity var(--sidebar-fade),
      transform var(--sidebar-motion),
      width var(--sidebar-motion),
      height var(--sidebar-motion);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .brand-mark {
    width: 50px;
    height: 50px;
    margin-inline: auto;
    opacity: 0;
    transform: scale(0.88);
    pointer-events: none;
  }

  .navbar .brand-logo-mini {
    position: absolute;
    top: 20px;
    left: 50%;
    display: block;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 12px;
    opacity: 0;
    transform: translateX(-50%) scale(0.88);
    transition: opacity var(--sidebar-fade), transform var(--sidebar-motion);
    pointer-events: none;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .brand-logo-mini {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  .navbar .brand::after,
  .navbar .nav-center::before,
  .navbar .nav-label,
  .navbar .profile-row div,
  .navbar .menu-action.danger {
    display: block !important;
    opacity: 1;
    transform: none;
    transition:
      opacity var(--sidebar-fade),
      transform var(--sidebar-motion),
      max-width var(--sidebar-motion),
      max-height var(--sidebar-motion);
  }

  .navbar .brand::after,
  .navbar .nav-center::before {
    max-height: 24px;
    overflow: hidden;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .brand::after,
  .navbar:not(:hover):not(:has(:focus-visible)) .nav-center::before {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
  }

  .navbar .nav-center {
    gap: 6px;
    padding: 14px 12px;
    transition: padding var(--sidebar-motion), gap var(--sidebar-motion);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-center {
    gap: 7px;
    padding-inline: 10px;
  }

  .navbar .nav-link {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    min-height: 42px;
    gap: 8px;
    overflow: hidden;
    transition:
      background 220ms var(--ease),
      border-color 300ms var(--ease),
      box-shadow 360ms var(--ease),
      color 300ms var(--ease),
      grid-template-columns var(--sidebar-motion),
      padding var(--sidebar-motion);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-link {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
    padding-inline: 0;
  }

  .navbar .nav-icon {
    justify-content: center;
    transition: transform var(--sidebar-motion), color 220ms var(--ease);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-icon {
    transform: translateX(0);
  }

  .navbar .nav-label {
    display: inline-block !important;
    max-width: 150px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-label {
    max-width: 0;
    opacity: 0;
    transform: translateX(-9px);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-link.active {
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.28), 0 0 18px rgba(124, 58, 237, 0.12);
  }

  .navbar .nav-link .count {
    transition:
      min-width var(--sidebar-motion),
      width var(--sidebar-motion),
      height var(--sidebar-motion),
      font-size var(--sidebar-motion),
      transform var(--sidebar-motion),
      opacity var(--sidebar-fade);
  }

  .navbar .nav-right {
    padding: 12px 10px 14px;
    transition: padding var(--sidebar-motion);
  }

  .navbar:hover .nav-right,
  .navbar:has(:focus-visible) .nav-right {
    padding: 14px;
  }

  .navbar .profile-menu {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    transition:
      grid-template-columns var(--sidebar-motion),
      padding var(--sidebar-motion),
      border-color 340ms var(--ease),
      background 340ms var(--ease),
      box-shadow 380ms var(--ease);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-menu {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    padding: 8px 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .navbar .profile-row {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr);
    transition: grid-template-columns var(--sidebar-motion), gap var(--sidebar-motion);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-row {
    grid-template-columns: 38px;
    justify-content: center;
    gap: 0;
  }

  .navbar .profile-row div {
    max-width: 150px;
    overflow: hidden;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-row div {
    max-width: 0;
    opacity: 0;
    transform: translateX(-8px);
  }

  .navbar .menu-action.danger {
    max-width: 70px;
    overflow: hidden;
    white-space: nowrap;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .menu-action.danger {
    max-width: 0;
    min-width: 0;
    width: 0;
    height: 0;
    padding: 0;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-trigger {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .navbar,
  .navbar *,
  .app-shell {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================ SIDEBAR BADGE + FOOTER FIX ============================ */
.navbar .nav-right {
  margin-top: auto;
  flex: 0 0 auto;
}

.navbar .nav-link .count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  align-self: center;
  justify-self: end;
  margin: 0;
  border: 1px solid rgba(167, 139, 250, 0.36);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.24);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.18);
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
}

@media (min-width: 1025px) {
  .navbar .nav-link {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-link {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-link .count {
    position: absolute;
    top: 5px;
    right: 8px;
    min-width: 18px;
    width: auto;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    line-height: 1;
    transform: none;
  }

  .navbar .profile-menu {
    min-height: 58px;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .nav-right {
    display: grid;
    min-height: 76px;
    align-items: center;
    padding: 12px 10px 16px;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-menu {
    min-height: 52px;
    align-items: center;
    align-content: center;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .profile-row {
    align-items: center;
    justify-items: center;
    min-height: 42px;
  }

  .navbar:not(:hover):not(:has(:focus-visible)) .avatar,
  .navbar:not(:hover):not(:has(:focus-visible)) .avatar-large {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }
}

@media (max-width: 900px) and (min-width: 721px) {
  .navbar .nav-link {
    overflow: visible;
  }

  .navbar .nav-link .count {
    position: absolute;
    top: 5px;
    right: 8px;
    min-width: 18px;
  }

  .navbar .nav-right {
    display: grid;
    min-height: 76px;
    align-items: center;
  }
}

@media (max-width: 720px) {
  .navbar .nav-link {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }
}

/* ============================ REQUEST TYPE TABS ============================ */
.request-type-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 12px;
}

.request-type-tab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)),
    var(--bg-1);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  transition:
    border-color 220ms var(--ease),
    background 220ms var(--ease),
    box-shadow 260ms var(--ease),
    color 220ms var(--ease);
}

.request-type-tab:hover {
  border-color: var(--violet-border);
  background:
    linear-gradient(90deg, rgba(124,58,237,0.12), rgba(124,58,237,0.035)),
    var(--bg-1);
  color: var(--violet-light);
}

.request-type-tab.active {
  border-color: var(--violet-border);
  background:
    linear-gradient(90deg, rgba(124,58,237,0.24), rgba(124,58,237,0.07)),
    var(--bg-2);
  color: var(--violet-light);
  box-shadow: inset 0 0 0 1px rgba(124,58,237,0.1), 0 16px 36px rgba(0,0,0,0.22);
}

.request-type-tab .tab-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.request-type-tab strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-type-tab .count {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  place-items: center;
  border: 1px solid rgba(167,139,250,0.28);
  border-radius: 999px;
  background: rgba(124,58,237,0.14);
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
}

.requests-toolbar {
  margin-top: 0;
}

@media (max-width: 720px) {
  .request-type-tabs {
    grid-template-columns: 1fr;
  }

  .request-type-tab {
    min-height: 64px;
  }
}

/* ============================ VOUCHERS ============================ */
.voucher-action-row {
  display: flex;
  justify-content: flex-start;
  margin: 18px 0 14px;
}

.voucher-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.voucher-summary > div {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)),
    var(--bg-1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.voucher-summary span,
.voucher-reason span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voucher-summary strong {
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1;
}

.voucher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.voucher-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)),
    var(--bg-1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.voucher-card-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.voucher-avatar {
  display: inline-grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(167,139,250,0.42);
  border-radius: 50%;
  background: rgba(124,58,237,0.18);
  box-shadow: 0 0 18px rgba(124,58,237,0.18);
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.voucher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voucher-person {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.voucher-person strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voucher-person span,
.voucher-person small,
.voucher-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.voucher-person small {
  font-family: var(--font-mono);
}

.voucher-value {
  padding: 8px 10px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-sm);
  background: rgba(124,58,237,0.13);
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.voucher-reason {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
}

.voucher-reason p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.voucher-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.voucher-dm {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  color: var(--text-muted);
  font-size: 11px;
}

.voucher-dm.ok {
  border-color: rgba(16,185,129,0.26);
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
}

.voucher-dm.error {
  border-color: rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}

.voucher-error {
  margin: 0;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.45;
}

.voucher-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discount-section {
  display: grid;
  gap: 16px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.discount-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.discount-section-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
}

.discount-section-head p:not(.eyebrow) {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.discount-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.discount-card {
  position: relative;
  overflow: hidden;
}

.discount-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--violet-light), var(--violet));
  opacity: 0.9;
}

.discount-card.used {
  opacity: 0.68;
}

.discount-card-head {
  grid-template-columns: 54px minmax(0, 1fr) auto;
}

.discount-mark {
  display: inline-grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(167,139,250,0.42);
  border-radius: 14px;
  background: rgba(124,58,237,0.18);
  box-shadow: 0 0 18px rgba(124,58,237,0.18);
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
}

.discount-type-toggle,
.discount-target-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.discount-target-panel[hidden] {
  display: none;
}

.discount-type-btn {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.035);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s var(--ease-soft), border-color 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}

.discount-type-btn:hover {
  transform: translateY(-1px);
  border-color: var(--violet-border);
  color: var(--text);
}

.discount-type-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  color: #fff;
  box-shadow: 0 0 18px rgba(124,58,237,0.28);
}

.ghost-action.danger {
  border-color: rgba(239,68,68,0.28);
  background: rgba(127,29,29,0.22);
  color: #fca5a5;
}

.voucher-backdrop,
.sale-settle-backdrop {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(0,0,0,0.66);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  transition: opacity 0.22s var(--ease);
}

.voucher-backdrop.open,
.sale-settle-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.voucher-modal,
.sale-settle-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 710;
  display: grid;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18,18,34,0.98), rgba(10,10,20,0.98));
  box-shadow: 0 34px 90px rgba(0,0,0,0.62), 0 0 0 1px rgba(124,58,237,0.10);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
}

.voucher-modal.open,
.sale-settle-modal.open {
  animation: confirm-modal-in 0.28s var(--ease-soft) both;
  pointer-events: auto;
}

.voucher-modal.closing,
.sale-settle-modal.closing {
  animation: confirm-modal-out 0.2s var(--ease) both;
}

.voucher-modal-head,
.sale-settle-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.voucher-modal-head h2,
.sale-settle-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
}

.voucher-form {
  display: grid;
  gap: 14px;
}

.voucher-modal-actions,
.sale-settle-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.sale-settle-modal {
  width: min(540px, calc(100vw - 32px));
}

.sale-settle-user {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sale-settle-user strong,
.sale-settle-user small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-settle-user strong {
  color: var(--text);
  font-family: var(--font-display);
}

.sale-settle-user small {
  color: var(--text-muted);
  font-size: 12px;
}

.sale-settle-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius);
  background: rgba(124,58,237,0.13);
}

.sale-settle-total span {
  color: var(--text-muted);
  font-size: 12px;
}

.sale-settle-total strong {
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 26px;
}

.sale-settle-actions .cash {
  border-color: rgba(16,185,129,0.24);
  background: rgba(16,185,129,0.10);
  color: #6ee7b7;
}

@media (max-width: 720px) {
  .voucher-summary {
    grid-template-columns: 1fr;
  }

  .voucher-grid {
    grid-template-columns: 1fr;
  }

  .discount-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .discount-grid {
    grid-template-columns: 1fr;
  }

  .voucher-card-head {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .discount-mark {
    width: 48px;
    height: 48px;
  }

  .voucher-value {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .voucher-modal-actions,
  .sale-settle-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ============================ REQUEST EDIT CUSTOM PICKER ============================ */
.req-edit-modal .pay-toggle {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.req-edit-modal .pay-opt.active[data-pay="voucher"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  color: #fff;
  box-shadow: 0 0 18px rgba(124,58,237,0.28);
}

.req-edit-picker {
  width: 100%;
}

.req-edit-picker .picker-trigger {
  min-height: 44px;
  border-color: var(--border-strong);
  background: var(--bg-2);
}

.req-edit-picker .picker-trigger strong {
  color: var(--text);
  font-size: 13px;
}

.req-edit-picker .picker-trigger small {
  color: var(--text-muted);
}

.req-edit-item.picker-open {
  position: relative;
  z-index: 12;
  border-color: var(--violet-border);
  background: linear-gradient(180deg, rgba(124,58,237,0.10), rgba(255,255,255,0.02)), var(--bg-2);
}

.req-edit-item .picker-menu {
  position: static;
  max-height: 0;
  margin-top: 0;
  padding: 0 10px;
  border-width: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 260ms var(--ease),
    margin-top 220ms var(--ease),
    padding 220ms var(--ease),
    opacity 180ms var(--ease),
    transform 220ms var(--ease);
}

.req-edit-item .product-picker.open .picker-menu {
  max-height: min(330px, 42vh);
  margin-top: 8px;
  padding: 10px;
  border-width: 1px;
  opacity: 1;
  transform: translateY(0);
}

.req-edit-item .picker-menu input {
  min-height: 38px;
  border-color: var(--violet-border);
}

.req-edit-item .picker-options {
  max-height: 220px;
}

.req-edit-item .picker-option {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
}

.req-edit-item .picker-option:hover,
.req-edit-item .picker-option.selected {
  border-color: var(--violet-border);
  background: rgba(124,58,237,0.14);
}

.req-edit-item .picker-option b {
  color: var(--violet-light);
  font-size: 12px;
}

@media (max-width: 720px) {
  .req-edit-modal .pay-toggle {
    grid-template-columns: 1fr;
  }
}

/* ============================ NOTIFICATION SETTINGS ============================ */
.profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  grid-column: 1 / -1;
}

.profile-actions .menu-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.profile-actions .menu-action:hover {
  border-color: var(--violet-border);
  background: rgba(124,58,237,0.14);
  color: var(--violet-light);
}

.notif-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 720;
  background: rgba(0,0,0,0.66);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  transition: opacity 0.22s var(--ease);
}

.notif-settings-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.notif-settings-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 730;
  display: grid;
  width: min(520px, calc(100vw - 32px));
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--violet-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(18,18,34,0.98), rgba(10,10,20,0.98));
  box-shadow: 0 34px 90px rgba(0,0,0,0.62), 0 0 0 1px rgba(124,58,237,0.10);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
}

.notif-settings-modal.open {
  animation: confirm-modal-in 0.28s var(--ease-soft) both;
  pointer-events: auto;
}

.notif-settings-modal.closing {
  animation: confirm-modal-out 0.2s var(--ease) both;
}

.notif-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.notif-settings-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
}

.notif-settings-body {
  display: grid;
  gap: 10px;
}

.notif-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.025);
}

.notif-setting-row strong,
.notif-setting-row small {
  display: block;
  min-width: 0;
}

.notif-setting-row strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
}

.notif-setting-row small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.notif-button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.notify-switch {
  position: relative;
  width: 48px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-3);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.notify-switch span {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.22s var(--ease), background 0.22s var(--ease);
}

.notify-switch.active {
  border-color: var(--violet-border);
  background: rgba(124,58,237,0.30);
}

.notify-switch.active span {
  background: var(--violet-light);
  transform: translateX(20px);
}

.notif-settings-actions {
  display: flex;
  justify-content: flex-end;
}

@media (min-width: 1025px) {
  .navbar:not(:hover):not(:has(:focus-visible)) .profile-actions {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  .profile-actions,
  .notif-setting-row {
    grid-template-columns: 1fr;
  }

  .notif-button-row {
    justify-content: stretch;
  }

  .notif-button-row .ghost-action {
    flex: 1 1 120px;
  }

  .notif-settings-actions .primary-action {
    width: 100%;
  }
}

/* ============================ BRIGATA ADAPTER ============================ */
.navbar .brand::after {
  content: "Brigata Ops";
}

.login-card h1 {
  font-family: var(--font-display);
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
}

.brigata-compact-grid {
  grid-template-columns: 1fr;
}

.request-grid.brigata-compact-grid .request-card {
  padding: 16px;
}

.youtube-preview,
.youtube-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.youtube-preview iframe,
.youtube-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.request-items a.request-item {
  color: inherit;
}

.ranking-list,
.dossier-grid,
.role-grid {
  display: grid;
  gap: 14px;
}

.ranking-list.large {
  gap: 16px;
}

.rank-number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--violet-glow);
  color: var(--violet-light);
  font-family: var(--font-display);
  font-weight: 800;
}

.ranking-score {
  color: var(--violet-light);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.dossier-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.dossier-card,
.role-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
}

.dossier-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dossier-card h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
}

.dossier-event {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.dossier-event strong {
  display: block;
  color: var(--text);
}

.dossier-event p {
  margin: 0;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.event-time {
  color: var(--text-dim);
  font-size: 11px;
}

.role-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.role-row {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.role-row strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
}

.role-row small {
  color: var(--text-muted);
}

.role-row code {
  color: var(--violet-light);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 520;
  display: grid;
  width: min(560px, calc(100vw - 40px));
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px)) scale(0.98);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease-soft);
}

.modal.open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  justify-content: flex-end;
}

.danger-action {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--crimson);
}

@media (max-width: 1180px) {
  .report-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
