/* ============================================================================
   NIGHTHUB WEB — design system
   Palette lifted from assets/banner.png: void black, nebula navy, cream
   brushstroke, electric blue, cat-eye glow.
   ========================================================================== */

:root {
  --void:        #04060e;
  --void-2:      #070b18;
  --navy:        #0c1430;
  --navy-2:      #101c40;
  --panel:       rgba(10, 17, 38, 0.66);
  --panel-solid: #0a1126;
  --hairline:    rgba(126, 168, 255, 0.14);
  --hairline-2:  rgba(126, 168, 255, 0.28);

  --cream:       #f7efdc;
  --cream-2:     #ddd4bf;
  --muted:       #8d97b5;
  --muted-2:     #5d6785;

  --blue:        #1e6bff;
  --blue-2:      #2e86ff;
  --blue-soft:   #7fc3ff;
  --glow:        #bfe2ff;

  --good:        #35d39a;
  --warn:        #ffb547;
  --bad:         #ff5470;

  --r-sm: 8px;
  --r:    13px;
  --r-lg: 20px;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --ring:   0 0 0 1px var(--hairline), inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --display: "Impact", "Haettenschweiler", "Arial Narrow Bold", system-ui, sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--void);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* --- ambient cosmos ------------------------------------------------------ */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 78% -8%,  rgba(46, 134, 255, 0.20), transparent 62%),
    radial-gradient(900px 620px at 6% 104%,   rgba(30, 107, 255, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 46%,   rgba(16, 28, 64, 0.85),  transparent 70%),
    linear-gradient(180deg, #05070f 0%, #060a16 46%, #04060e 100%);
}
.cosmos::after {
  /* starfield */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255,255,255,.75), transparent),
    radial-gradient(1.1px 1.1px at 74% 12%, rgba(191,226,255,.65), transparent),
    radial-gradient(1.6px 1.6px at 41% 71%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.1px 1.1px at 88% 62%, rgba(127,195,255,.60), transparent),
    radial-gradient(1.3px 1.3px at 24% 88%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.0px 1.0px at 60% 34%, rgba(255,255,255,.50), transparent),
    radial-gradient(1.5px 1.5px at 93% 28%, rgba(191,226,255,.45), transparent),
    radial-gradient(1.0px 1.0px at 33% 48%, rgba(255,255,255,.35), transparent);
  background-size: 100% 100%;
  opacity: .85;
}

/* the banner itself, blurred to a nebula wash behind everything */
.cosmos-banner {
  position: fixed;
  inset: -12% -6% auto -6%;
  height: 78vh;
  z-index: -1;
  background: url("banner.png") center 28% / cover no-repeat;
  filter: blur(58px) saturate(1.25);
  opacity: .30;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.95), transparent 82%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.95), transparent 82%);
  pointer-events: none;
}

