/*
 * Redfur Trading Dashboard — Dark Terminal Theme
 *
 * Inspired by Fissal Relay: dark metallic shell, green phosphor,
 * amber/gold accents. Everything sits on near-black surfaces.
 * Nav buttons styled as physical terminal switches.
 * Admin panels tinted reddish-orange (#FF4D2D).
 *
 * Fonts: Inter (body), IBM Plex Mono (data/monospace)
 * Fully responsive with fluid typography.
 */

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Bezel / physical shell (dark metallic) ── */
  --bezel:          #1a1d1a;
  --bezel-light:    #242824;
  --bezel-dark:     #0d100d;
  --bezel-edge:     #2a322a;
  --bezel-text:     #c8d0c0;
  --bezel-text-dim: #6b7c6b;
  --bezel-highlight:#d4a24e;

  /* ── Screen / display area ── */
  --screen-bg:      #0a0e0a;
  --screen-panel:   #0f150f;
  --screen-border:  #1a2a1a;
  --screen-glow:    rgba(90, 255, 130, 0.04);

  /* ── Terminal palette (bright RGB on dark) ── */
  --t-green:        #4ade80;
  --t-green-dim:    #22763a;
  --t-cyan:         #22d3ee;
  --t-amber:        #fbbf24;
  --t-orange:       #fb923c;
  --t-red:          #f87171;
  --t-purple:       #c084fc;
  --t-blue:         #60a5fa;
  --t-white:        #e2e8e0;
  --t-dim:          #6b7c6b;
  --t-muted:        #3d4a3d;

  /* ── Gold accent ── */
  --gold:           #d4a24e;
  --gold-dim:       #a07830;
  --gold-bright:    #f0c060;

  /* ── Admin accent (reddish-orange) ── */
  --admin:          #FF4D2D;
  --admin-dim:      #cc3e24;
  --admin-glow:     rgba(255, 77, 45, 0.15);
  --admin-bg:       rgba(255, 77, 45, 0.04);
  --admin-border:   rgba(255, 77, 45, 0.2);
  --redfur-orange:  #e8713a;

  /* ── Fonts ── */
  --font-body:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:      'IBM Plex Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;

  /* ── Fluid type ── */
  --fs-xs:    clamp(0.65rem, 0.6rem + 0.25vw, 0.75rem);
  --fs-sm:    clamp(0.75rem, 0.7rem + 0.3vw,  0.85rem);
  --fs-base:  clamp(0.85rem, 0.8rem + 0.3vw,  0.95rem);
  --fs-md:    clamp(0.95rem, 0.85rem + 0.4vw,  1.1rem);
  --fs-lg:    clamp(1.3rem, 1.1rem + 0.8vw,    1.8rem);

  --radius:   3px;
  --radius-lg: 6px;
  --transition: 0.2s ease;

  /* ── FX Intensity (controlled by JS slider, 0-1) ── */
  --fx-intensity: 0.7;
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: #060806;
  color: var(--t-white);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════════════════════
   TERMINAL SHELL
   ══════════════════════════════════════════════════════════════════════════ */
#terminal-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  box-shadow:
    0 0 0 1px var(--bezel-edge),
    0 4px 24px rgba(0, 0, 0, 0.7);
}

@media (min-width: 1440px) {
  #terminal-shell {
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   HEADER — compact dark bezel bar
   ══════════════════════════════════════════════════════════════════════════ */
#app-header {
  display: flex;
  align-items: center;
  gap: clamp(0.3rem, 1vw, 0.75rem);
  padding: 0.35rem clamp(0.5rem, 1.5vw, 1rem);
  background:
    linear-gradient(180deg, #1e221e 0%, var(--bezel) 40%, var(--bezel-dark) 100%);
  border-bottom: 1px solid var(--bezel-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 2px 8px rgba(0, 0, 0, 0.7);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 20px;
  height: 20px;
  color: var(--gold-bright);
  filter: drop-shadow(0 0 4px rgba(240, 192, 96, 0.4));
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 0 6px rgba(212, 162, 78, 0.25);
}

/* ══════════════════════════════════════════════════════════════════════════
   NAVIGATION — vacuum tube / nixie button style
   ══════════════════════════════════════════════════════════════════════════ */
#app-nav {
  display: flex;
  gap: 3px;
  flex: 1;
  align-items: center;
  overflow: hidden;
}

/* Base vacuum tube button */
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--t-dim);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.35s ease;
  position: relative;
  /* Dark tube housing */
  background:
    radial-gradient(ellipse at 50% 20%, rgba(40, 50, 40, 0.6), transparent 70%),
    linear-gradient(180deg, #1a1f1a 0%, #111511 60%, #0d100d 100%);
  border: 1px solid #252e25;
  border-bottom: 2px solid #080a08;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -2px 6px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Filament wire inside the tube */
.tube-filament {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--t-muted);
  transition: all 0.35s ease;
  flex-shrink: 0;
}

.nav-btn:hover {
  color: var(--t-green);
  border-color: rgba(74, 222, 128, 0.15);
}

.nav-btn:hover .tube-filament {
  background: var(--t-green-dim);
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.3);
}

/* Active — glowing filament, warm tube glow */
.nav-btn.active {
  color: var(--t-green);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(74, 222, 128, 0.08), transparent 60%),
    linear-gradient(180deg, #141a14 0%, #111511 60%, #0d100d 100%);
  border-color: rgba(74, 222, 128, 0.25);
  border-bottom: 1px solid rgba(74, 222, 128, 0.15);
  border-top: 2px solid #080a08;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(74, 222, 128, 0.12),
    0 0 20px rgba(74, 222, 128, 0.05);
}