/* --- typography ---------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.wordmark {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream);
  transform: skewX(-6deg);
  text-shadow: 0 0 22px rgba(127, 195, 255, 0.35);
}

.eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.tagline {
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-weight: 700;
}
.tagline .b { color: var(--blue-2); }

.mono { font-family: var(--mono); }
.dim  { color: var(--muted); }

/* --- app shell ----------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(6, 10, 22, 0.92), rgba(4, 6, 14, 0.86));
  backdrop-filter: blur(14px);
  padding: 0 0 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  position: relative;
  height: 108px;
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
}
.sidebar-brand img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% 45%;
  opacity: .95;
}
.sidebar-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4,6,14,.12) 0%, rgba(4,6,14,.86) 100%);
}
.sidebar-brand .brand-text { position: relative; z-index: 1; }
.sidebar-brand .brand-text .wordmark { font-size: 30px; line-height: 1; }
.sidebar-brand .brand-text .sub {
  font-size: 8.5px; letter-spacing: .3em; color: var(--blue-soft);
  text-transform: uppercase; margin-top: 3px; font-weight: 700;
}

.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted-2); padding: 14px 12px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--cream-2); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer; transition: .16s ease;
  position: relative;
}
.nav-item .ico { width: 17px; text-align: center; opacity: .8; font-size: 14px; }
.nav-item:hover { background: rgba(46,134,255,.09); color: var(--cream); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(30,107,255,.22), rgba(30,107,255,.04));
  border-color: var(--hairline-2);
  color: #fff;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: var(--blue-2); box-shadow: 0 0 14px var(--blue-2);
}
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: rgba(46,134,255,.20); color: var(--blue-soft);
  padding: 1px 7px; border-radius: 99px;
}

.sidebar-foot { margin-top: auto; padding: 0 14px; }
.userchip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r);
  background: rgba(12,20,48,.6); border: 1px solid var(--hairline);
}
.userchip .av {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--blue), #0a1a4a);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
}
.userchip .nm { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.userchip .pl { font-size: 10px; color: var(--blue-soft); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }

/* --- main ---------------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(5, 8, 18, 0.55);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; letter-spacing: .01em; }
.topbar .crumb { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.search {
  flex: 1; max-width: 460px; position: relative; margin-left: auto;
}
.search input {
  width: 100%; padding: 9px 13px 9px 34px;
  background: rgba(10,17,38,.75); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); color: var(--cream); font-size: 13px;
  font-family: var(--sans); outline: none; transition: .16s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,255,.16); }
.search .ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); font-size: 13px; pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--panel-solid); border: 1px solid var(--hairline-2);
  border-radius: var(--r); box-shadow: var(--shadow);
  max-height: 330px; overflow-y: auto; padding: 6px;
}
.search-results:empty { display: none; }
.sr-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
}
.sr-item:hover { background: rgba(46,134,255,.12); }
.sr-item .kind {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2); margin-left: auto; font-weight: 700;
}

.content { padding: 24px 26px 60px; flex: 1; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* --- panels & cards ------------------------------------------------------ */
.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  backdrop-filter: blur(10px);
  box-shadow: var(--ring);
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--hairline);
}
.panel-head h3 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--cream-2); }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 16px; }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }

.stat {
  position: relative; overflow: hidden;
  padding: 15px 16px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  transition: .18s ease;
}
.stat:hover { border-color: var(--hairline-2); transform: translateY(-2px); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46,134,255,.22), transparent 68%);
}
.stat .k {
  font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.stat .v {
  font-size: 27px; font-weight: 800; margin-top: 6px;
  letter-spacing: -.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .v.blue { color: var(--blue-soft); text-shadow: 0 0 20px rgba(46,134,255,.45); }
.stat .v.cream { color: var(--cream); }
.stat .d { font-size: 11px; color: var(--muted-2); margin-top: 6px; }

/* cat-eye status dot */
.eye {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--glow);
  box-shadow: 0 0 0 2px rgba(46,134,255,.55), 0 0 12px 2px rgba(46,134,255,.85);
  animation: blinkeye 3.6s ease-in-out infinite;
}
.eye.off {
  background: #3a4360; box-shadow: 0 0 0 2px rgba(90,102,138,.25); animation: none;
}
.eye.busy { background: var(--warn); box-shadow: 0 0 0 2px rgba(255,181,71,.4), 0 0 10px rgba(255,181,71,.7); }
@keyframes blinkeye { 0%,92%,100% { transform: scaleY(1) } 96% { transform: scaleY(.15) } }

/* --- account cards ------------------------------------------------------- */
.accounts { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }

.acct {
  padding: 14px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--hairline);
  transition: .18s ease; cursor: pointer; position: relative; overflow: hidden;
}
.acct:hover { border-color: var(--hairline-2); background: rgba(14,24,54,.78); transform: translateY(-2px); }
.acct.offline { opacity: .62; }
.acct-top { display: flex; align-items: center; gap: 10px; }
.acct-av {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, #14204a, #060b1c);
  border: 1px solid var(--hairline-2);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--blue-soft);
}
.acct-name { font-size: 13.5px; font-weight: 650; line-height: 1.2; }
.acct-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.acct-state {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
}
.acct-meta {
  margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px;
  padding-top: 11px; border-top: 1px solid var(--hairline);
}
.acct-meta .m .mk { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.acct-meta .m .mv { font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: rgba(14,24,54,.7); color: var(--cream);
  font-size: 12.5px; font-weight: 600; font-family: var(--sans);
  cursor: pointer; transition: .16s ease; white-space: nowrap;
}
.btn:hover { background: rgba(30,107,255,.18); border-color: var(--blue); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--blue-2), var(--blue));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 22px rgba(30,107,255,.38);
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: var(--hairline); color: var(--muted); }
.btn.ghost:hover { color: var(--cream); border-color: var(--hairline-2); background: rgba(46,134,255,.08); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn.danger:hover { background: rgba(255,84,112,.16); border-color: var(--bad); color: #ffb9c5; }
.btn.block { width: 100%; justify-content: center; }

/* --- inputs -------------------------------------------------------------- */
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px;
  background: rgba(6,11,26,.8); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); color: var(--cream);
  font-size: 13px; font-family: var(--sans); outline: none; transition: .16s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,255,.15); }
.input::placeholder { color: var(--muted-2); }
select.input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.input option { background: var(--panel-solid); }
.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 6px;
}

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--hairline); background: rgba(10,17,38,.6);
  color: var(--muted); cursor: pointer; transition: .16s;
}
.chip:hover { color: var(--cream); border-color: var(--hairline-2); }
.chip.on { background: rgba(30,107,255,.2); border-color: var(--blue); color: #fff; }

/* --- tables -------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 12px;
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 700; border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: var(--panel-solid); z-index: 2;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(126,168,255,.07); }
.tbl tbody tr { transition: .13s; }
.tbl tbody tr:hover { background: rgba(46,134,255,.07); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- item rows (inventory / mail) ---------------------------------------- */
.item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer; transition: .14s;
}
.item:hover { background: rgba(46,134,255,.09); border-color: var(--hairline); }
.item .glyph {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 15px;
  background: rgba(20,32,74,.8); border: 1px solid var(--hairline);
}

/* Real in-game item images (Gears/Eggs/Packs/Crates); emoji fallback otherwise. */
.ico { display: inline-grid; place-items: center; line-height: 0; }
.ico-img {
  width: 100%; height: 100%; max-width: 32px; max-height: 32px;
  object-fit: contain; image-rendering: auto; display: block;
}
/* In the flat inventory table the icon sits inline next to the name. */
#inv-rows .ico { width: 26px; height: 26px; }
#inv-rows .ico-img { max-width: 26px; max-height: 26px; }
.ico-emoji { font-size: 15px; line-height: 1; }
.item .nm { font-size: 13px; font-weight: 600; line-height: 1.25; }
.item .meta { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.item .qty {
  margin-left: auto; font-family: var(--mono); font-size: 12.5px;
  color: var(--blue-soft); font-weight: 600;
}

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.tag.rainbow { background: linear-gradient(90deg,#ff5470,#ffb547,#35d39a,#2e86ff,#a86bff); color: #04060e; }
.tag.gold    { background: rgba(255,181,71,.2);  color: #ffcf85; }
.tag.frozen  { background: rgba(127,195,255,.18); color: #bfe2ff; }
.tag.shocked { background: rgba(168,107,255,.2); color: #d3b4ff; }
.tag.none    { background: rgba(141,151,181,.14); color: var(--muted); }

/* --- cart ---------------------------------------------------------------- */
.cart-line {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(126,168,255,.08);
}
.cart-line:last-child { border-bottom: none; }
.stepper { display: flex; align-items: center; gap: 0; margin-left: auto; }
.stepper button {
  width: 24px; height: 24px; display: grid; place-items: center;
  background: rgba(14,24,54,.8); border: 1px solid var(--hairline);
  color: var(--cream); cursor: pointer; font-size: 13px; line-height: 1;
}
.stepper button:first-child { border-radius: 6px 0 0 6px; }
.stepper button:last-child  { border-radius: 0 6px 6px 0; }
.stepper button:hover { background: rgba(30,107,255,.24); }
.stepper input {
  width: 46px; height: 24px; text-align: center;
  background: rgba(6,11,26,.9); border: 1px solid var(--hairline);
  border-left: none; border-right: none;
  color: var(--cream); font-family: var(--mono); font-size: 12px; outline: none;
}

/* --- progress / queue ---------------------------------------------------- */
.bar { height: 4px; border-radius: 99px; background: rgba(126,168,255,.12); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--blue-soft));
  box-shadow: 0 0 12px rgba(46,134,255,.7);
  transition: width .4s ease;
}

.order {
  padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--hairline); background: rgba(10,17,38,.55);
  margin-bottom: 10px;
}
.order:last-child { margin-bottom: 0; }
.order-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.order-top .oid { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.status {
  margin-left: auto; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 800; padding: 2px 8px; border-radius: 4px;
}
.status.queued  { background: rgba(141,151,181,.16); color: var(--muted); }
.status.running { background: rgba(46,134,255,.2);  color: var(--blue-soft); }
.status.done    { background: rgba(53,211,154,.16); color: var(--good); }
.status.failed  { background: rgba(255,84,112,.16); color: var(--bad); }
/* Some items delivered, some didn't. Deliberately amber rather than green: this
   used to render as DONE, which read as a clean success even when most of the
   order never arrived. */
.status.partial { background: rgba(255,176,66,.18); color: var(--warn, #ffb042); }

/* --- keys ---------------------------------------------------------------- */
.keycard {
  padding: 15px; border-radius: var(--r);
  border: 1px solid var(--hairline); background: var(--panel);
  position: relative; overflow: hidden; transition: .18s;
}
.keycard:hover { border-color: var(--hairline-2); }
.keycard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--blue-soft), var(--blue));
  box-shadow: 0 0 16px var(--blue);
}
.keycard .kv { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; }
.item.disabled { opacity: .45; cursor: not-allowed; }
.item.disabled:hover { background: transparent; border-color: transparent; }

.nav-item.locked { opacity: .6; }
.nav-item.locked .badge { color: var(--warn); }

/* Roblox avatar headshot next to a verified recipient. */
.rbx-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  object-fit: cover; background: rgba(20, 32, 74, .8);
  border: 1px solid var(--hairline-2);
}

.eye-btn {
  padding: 3px 6px; line-height: 0; flex: 0 0 auto;
  color: var(--muted); border-color: transparent; background: transparent;
}
.eye-btn:hover { color: var(--blue-soft); background: rgba(46,134,255,.12); }
.keycard .seats { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* --- toast --------------------------------------------------------------- */
.toasts {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: var(--r);
  background: rgba(10,17,38,.96); border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow); font-size: 13px; max-width: 340px;
  animation: slidein .26s cubic-bezier(.2,.9,.3,1.4);
}
.toast.ok   { border-left: 3px solid var(--good); }
.toast.err  { border-left: 3px solid var(--bad); }
.toast.info { border-left: 3px solid var(--blue); }
@keyframes slidein { from { opacity: 0; transform: translateX(28px) } to { opacity: 1; transform: none } }

/* --- modal --------------------------------------------------------------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(2,4,10,.76); backdrop-filter: blur(6px);
  display: none; place-items: center; padding: 20px;
}
.modal-bg.open { display: grid; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--panel-solid); border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: none } }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { font-size: 16px; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 0 20px 18px; display: flex; gap: 9px; justify-content: flex-end; }

/* --- empty --------------------------------------------------------------- */
.empty {
  padding: 34px 20px; text-align: center; color: var(--muted-2);
  font-size: 12.5px; line-height: 1.6;
}
.empty .big { font-size: 26px; opacity: .35; margin-bottom: 8px; }

/* --- toggle -------------------------------------------------------------- */
.row-toggle {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid rgba(126,168,255,.07);
}
.row-toggle:last-child { border-bottom: none; }
.row-toggle .t { font-size: 13px; font-weight: 600; }
.row-toggle .s { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.sw {
  margin-left: auto; width: 40px; height: 22px; border-radius: 99px; flex: 0 0 auto;
  background: rgba(126,168,255,.14); border: 1px solid var(--hairline);
  position: relative; cursor: pointer; transition: .18s;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: .18s;
}
.sw.on { background: rgba(30,107,255,.4); border-color: var(--blue); }
.sw.on::after { left: 20px; background: var(--glow); box-shadow: 0 0 10px var(--glow); }

/* ============================ WEB MAIL ================================== */
/* Three columns: Order Dispatcher · Global Inventory · Cart + Active Orders. */
.dispatch-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 328px;
  gap: 14px;
  align-items: start;
}
.dispatch-grid .panel { align-self: start; }
.dispatcher { position: sticky; top: 88px; }
.rail { position: sticky; top: 88px; }

.disp-label {
  display: block; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.mt-8  { margin-top: 8px; }
.mt-18 { margin-top: 18px; }

.disp-hint {
  font-size: 11px; color: var(--muted-2); line-height: 1.5; margin-top: 8px;
}
.disp-hint.ok   { color: var(--good); }
.disp-hint.warn { color: var(--warn); font-weight: 600; }

/* Segmented toggle (Items | Fruit Value, KG | Price) */
.segmented {
  display: inline-flex; width: 100%; padding: 3px; gap: 3px;
  background: rgba(6,11,26,.8); border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
}
.segmented.sm { width: auto; }
.seg {
  flex: 1; padding: 7px 12px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12.5px; font-weight: 600; font-family: var(--sans);
  transition: .15s; white-space: nowrap;
}
.segmented.sm .seg { flex: 0 0 auto; padding: 5px 12px; font-size: 11.5px; }
.seg:hover { color: var(--cream); }
.seg.on {
  background: linear-gradient(180deg, var(--blue-2), var(--blue)); color: #fff;
  box-shadow: 0 4px 14px rgba(30,107,255,.34);
}

/* Batch-mode card */
.disp-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(12,20,48,.5); border: 1px solid var(--hairline);
}
.disp-card-t { font-size: 12.5px; font-weight: 600; }
.disp-card-s { font-size: 11px; color: var(--muted-2); margin-top: 2px; }

/* Fruit-value breakdown */
.fv-rows { margin: 12px 0 2px; display: grid; gap: 1px;
  border: 1px solid var(--hairline); border-radius: var(--r-sm); overflow: hidden; }
.fv-rows:empty { display: none; }
.fv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: rgba(6,11,26,.5); font-size: 12px;
}
.fv-row span { color: var(--muted); }
.fv-row b { font-variant-numeric: tabular-nums; color: var(--cream); }
.fv-row b.fv-corr { color: var(--blue-soft); }

/* Choose-my-account floating menu */
.mini-menu {
  margin-top: 6px; border: 1px solid var(--hairline-2); border-radius: var(--r-sm);
  background: var(--panel-solid); box-shadow: var(--shadow);
  max-height: 240px; overflow-y: auto; padding: 5px;
}
.mini-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.mini-item:hover { background: rgba(46,134,255,.12); }
.mini-nm { font-weight: 600; }
.mini-sub { margin-left: auto; font-size: 10px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .1em; }
.mini-empty { padding: 12px; color: var(--muted-2); font-size: 12px; text-align: center; }
.mini-item.sel { background: rgba(30,107,255,.16); }
.mini-item.sel .mini-nm { color: var(--blue-soft); }

/* "Choose My Account" reflects an active sender selection */
#choose-acct.on {
  background: rgba(30,107,255,.16); border-color: var(--blue); color: var(--cream);
}
#choose-acct.on b { color: var(--blue-soft); font-weight: 700; }