.nav-btn.active .tube-filament {
  background: var(--t-green);
  box-shadow:
    0 0 6px rgba(74, 222, 128, 0.8),
    0 0 12px rgba(74, 222, 128, 0.4),
    0 0 20px rgba(74, 222, 128, 0.2);
}

.fx-on .nav-btn.active {
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.35);
}

.fx-on .nav-btn.active .tube-filament {
  box-shadow:
    0 0 6px rgba(74, 222, 128, 1),
    0 0 14px rgba(74, 222, 128, 0.6),
    0 0 28px rgba(74, 222, 128, 0.3);
  animation: filamentPulse 2s ease-in-out infinite;
}

@keyframes filamentPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(74, 222, 128, 0.9), 0 0 14px rgba(74, 222, 128, 0.5), 0 0 24px rgba(74, 222, 128, 0.2); }
  50% { box-shadow: 0 0 8px rgba(74, 222, 128, 1), 0 0 18px rgba(74, 222, 128, 0.7), 0 0 30px rgba(74, 222, 128, 0.35); }
}

/* ── Admin navigation buttons — reddish-orange tube ── */
.nav-btn.admin-btn {
  color: var(--admin);
  border-color: rgba(255, 77, 45, 0.12);
}

.nav-btn.admin-btn .tube-filament {
  background: rgba(255, 77, 45, 0.3);
}

.nav-btn.admin-btn:hover {
  color: #ff6b4a;
  border-color: rgba(255, 77, 45, 0.2);
}

.nav-btn.admin-btn:hover .tube-filament {
  background: var(--admin-dim);
  box-shadow: 0 0 4px rgba(255, 77, 45, 0.4);
}

.nav-btn.admin-btn.active {
  color: #ff6b4a;
  border-color: rgba(255, 77, 45, 0.3);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 77, 45, 0.06), transparent 60%),
    linear-gradient(180deg, #1a1210 0%, #151210 60%, #100d0c 100%);
  border-top: 2px solid #0a0605;
  border-bottom: 1px solid rgba(255, 77, 45, 0.15);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(255, 77, 45, 0.12),
    0 0 20px rgba(255, 77, 45, 0.05);
}

.nav-btn.admin-btn.active .tube-filament {
  background: var(--admin);
  box-shadow:
    0 0 6px rgba(255, 77, 45, 0.8),
    0 0 12px rgba(255, 77, 45, 0.4),
    0 0 20px rgba(255, 77, 45, 0.2);
}

.fx-on .nav-btn.admin-btn.active {
  text-shadow: 0 0 6px rgba(255, 77, 45, 0.35);
}

.fx-on .nav-btn.admin-btn.active .tube-filament {
  animation: filamentPulseAdmin 2s ease-in-out infinite;
}

@keyframes filamentPulseAdmin {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 77, 45, 0.9), 0 0 14px rgba(255, 77, 45, 0.5), 0 0 24px rgba(255, 77, 45, 0.2); }
  50% { box-shadow: 0 0 8px rgba(255, 77, 45, 1), 0 0 18px rgba(255, 77, 45, 0.7), 0 0 30px rgba(255, 77, 45, 0.35); }
}

/* Admin separator pip */
.nav-sep {
  width: 2px;
  height: 14px;
  background: var(--t-muted);
  margin: 0 4px;
  border-radius: 1px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   NAV OVERFLOW (responsive collapse for small screens)
   ══════════════════════════════════════════════════════════════════════════ */
.nav-overflow-wrap {
  position: relative;
  flex-shrink: 0;
}

.nav-overflow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border: 1px solid #252e25;
  border-radius: 12px;
  background: linear-gradient(180deg, #1a1f1a 0%, #111511 60%, #0d100d 100%);
  color: var(--t-dim);
  font-size: 1rem;
  font-family: var(--font-mono);
  transition: all 0.25s ease;
}

.nav-overflow-btn:hover {
  color: var(--t-green);
  border-color: rgba(74, 222, 128, 0.2);
}

.nav-overflow-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: linear-gradient(180deg, #1c201c 0%, #141814 100%);
  border: 1px solid var(--bezel-edge);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  z-index: 200;
  padding: 4px 0;
  display: none;
}

.nav-overflow-menu.open { display: block; }

.nav-overflow-menu a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  color: var(--t-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all var(--transition);
}

.nav-overflow-menu a:hover {
  background: rgba(74, 222, 128, 0.06);
  color: var(--t-green);
}

.nav-overflow-menu a.admin-btn {
  color: var(--admin);
}

.nav-overflow-menu a.admin-btn:hover {
  background: rgba(255, 77, 45, 0.06);
  color: #ff6b4a;
}

.nav-overflow-menu .menu-divider {
  height: 1px;
  background: var(--bezel-edge);
  margin: 3px 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   USER AREA + HAMBURGER MENU
   ══════════════════════════════════════════════════════════════════════════ */
#user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--t-muted);
}

.user-name {
  font-size: var(--fs-xs);
  color: var(--t-white);
  font-weight: 500;
}

.user-tag {
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}

/* Username link styling — colored with @ prefix */
.user-tag-link {
  color: var(--t-cyan);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition);
}

.user-tag-link:hover {
  color: var(--t-green);
  text-decoration: underline;
}

.fx-on .user-tag-link:hover {
  text-shadow: 0 0 4px rgba(74, 222, 128, 0.3);
}

/* ── Login button with Discord SVG ── */
.btn-login {
  border-color: #5865F2;
  color: #5865F2;
  gap: 0.35rem;
}

.btn-login:hover { background: rgba(88, 101, 242, 0.12); }

.btn-login .discord-icon {
  width: 16px;
  height: 12px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Hamburger button — heavy metal switch with furnace glow ── */
.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  cursor: pointer;
  border: 1px solid #252e25;
  border-bottom: 2px solid #0c0e0c;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #1a1f1a 0%, #111511 60%, #0d100d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(74, 222, 128, 0.08);
  transition: all var(--transition);
  position: relative;
}