/* Global Inventory header */
.gi-head { align-items: flex-start; }
.gi-sub { display: flex; align-items: center; gap: 12px; margin-top: 5px; font-size: 11.5px; }
.gi-online {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--good); font-weight: 600;
}

/* Inventory search */
.gi-search { position: relative; margin-bottom: 12px; }
.gi-search input {
  width: 100%; padding: 10px 13px 10px 34px;
  background: rgba(6,11,26,.8); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); color: var(--cream); font-size: 13px;
  font-family: var(--sans); outline: none; transition: .16s;
}
.gi-search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,255,.15); }
.gi-search input::placeholder { color: var(--muted-2); }
.gi-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none; }

/* Inventory controls row */
.gi-controls {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(6,11,26,.4); border: 1px solid var(--hairline);
}
.ctrl-label { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.gi-controls .sw { margin-left: 0; }
.kg-in {
  width: 62px !important; padding: 5px 8px !important; font-size: 12px !important;
  font-family: var(--mono); text-align: center;
}

/* The card grid */
.gi-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px; margin-top: 14px;
}
.gi-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 13px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--hairline);
  transition: .16s ease;
}
.gi-card:hover { border-color: var(--hairline-2); transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.gi-card.off { opacity: .55; }
.gi-card-top { display: flex; align-items: flex-start; gap: 10px; }
.gi-card-top .glyph {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 18px;
  background: rgba(20,32,74,.85); border: 1px solid var(--hairline);
}
.gi-card-top .glyph .ico-img { max-width: 30px; max-height: 30px; }
.gi-card-id { min-width: 0; flex: 1; }
.gi-name { font-size: 13px; font-weight: 700; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-cat {
  display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  background: rgba(46,134,255,.16); color: var(--blue-soft);
}
.gi-avail { text-align: right; flex: 0 0 auto; }
.gi-avail span { display: block; font-size: 8.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.gi-avail b { font-size: 20px; font-weight: 800; color: var(--good);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.gi-desc { font-size: 10.5px; color: var(--muted-2); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; }
.gi-stats { display: flex; gap: 14px; font-size: 10.5px; color: var(--muted); }
.gi-stats b { color: var(--cream-2); font-variant-numeric: tabular-nums; }
.gi-stats b.res-on { color: var(--warn); }
.gi-value { font-size: 11px; color: var(--muted); }
.gi-value b { color: var(--good); font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums; }
.gi-actions { display: flex; gap: 6px; margin-top: 2px; }
.gi-qty {
  flex: 1; min-width: 0; padding: 6px 8px !important; font-size: 12px !important;
  font-family: var(--mono); text-align: center;
}
.gi-add, .gi-all { padding: 6px 11px; font-size: 12px; flex: 0 0 auto; }
.gi-add { font-size: 15px; line-height: 1; }

/* Pagination */
.gi-pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.gi-pager:empty { display: none; }
.pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px;
  border: 1px solid var(--hairline); background: rgba(10,17,38,.6);
  color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 600;
  font-family: var(--sans); transition: .15s;
}
.pg:hover:not(:disabled) { color: var(--cream); border-color: var(--hairline-2); }
.pg.on { background: rgba(30,107,255,.24); border-color: var(--blue); color: #fff; }
.pg:disabled { opacity: .35; cursor: not-allowed; }

/* Cart totals */
.cart-tot {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hairline);
  display: grid; gap: 6px;
}
.cart-tot-row { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); }
.cart-tot-row b { color: var(--cream); font-variant-numeric: tabular-nums; }
.cart-tot-row b.tot-val { font-size: 17px; font-weight: 800; color: var(--good);
  text-shadow: 0 0 18px rgba(53,211,154,.35); }

/* Active-order fruit value */
.order-line-val { color: var(--good); font-size: 10.5px; font-weight: 600; }
.order-val {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  padding: 5px 9px; border-radius: var(--r-sm);
  background: rgba(53,211,154,.10); border: 1px solid rgba(53,211,154,.22);
  font-size: 12px; font-weight: 700; color: var(--good);
  font-variant-numeric: tabular-nums;
}
.order-val-sub { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--muted); }

/* Active-order delivery count */
.order-sent { font-size: 11px; font-weight: 700; margin-top: 8px; }
.order-sent.ok   { color: var(--good); }
.order-sent.warn { color: var(--warn); }
.order-sent.bad  { color: var(--bad); }

/* Review-order modal */
.rv-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px;
}
.rv-summary > div {
  padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(6,11,26,.55); border: 1px solid var(--hairline); text-align: center;
}
.rv-summary span { display: block; font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.rv-summary b { font-size: 16px; font-weight: 800; color: var(--cream);
  font-variant-numeric: tabular-nums; }
.rv-summary b.rv-tot { color: var(--good); }
.rv-group {
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  margin-bottom: 10px; overflow: hidden;
}
.rv-group-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: rgba(12,20,48,.6); border-bottom: 1px solid var(--hairline);
  font-size: 12.5px;
}
.rv-group-head .rv-arrow { color: var(--blue-soft); font-size: 11.5px; }
.rv-group-head .rv-mails { margin-left: auto; font-size: 10.5px; color: var(--muted-2); }
.rv-group-head .rv-mails.bad { color: var(--bad); }
.rv-line {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  font-size: 12px; border-bottom: 1px solid rgba(126,168,255,.06);
}
.rv-line:last-child { border-bottom: none; }
.rv-name { flex: 1; min-width: 0; }
.rv-qty  { font-family: var(--mono); color: var(--blue-soft); }
.rv-val  { color: var(--good); font-size: 11px; min-width: 66px; text-align: right; }

@media (max-width: 1180px) {
  .dispatch-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .rail { grid-column: 1 / -1; position: static; display: grid;
    grid-template-columns: 1fr 1fr; gap: 14px; }
  .rail .mt-14 { margin-top: 0; }
}
@media (max-width: 820px) {
  .dispatch-grid { grid-template-columns: 1fr; }
  .dispatcher, .rail { position: static; }
  .rail { grid-template-columns: 1fr; }
}

/* ============================ LOGIN PAGE ================================= */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr;
}
.login-art { position: relative; overflow: hidden; }
.login-art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.login-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4,6,14,.25) 0%, rgba(4,6,14,.15) 55%, rgba(4,6,14,.92) 100%);
}
.login-art .art-foot {
  position: absolute; left: 40px; bottom: 38px; z-index: 2;
}
.login-art .art-foot .tagline { color: var(--cream); }
.login-art .art-foot .rule {
  width: 180px; height: 1px; background: linear-gradient(90deg, var(--blue), transparent);
  margin: 14px 0;
}

.login-pane {
  display: grid; place-items: center; padding: 40px 44px;
  background: rgba(4,6,14,.6); backdrop-filter: blur(8px);
  border-left: 1px solid var(--hairline);
}
.login-box { width: 100%; max-width: 340px; }
.login-box .wordmark { font-size: 40px; line-height: 1; }
.login-box .hi { font-size: 13px; color: var(--muted); margin: 10px 0 26px; line-height: 1.6; }
.divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2); font-weight: 700;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--hairline);
}
.btn-discord {
  width: 100%; justify-content: center; padding: 11px;
  background: #5865f2; border-color: transparent; color: #fff; font-size: 13.5px;
  box-shadow: 0 6px 22px rgba(88,101,242,.34);
}
.btn-discord:hover { background: #6874f5; }
.login-foot { margin-top: 26px; font-size: 11px; color: var(--muted-2); line-height: 1.7; }

/* The mail view: composer + cart side by side, stacking on narrow screens.
   This was an inline `1fr 340px`, which couldn't collapse and was what forced
   the whole page to scroll sideways on a phone. */
.mail-grid { grid-template-columns: 1fr 340px; align-items: start; }

/* Grid and flex children default to min-width:auto, so a wide child (a table,
   a long key string) pushes the whole layout wider than the screen instead of
   scrolling inside its own box. */
.grid > *, .main, .panel, .view { min-width: 0; }

.only-mobile { display: none; }

/* Wide content scrolls inside its own container, never the page body. */
.table-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  html, body { overflow-x: hidden; }

  .login-wrap { grid-template-columns: 1fr; }
  .login-art { height: 230px; }
  .login-art::after { background: linear-gradient(180deg, rgba(4,6,14,.15), rgba(4,6,14,.9)); }
  .login-art .art-foot { left: 24px; bottom: 20px; }
  .login-pane { border-left: none; padding: 28px 20px; }

  .shell { grid-template-columns: 1fr; }

  /* Sidebar becomes a sticky scrolling nav strip. */
  .sidebar {
    position: sticky; top: 0; z-index: 30;
    height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; overflow-y: hidden; padding: 0;
    border-right: none; border-bottom: 1px solid var(--hairline);
    -webkit-overflow-scrolling: touch;
  }
  .sidebar::-webkit-scrollbar { height: 0; }
  .sidebar-brand, .nav-label, .sidebar-foot { display: none; }
  .nav { flex-direction: row; padding: 8px; gap: 4px; flex-wrap: nowrap; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .nav-item.active::before { display: none; }   /* the rail marker needs a column */

  /* Sign out lives in the sidebar footer on desktop, which is hidden here —
     surface it in the topbar instead so mobile users aren't stranded. */
  .only-mobile { display: inline-flex; }

  .topbar {
    padding: 11px 14px; gap: 10px; flex-wrap: wrap;
    top: 0; position: sticky;
  }
  .topbar h1 { font-size: 15px; }
  .search { order: 5; max-width: none; width: 100%; margin-left: 0; }
  #refresh { margin-left: auto; }

  .content { padding: 14px; }

  /* Everything that was a fixed multi-column grid stacks. */
  .mail-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
  .accounts { grid-template-columns: 1fr; }
  .stat .v { font-size: 22px; }

  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head .right { margin-left: 0; width: 100%; }
  .panel-head .right .input { width: 100% !important; }

  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 8px 9px; }

  .modal { max-width: 100%; }
  .toasts { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .toast { max-width: none; }

  .keycard .kv { font-size: 11.5px; word-break: break-all; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .acct-meta { grid-template-columns: 1fr 1fr; }
  .content { padding: 12px 10px; }
  .chips { gap: 6px; }
  .chip { padding: 5px 9px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- scrollbar ----------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(126,168,255,.16); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(126,168,255,.3); background-clip: content-box; }

.scroll-y { overflow-y: auto; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; } .gap-14 { gap: 14px; }
.mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; }
.section-title {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 22px 0 11px;
}