.hamburger-btn::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.15);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.hamburger-btn:hover::before,
.hamburger-btn.open::before {
  opacity: 1;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hamburger-icon span {
  display: block;
  width: 14px;
  height: 1.5px;
  background: var(--t-green);
  border-radius: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.3);
}

.fx-on .hamburger-icon span {
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.hamburger-btn.open .hamburger-icon span:nth-child(1) {
  transform: rotate(45deg) translate(3px, 3px);
}
.hamburger-btn.open .hamburger-icon span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.open .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(3px, -3px);
}

/* ── Dropdown menu — now includes quick settings ── */
.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background:
    linear-gradient(180deg, #1c201c 0%, #141814 100%);
  border: 1px solid var(--bezel-edge);
  border-radius: var(--radius);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  z-index: 200;
  padding: 4px 0;
  display: none;
}

.account-menu.open { display: block; }

.account-menu a,
.account-menu .menu-link {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--t-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all var(--transition);
  cursor: pointer;
}

.account-menu a:hover,
.account-menu .menu-link:hover {
  background: rgba(74, 222, 128, 0.06);
  color: var(--t-green);
}

.account-menu .menu-divider {
  height: 1px;
  background: var(--bezel-edge);
  margin: 3px 0;
}

.account-menu a.menu-danger {
  color: var(--t-red);
}
.account-menu a.menu-danger:hover {
  background: rgba(248, 113, 113, 0.06);
}

/* ── Quick settings inside hamburger ── */
.quick-settings {
  padding: 0.5rem 0.75rem;
}

.quick-settings .qs-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.quick-settings .qs-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.quick-settings .qs-row:last-child {
  margin-bottom: 0;
}

.quick-settings .form-input {
  max-width: none;
  width: 100%;
  padding: 0.25rem 0.4rem;
  font-size: var(--fs-xs);
}

/* ── Discord login link inside hamburger menu ── */
.menu-discord-login {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition);
}
.menu-discord-login:hover {
  background: rgba(88, 101, 242, 0.08);
}
.menu-discord-login .discord-icon {
  width: 20px;
  height: 15px;
  fill: #5865F2;
  flex-shrink: 0;
}
.menu-discord-text {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ── @-Tag checkmark button states ── */
.qs-tag-btn {
  transition: all 0.3s ease;
}
/* Saved / already linked — solid green, disabled */
.qs-tag-btn.qs-tag-saved {
  background: var(--t-green-dim) !important;
  border-color: var(--t-green-dim) !important;
  color: #fff !important;
  opacity: 0.9;
  cursor: default;
}
/* Valid new tag ready to save — pulsing green */
.qs-tag-btn.qs-tag-ready {
  background: var(--t-green-dim) !important;
  border-color: var(--t-green) !important;
  color: #fff !important;
  animation: tagPulseGreen 1.2s ease-in-out infinite;
}
@keyframes tagPulseGreen {
  0%, 100% { box-shadow: 0 0 4px rgba(74, 222, 128, 0.3); }
  50%      { box-shadow: 0 0 12px rgba(74, 222, 128, 0.7); }
}
/* Taken — red, disabled */
.qs-tag-btn.qs-tag-taken {
  background: rgba(248, 113, 113, 0.2) !important;
  border-color: var(--t-red) !important;
  color: var(--t-red) !important;
  opacity: 0.7;
  cursor: default;
}
/* Input field when tag is taken */
.qs-tag-input-taken {
  border-color: var(--t-red) !important;
}
/* Status message under tag input */
.qs-tag-status {
  font-size: 0.6rem;
  line-height: 1.3;
  min-height: 0;
  padding: 0 0.1rem;
  transition: all 0.2s ease;
}
.qs-tag-status-error {
  color: var(--t-red);
  padding-top: 0.15rem;
  padding-bottom: 0.2rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN BEZEL — sunken CRT display
   ══════════════════════════════════════════════════════════════════════════ */
#screen-bezel {
  flex: 1;
  background: var(--screen-bg);
  box-shadow:
    inset 0 4px 16px rgba(0, 0, 0, 0.8),
    inset 0 0 50px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(0, 0, 0, 0.9);
  position: relative;
  overflow-y: auto;
  /* Screen edge groove */
  border-top: 1px solid #050705;
}

.fx-on #screen-bezel {
  background:
    radial-gradient(ellipse at 50% 20%, var(--screen-glow), transparent 70%),
    var(--screen-bg);
}

/* Physical depth lines at top of screen */
#screen-bezel::before {
  content: '';
  position: sticky;
  top: 0;
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(74, 222, 128, 0.06) 20%,
    rgba(74, 222, 128, 0.1) 50%,
    rgba(74, 222, 128, 0.06) 80%,
    transparent 100%
  );
  z-index: 10;
}

#app-content {
  padding: clamp(0.75rem, 2.5vw, 1.5rem);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ── Physical screen section dividers ── */
.screen-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--screen-border) 15%,
    var(--t-muted) 50%,
    var(--screen-border) 85%,
    transparent 100%
  );
  margin: 1.5rem 0;
  position: relative;
}

.screen-divider::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.5) 15%,
    rgba(0, 0, 0, 0.8) 50%,
    rgba(0, 0, 0, 0.5) 85%,
    transparent 100%
  );
}

/* ══════════════════════════════════════════════════════════════════════════
   FOOTER — bottom bezel
   ══════════════════════════════════════════════════════════════════════════ */
#app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem clamp(0.5rem, 1.5vw, 1rem);
  background:
    linear-gradient(0deg, var(--bezel-dark) 0%, var(--bezel) 60%, #1e221e 100%);
  border-top: 1px solid #050705;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 -2px 6px rgba(0, 0, 0, 0.4);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  font-family: var(--font-mono);
}

.footer-status .sync-live { color: var(--t-green); }
.footer-status .sync-stale { color: var(--t-red); }

/* ══════════════════════════════════════════════════════════════════════════
   CRT OVERLAY — scanlines + vignette + animated sweep + flicker + glitch
   ══════════════════════════════════════════════════════════════════════════ */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fx-on .crt-overlay {
  opacity: var(--fx-intensity);
  background:
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.03) 0px,
      rgba(0, 0, 0, 0.03) 1px,
      transparent 1px,
      transparent 3px
    );
}

.crt-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fx-on .crt-overlay::after { opacity: 1; }

/* ── Animated scanline sweep ── */
.crt-scanline {
  position: fixed;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(74, 222, 128, 0.06) 40%,
    rgba(74, 222, 128, 0.03) 100%
  );
  pointer-events: none;
  opacity: 0;
}

.fx-on .crt-scanline {
  opacity: var(--fx-intensity);
  animation: scanlineSweep 8s linear infinite;
}

@keyframes scanlineSweep {
  0%   { top: -4px; }
  100% { top: 100vh; }
}

/* ── Flicker effect ── */
.crt-flicker {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.fx-on .crt-flicker {
  animation: crtFlicker 0.15s infinite;
  opacity: calc(var(--fx-intensity) * 0.03);
}

@keyframes crtFlicker {
  0%   { background: transparent; }
  50%  { background: rgba(74, 222, 128, 0.02); }
  100% { background: transparent; }
}

/* ── Glitch effect (applied to screen content) ── */
.fx-on #app-content {
  animation: crtGlitch 12s step-end infinite;
}

@keyframes crtGlitch {
  0%, 2%   { transform: none; }
  2.1%     { transform: translate(-1px, 0) skewX(-0.3deg); }
  2.4%     { transform: translate(1px, 0) skewX(0.2deg); }
  2.6%, 100% { transform: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   FX TOGGLE
   ══════════════════════════════════════════════════════════════════════════ */
#fx-toggle {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bezel-dark);
  padding: 0.3rem 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--bezel-edge);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--bezel-text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color var(--transition);
}

.fx-on .toggle-label {
  color: var(--t-green);
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.toggle-switch {
  position: relative;
  width: 32px;
  height: 18px;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bezel-edge);
  border-radius: 18px;
  transition: background 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background: var(--bezel-text-dim);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.fx-on .toggle-slider { background: var(--t-green-dim); }

.fx-on .toggle-slider::before {
  transform: translateX(14px);
  background: var(--t-green);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

/* ── FX Intensity slider ── */
.fx-slider {
  width: 52px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bezel-edge);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin-left: 2px;
}

.fx-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 14px;
  background: var(--bezel-text-dim);
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.2s ease;
}

.fx-on .fx-slider::-webkit-slider-thumb {
  background: var(--t-green);
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.4);
}

.fx-slider::-moz-range-thumb {
  width: 10px;
  height: 14px;
  background: var(--bezel-text-dim);
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.fx-on .fx-slider::-moz-range-thumb {
  background: var(--t-green);
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.4);
}

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  background: var(--screen-panel);
  color: var(--t-white);
  font-size: var(--fs-sm);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--t-dim);
}

.btn-login { border-color: #5865F2; color: #5865F2; }
.btn-login:hover { background: rgba(88, 101, 242, 0.12); }

.btn-primary { border-color: var(--gold-dim); color: var(--gold); }
.btn-primary:hover { background: rgba(212, 162, 78, 0.1); border-color: var(--gold); }

.btn-danger { border-color: var(--t-red); color: var(--t-red); }

.btn-logout {
  border-color: var(--t-muted);
  color: var(--t-dim);
  font-size: var(--fs-xs);
  padding: 0.2rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
}

/* ══════════════════════════════════════════════════════════════════════════
   PANELS — screen-area cards with physical depth
   ══════════════════════════════════════════════════════════════════════════ */
.panel {
  background: var(--screen-panel);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  padding: clamp(0.75rem, 2vw, 1.25rem);
  margin-bottom: 1rem;
  position: relative;
  /* Recessed screen well */
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.02);
}

.fx-on .panel {
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.02),
    0 0 12px rgba(74, 222, 128, 0.015);
}

/* ── Holographic depth border on panels (FX active) ── */
.fx-on .panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  background: linear-gradient(135deg,
    rgba(74, 222, 128, 0.08) 0%,
    rgba(34, 211, 238, 0.04) 25%,
    transparent 50%,
    rgba(251, 191, 36, 0.03) 75%,
    rgba(74, 222, 128, 0.06) 100%
  );
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
  pointer-events: none;
  opacity: var(--fx-intensity, 0);
  transition: opacity 0.4s ease;
}

/* ── Admin panel tint — hazard/caution aesthetic ── */
.panel.admin-panel {
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0px,
      transparent 12px,
      rgba(255, 77, 45, 0.015) 12px,
      rgba(255, 77, 45, 0.015) 24px
    ),
    linear-gradient(180deg, rgba(255, 77, 45, 0.03) 0%, var(--screen-panel) 100%);
  border-color: var(--admin-border);
}

.fx-on .panel.admin-panel {
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    0 0 12px rgba(255, 77, 45, 0.03),
    0 0 24px rgba(255, 77, 45, 0.02);
}

/* Holographic border shifts to admin orange palette */
.fx-on .panel.admin-panel::before {
  background: linear-gradient(135deg,
    rgba(255, 77, 45, 0.1) 0%,
    rgba(251, 191, 36, 0.05) 25%,
    transparent 50%,
    rgba(255, 107, 74, 0.04) 75%,
    rgba(255, 77, 45, 0.08) 100%
  );
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--screen-border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t-green);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fx-on .panel-title {
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

/* Admin panel titles in reddish-orange */
.admin-panel .panel-title {
  color: var(--admin);
}

.fx-on .admin-panel .panel-title {
  text-shadow: 0 0 8px rgba(255, 77, 45, 0.3);
}

.admin-panel .panel-header {
  border-bottom-color: var(--admin-border);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   STATS
   ══════════════════════════════════════════════════════════════════════════ */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  gap: 0.5rem;
}

.stat-label {
  color: var(--t-dim);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--t-white);
  text-align: right;
  word-break: break-word;
}

.stat-value.gold   { color: var(--t-amber); }
.stat-value.green  { color: var(--t-green); }
.stat-value.red    { color: var(--t-red); }
.stat-value.orange { color: var(--t-orange); }
.stat-value.cyan   { color: var(--t-cyan); }

.fx-on .stat-value.gold  { text-shadow: 0 0 6px rgba(251, 191, 36, 0.25); }
.fx-on .stat-value.green { text-shadow: 0 0 6px rgba(74, 222, 128, 0.25); }
.fx-on .stat-value.cyan  { text-shadow: 0 0 6px rgba(34, 211, 238, 0.25); }

.stat-big {
  text-align: center;
  padding: 0.75rem 0;
}

.stat-big .value {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--t-amber);
}

.fx-on .stat-big .value {
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.stat-big .label {
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th {
  text-align: left;
  padding: 0.45rem clamp(0.4rem, 1vw, 0.75rem);
  border-bottom: 1px solid var(--t-muted);
  color: var(--t-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  white-space: nowrap;
}

.data-table td {
  padding: 0.35rem clamp(0.4rem, 1vw, 0.75rem);
  border-bottom: 1px solid rgba(26, 42, 26, 0.6);
  color: var(--t-white);
}

.data-table tr:hover td {
  background: rgba(74, 222, 128, 0.03);
}

/* ── Holographic 3D border on table rows (FX active) ── */
.fx-on .data-table tbody tr:hover td {
  box-shadow:
    inset 0 1px 0 rgba(74, 222, 128, 0.08),
    inset 0 -1px 0 rgba(34, 211, 238, 0.05),
    0 0 8px rgba(74, 222, 128, 0.04);
}

.fx-on .data-table tbody tr:hover td:first-child {
  border-left: 1px solid rgba(74, 222, 128, 0.15);
}

.fx-on .data-table tbody tr:hover td:last-child {
  border-right: 1px solid rgba(34, 211, 238, 0.1);
}

.data-table .text-right { text-align: right; }
.data-table .text-mono  { font-family: var(--font-mono); }
.data-table .text-gold  { color: var(--t-amber); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Clickable username cells */
.data-table .clickable-name {
  cursor: pointer;
  color: var(--t-cyan);
  transition: color var(--transition);
}

.data-table .clickable-name:hover {
  color: var(--t-green);
  text-decoration: underline;
}

.fx-on .data-table .clickable-name:hover {
  text-shadow: 0 0 4px rgba(74, 222, 128, 0.3);
}

/* ══════════════════════════════════════════════════════════════════════════
   FORMS & FILTERS
   ══════════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 0.75rem; }

.form-label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--t-dim);
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  max-width: 320px;
  padding: 0.4rem 0.6rem;
  background: var(--screen-bg);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  color: var(--t-white);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--t-green-dim);
}

.fx-on .form-input:focus {
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.15);
}

.form-input::placeholder { color: var(--t-muted); }
select.form-input { cursor: pointer; }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filter-group label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group .form-input {
  max-width: none;
  width: auto;
  min-width: 120px;
}

.filter-group input[type="date"] {
  color-scheme: dark;
}

/* ── Multi-select checkboxes in filter ── */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition);
}

.filter-checkbox:hover { color: var(--t-white); }

.filter-checkbox input[type="checkbox"] {
  accent-color: var(--t-green);
  cursor: pointer;
}

.filter-guild-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filter-guild-group > label:first-child {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════════════════════════
   LEADERBOARD
   ══════════════════════════════════════════════════════════════════════════ */
.leaderboard-rank {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--t-dim);
  min-width: 2rem;
  text-align: center;
}

.leaderboard-rank.top-1 { color: var(--t-amber); }
.leaderboard-rank.top-2 { color: #cbd5e1; }
.leaderboard-rank.top-3 { color: #d97706; }

.fx-on .leaderboard-rank.top-1 { text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }

/* ── Honors / Badges ── */
.honors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.honor-badge {
  padding: 0.6rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.honor-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.honor-badge.honor-gold::before { background: var(--t-amber); box-shadow: 0 0 8px rgba(251, 191, 36, 0.3); }
.honor-badge.honor-green::before { background: var(--t-green); box-shadow: 0 0 8px rgba(74, 222, 128, 0.3); }
.honor-badge.honor-cyan::before { background: var(--t-cyan); box-shadow: 0 0 8px rgba(34, 211, 238, 0.3); }
.honor-badge.honor-vip::before { background: var(--t-purple); box-shadow: 0 0 8px rgba(192, 132, 252, 0.3); }

.honor-badge .honor-icon {
  font-size: 1.2rem;
  display: block;
  margin-bottom: 0.2rem;
}

.honor-badge .honor-title {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.honor-badge .honor-name {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t-white);
}

.honor-badge .honor-detail {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  margin-top: 0.15rem;
}

.honor-badge.honor-gold .honor-name { color: var(--t-amber); }
.honor-badge.honor-green .honor-name { color: var(--t-green); }
.honor-badge.honor-cyan .honor-name { color: var(--t-cyan); }
.honor-badge.honor-vip .honor-name { color: var(--t-purple); }

/* ══════════════════════════════════════════════════════════════════════════
   USER DETAIL PANEL (admin click-through)
   ══════════════════════════════════════════════════════════════════════════ */
.user-detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--screen-border);
}

.user-detail-header .back-btn {
  color: var(--t-dim);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color var(--transition);
  text-decoration: none;
}

.user-detail-header .back-btn:hover {
  color: var(--t-green);
}

.user-detail-header .detail-name {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--t-cyan);
  font-weight: 600;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
  margin-top: 0.5rem;
}

.trend-bar {
  flex: 1;
  background: var(--t-green-dim);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
  position: relative;
}

.trend-bar:hover { background: var(--t-green); }

.trend-bar.current { background: var(--t-amber); }
.trend-bar.current:hover { background: var(--gold-bright); }

/* ══════════════════════════════════════════════════════════════════════════
   BAR CHARTS — terminal-styled horizontal bars
   ══════════════════════════════════════════════════════════════════════════ */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bar-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  min-width: 100px;
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--screen-border);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--t-green-dim), var(--t-green));
  border-radius: 1px;
  transition: width 0.6s ease;
  position: relative;
}

.fx-on .bar-fill {
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.2);
}

.bar-fill-admin {
  background: linear-gradient(90deg, var(--admin-dim), var(--admin));
}

.fx-on .bar-fill-admin {
  box-shadow: 0 0 6px rgba(255, 77, 45, 0.2);
}

.bar-value {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-amber);
  min-width: 70px;
  flex-shrink: 0;
}

.fx-on .bar-value {
  text-shadow: 0 0 4px rgba(251, 191, 36, 0.2);
}

/* ══════════════════════════════════════════════════════════════════════════
   FISSAL CHATBOX — Sales Analysis Sub-Routine terminal
   ══════════════════════════════════════════════════════════════════════════ */
.fissal-panel {
  max-width: 700px;
}

.fissal-title {
  color: var(--t-cyan) !important;
}

.fx-on .fissal-title {
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.3) !important;
}

.fissal-chatbox {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fissal-msg {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}

.fissal-msg-user {
  justify-content: flex-end;
}

.fissal-avatar {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: var(--screen-panel);
  border: 1px solid var(--t-cyan);
  border-radius: 50%;
  flex-shrink: 0;
  color: var(--t-cyan);
}

.fx-on .fissal-avatar {
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.2);
}

.fissal-bubble {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.5;
  max-width: 80%;
}

.fissal-msg-bot .fissal-bubble {
  background: rgba(34, 211, 238, 0.04);
  border: 1px solid rgba(34, 211, 238, 0.12);
  color: var(--t-white);
}

.fissal-msg-user .fissal-bubble {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.15);
  color: var(--t-green);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.fissal-bubble.fissal-error {
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.04);
}

.fissal-rp {
  color: var(--t-dim);
  font-size: var(--fs-xs);
}

.fissal-emote {
  color: var(--t-cyan);
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: help;
}

.fx-on .fissal-emote {
  text-shadow: 0 0 4px rgba(34, 211, 238, 0.3);
}

/* Fissal nav button — cyan accent */
.nav-btn-fissal {
  color: var(--t-cyan) !important;
  border-color: rgba(34, 211, 238, 0.15) !important;
}

.nav-btn-fissal:hover {
  border-color: rgba(34, 211, 238, 0.3) !important;
  box-shadow:
    inset 0 1px 0 rgba(34, 211, 238, 0.05),
    0 0 6px rgba(34, 211, 238, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.nav-btn-fissal.active {
  border-color: rgba(34, 211, 238, 0.3) !important;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(34, 211, 238, 0.1) !important;
}

.fx-on .nav-btn-fissal.active {
  text-shadow: 0 0 6px rgba(34, 211, 238, 0.35) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   LOADING / EMPTY / ERROR
   ══════════════════════════════════════════════════════════════════════════ */
.loading-spinner {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--t-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  animation: pulse 1.5s ease-in-out infinite;
}

.fx-on .loading-spinner {
  color: var(--t-green);
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--t-dim);
  font-size: var(--fs-sm);
}

.error-msg {
  color: var(--t-red);
  padding: 0.5rem 0;
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 3.5rem;
  right: 1rem;
  background: var(--screen-panel);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  color: var(--t-white);
  font-size: var(--fs-sm);
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--t-green-dim); }
.toast.error   { border-color: var(--t-red); }

/* Fissal-specific toast — positioned above and left of the bubble */
.toast.fissal-toast {
  bottom: auto;
  right: 5rem;
  top: auto;
  bottom: 5rem;
  left: auto;
  max-width: 260px;
  z-index: 910;
}

@keyframes slideIn {
  from { transform: translateY(1rem); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--screen-bg); }
::-webkit-scrollbar-thumb { background: var(--t-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--t-dim); }

/* ══════════════════════════════════════════════════════════════════════════
   PRICE CHECK
   ══════════════════════════════════════════════════════════════════════════ */
.price-check-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  align-items: start;
}

.price-filters {
  position: sticky;
  top: 1rem;
  overflow: visible;
}

.pf-group {
  padding: 0.4rem 0.75rem;
  overflow: visible;
}

.pf-group:first-of-type { padding-top: 0; }

.pf-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.price-results { min-width: 0; }

.pc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.pc-item {
  background: var(--screen-bg);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  transition: all var(--transition);
}

.pc-item:hover {
  border-color: var(--t-green-dim);
  background: rgba(74, 222, 128, 0.03);
}

.fx-on .pc-item:hover {
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.1);
}

.pc-item-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.pc-item-name {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.quality-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trait-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--t-dim);
  background: rgba(107, 124, 107, 0.15);
  border: 1px solid var(--t-muted);
  border-radius: 2px;
  padding: 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  line-height: 1.4;
}

.pc-item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  margin-bottom: 0.2rem;
}

.pc-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--t-white);
}

.pc-stat-label {
  color: var(--t-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.3px;
}

.pc-item-guilds {
  font-size: 0.6rem;
  color: var(--t-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-pagination {
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: center;
}

.pc-pages {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.pc-pages .btn {
  padding: 0.15rem 0.45rem;
  font-size: var(--fs-xs);
  min-width: 1.6rem;
  justify-content: center;
}

.pc-pages .btn.btn-primary {
  background: rgba(212, 162, 78, 0.12);
}

/* ── Item icon in search results ── */
.pc-item-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  image-rendering: pixelated;
  border-radius: 2px;
}

/* ── Item detail icon ── */
.detail-item-icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid var(--screen-border);
}

.detail-header-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.detail-section-title {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--t-green);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Detail filter bar ── */
.detail-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--screen-border);
}

.detail-filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-time-mode {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.3rem;
}

/* ── CRT Date Picker ── */
.crt-date-picker {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.crt-date-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.crt-date-input {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  background: var(--screen-bg);
  border: 1px solid var(--screen-border);
  color: var(--t-green);
  border-radius: var(--radius);
  padding: 0.25rem 0.4rem;
}

.crt-date-input:focus {
  border-color: var(--t-green-dim);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.15);
  outline: none;
}

/* ── Guild Filter Dropdown ── */
.guild-filter-dropdown {
  position: relative;
  min-width: 160px;
  z-index: 100;
}

.guild-dd-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 0.3rem;
  font-size: var(--fs-xs);
  padding: 0.3rem 0.5rem;
  min-height: 1.8rem;
  background: var(--screen-bg);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  color: var(--t-white);
  font-family: var(--font-mono);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.guild-dd-trigger:hover {
  border-color: var(--t-green-dim);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.1);
}

.guild-dd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.guild-dd-arrow {
  flex-shrink: 0;
  color: var(--t-dim);
}

.guild-dd-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--screen-panel);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  max-height: 320px;
  overflow-y: auto;
  min-width: 220px;
}

.guild-dd-search-wrap {
  padding: 0.35rem;
  border-bottom: 1px solid var(--screen-border);
}

.guild-dd-search {
  width: 100%;
  font-size: var(--fs-xs);
  padding: 0.2rem 0.4rem;
}

.guild-dd-options {
  padding: 0.2rem 0;
}

.guild-dd-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  transition: background 0.1s;
}

.guild-dd-option:hover {
  background: rgba(74, 222, 128, 0.06);
}

.guild-dd-check {
  width: 1rem;
  flex-shrink: 0;
  text-align: center;
  color: var(--t-green);
}

.guild-dd-special {
  color: var(--t-white);
  font-weight: 500;
}

.guild-dd-redfur-all {
  color: var(--redfur-orange, #e8713a);
}

.guild-dd-redfur {
  color: var(--redfur-orange, #e8713a);
}

.guild-dd-other {
  color: var(--t-dim);
}

.guild-dd-group-label {
  padding: 0.35rem 0.6rem 0.15rem;
  font-size: 0.55rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t-muted);
  border-top: 1px solid var(--screen-border);
  margin-top: 0.2rem;
}

.guild-dd-redfur-label {
  color: var(--redfur-orange, #e8713a);
}

.guild-dd-other-label {
  color: var(--t-red);
}

/* ══════════════════════════════════════════════════════════════════════════
   HAMBURGER AUTH STATES
   ══════════════════════════════════════════════════════════════════════════ */

/* Pulse reddish-orange — no auth at all */
.hamburger-btn.hb-pulse-orange .hamburger-icon span {
  background: #e8522a;
  box-shadow: 0 0 4px rgba(232, 82, 42, 0.4);
}
.hamburger-btn.hb-pulse-orange::before {
  opacity: 1;
  box-shadow: 0 0 6px rgba(232, 82, 42, 0.25);
  animation: hbPulseOrange 2s ease-in-out infinite;
}

@keyframes hbPulseOrange {
  0%, 100% { box-shadow: 0 0 6px rgba(232, 82, 42, 0.15); }
  50%      { box-shadow: 0 0 14px rgba(232, 82, 42, 0.4); }
}

/* Pulse Discord blue — has @tag but not logged in */
.hamburger-btn.hb-pulse-blue .hamburger-icon span {
  background: #5865F2;
  box-shadow: 0 0 4px rgba(88, 101, 242, 0.4);
}
.hamburger-btn.hb-pulse-blue::before {
  opacity: 1;
  box-shadow: 0 0 6px rgba(88, 101, 242, 0.25);
  animation: hbPulseBlue 2s ease-in-out infinite;
}

@keyframes hbPulseBlue {
  0%, 100% { box-shadow: 0 0 6px rgba(88, 101, 242, 0.15); }
  50%      { box-shadow: 0 0 14px rgba(88, 101, 242, 0.4); }
}

/* Steady glow reddish-orange — fully authenticated */
.hamburger-btn.hb-glow .hamburger-icon span {
  background: #e8522a;
  box-shadow: 0 0 5px rgba(232, 82, 42, 0.5);
}
.hamburger-btn.hb-glow::before {
  opacity: 1;
  box-shadow: 0 0 10px rgba(232, 82, 42, 0.35);
}

/* ══════════════════════════════════════════════════════════════════════════
   FISSAL CHAT BUBBLE
   ══════════════════════════════════════════════════════════════════════════ */
.fissal-bubble {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #1e261e, #0d100d 70%);
  border: 2px solid var(--t-green-dim);
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.6),
    0 0 12px rgba(74, 222, 128, 0.15);
  transition: box-shadow var(--transition), transform var(--transition);
  user-select: none;
}

.fissal-bubble:hover {
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(74, 222, 128, 0.3);
  transform: scale(1.06);
}

.fissal-bubble svg {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.fissal-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--admin);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Floating chat panel ── */
.fissal-chat-float {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 340px;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #141a14 0%, #0c100c 100%);
  border: 1px solid var(--t-green-dim);
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(74, 222, 128, 0.1);
  z-index: 899;
  overflow: hidden;
}

.fissal-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  background: rgba(74, 222, 128, 0.04);
  border-bottom: 1px solid var(--screen-border);
}

.fissal-chat-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--t-green);
  font-weight: 600;
}

.fissal-chat-actions {
  display: flex;
  gap: 0.3rem;
}

.fissal-btn-brain,
.fissal-btn-close {
  background: none;
  border: 1px solid var(--t-muted);
  border-radius: var(--radius);
  color: var(--t-dim);
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  transition: all var(--transition);
  line-height: 1;
}

.fissal-btn-brain:hover { border-color: var(--t-cyan); color: var(--t-cyan); }
.fissal-btn-close:hover { border-color: var(--t-red); color: var(--t-red); }

.fissal-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 200px;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fissal-msg {
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
}

.fissal-msg-user {
  justify-content: flex-end;
}

.fissal-msg-user .fissal-bubble-msg {
  background: rgba(212, 162, 78, 0.1);
  border-color: var(--gold-dim);
  color: var(--gold-bright);
}

.fissal-msg-bot .fissal-avatar {
  font-size: var(--fs-sm);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.fissal-bubble-msg {
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-size: var(--fs-xs);
  color: var(--t-white);
  max-width: 85%;
  word-break: break-word;
  line-height: 1.5;
}

.fissal-bubble-msg.fissal-error {
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--t-red);
}

.fissal-chat-input {
  display: flex;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border-top: 1px solid var(--screen-border);
  background: rgba(0, 0, 0, 0.15);
}

.fissal-chat-input input {
  flex: 1;
  background: var(--screen-bg);
  border: 1px solid var(--screen-border);
  border-radius: var(--radius);
  color: var(--t-white);
  font-size: var(--fs-xs);
  font-family: var(--font-body);
  padding: 0.3rem 0.5rem;
  outline: none;
  transition: border-color var(--transition);
}

.fissal-chat-input input:focus {
  border-color: var(--t-green-dim);
}

/* ══════════════════════════════════════════════════════════════════════════
   PROFILE MODAL
   ══════════════════════════════════════════════════════════════════════════ */
.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.profile-modal-content {
  position: relative;
  background:
    linear-gradient(180deg, #161c16 0%, #0e130e 100%);
  border: 1px solid var(--bezel-edge);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  padding: 1.5rem;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.profile-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  color: var(--t-dim);
  cursor: pointer;
  font-size: var(--fs-md);
  transition: color var(--transition);
  z-index: 1;
}

.profile-close:hover { color: var(--t-red); }

.profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--t-green-dim);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--t-muted);
  background: var(--screen-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t-dim);
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-name {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 700;
}

.profile-discord {
  font-size: var(--fs-xs);
  color: var(--t-dim);
}

.profile-rank {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--gold);
  background: rgba(212, 162, 78, 0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  padding: 0 0.3rem;
  font-weight: 600;
}

.profile-section {
  margin-top: 1rem;
}

.profile-section h3 {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--t-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.profile-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 80px;
}

.profile-stat .stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--t-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-stat .stat-value {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--t-white);
  font-weight: 600;
}

.profile-stat .stat-value.gold { color: var(--t-amber); }

.profile-highlight {
  margin-top: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--t-dim);
}

.profile-highlight .gold { color: var(--t-amber); }

/* ══════════════════════════════════════════════════════════════════════════
   CLICKABLE TAGS & BADGES
   ══════════════════════════════════════════════════════════════════════════ */
.clickable-tag {
  cursor: pointer;
  color: var(--t-cyan);
  transition: color var(--transition), text-shadow var(--transition);
}

.clickable-tag:hover {
  color: var(--t-green);
  text-decoration: underline;
}

.fx-on .clickable-tag:hover {
  text-shadow: 0 0 5px rgba(74, 222, 128, 0.3);
}

.tag-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  line-height: 1.4;
}

.tag-badge.tag-cyan {
  color: var(--t-cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
}

.tag-badge.tag-green {
  color: var(--t-green);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #app-header { gap: 0.3rem; padding: 0.3rem 0.5rem; flex-wrap: wrap; }

  #app-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-top: 3px;
  }
  #app-nav::-webkit-scrollbar { display: none; }

  .panel-grid { grid-template-columns: 1fr; }

  .stat-big .value { font-size: clamp(1.2rem, 5vw, 1.8rem); }

  .data-table { font-size: var(--fs-xs); }

  .honors-grid { grid-template-columns: repeat(2, 1fr); }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group .form-input { min-width: 100%; }

  .price-check-layout { grid-template-columns: 1fr; }
  .price-filters { position: static; }
  .pc-results-grid { grid-template-columns: 1fr; }

  .fissal-chat-float { width: calc(100vw - 2rem); right: 1rem; bottom: 4.5rem; }
}

@media (max-width: 480px) {
  .header-brand { width: auto; }

  #user-area { order: 2; }

  .brand-text { font-size: var(--fs-xs); letter-spacing: 0.8px; }

  #app-content { padding: 0.5rem; }

  .honors-grid { grid-template-columns: 1fr; }

  #fx-toggle { bottom: 0.5rem; right: 0.5rem; }
}

@media (min-width: 1800px) {
  #terminal-shell { max-width: 1600px; }
}
