/* ============================================================================
   Festivenomics — canonical shell + module stylesheet (fx.css)
   Shared by the landing page, Lineup Lift, Economics P&L, Vault and the SSO
   portal module. Design tokens are the approved mockup's tokens.
   ========================================================================= */

:root {
  --bg: #0A0A0A;
  --card: #141414;
  --card2: #1D1D1D;
  --card3: #242424;
  --line: #262626;
  --hairline: #1C1C1C;
  --txt: #F2F2F2;
  --dim: #C9C9C9;
  --mut: #8E8E93;
  --orange: #FF8A47;
  --cyan: #64EEFF;
  --yellow: #FFFA34;
  --yellow2: #FFFE7B;
  --ok: #4ADE80;
  --danger: #F87171;
  --streak: linear-gradient(90deg, #FF8A47 0%, #FFFE7B 35%, #FFFA34 55%, #64EEFF 100%);
  --accent: var(--orange);
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); }

/* ---------------------------------------------------------------- top bar */
.fxbar {
  height: 58px;
  background: #0E0E0E;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.fxbar-left { display: flex; align-items: center; gap: 18px; }

.fx-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--txt); cursor: pointer;
}

.fx-logo-badge {
  width: 28px; height: 28px; border-radius: 6px; background: #191919;
  border: 1px solid #333; display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
}

.fx-logo-badge::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2.5px;
  background: var(--streak);
}

.fx-brand-title {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  letter-spacing: -0.3px;
}
.fx-brand-title span { color: var(--orange); }

.fx-context-chip {
  display: flex; align-items: center; gap: 8px; background: #171717;
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px;
  font-size: 12px; color: var(--dim); cursor: pointer; transition: all .15s;
  font-family: var(--font-body);
}
.fx-context-chip:hover { border-color: #3e3e3e; background: #1f1f1f; }
.fx-context-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.fx-context-chip strong { color: var(--txt); font-weight: 600; }

.fx-module-tabs { display: flex; align-items: center; gap: 6px; }

.fx-module-tab {
  display: flex; align-items: center; gap: 7px; padding: 6px 13px;
  border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--mut);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: all .15s; font-family: var(--font-body);
}
.fx-module-tab:hover { color: var(--dim); background: #181818; }

.fx-module-tab.active[data-target="lineup"] {
  color: #FFF; background: #1C1510; border-color: rgba(255,138,71,.35);
  box-shadow: inset 0 1px 0 rgba(255,138,71,.2);
}
.fx-module-tab.active[data-target="economics"] {
  color: #FFF; background: #0E181A; border-color: rgba(100,238,255,.35);
  box-shadow: inset 0 1px 0 rgba(100,238,255,.2);
}
.fx-module-tab.active[data-target="vault"] {
  color: #FFF; background: #19180E; border-color: rgba(255,250,52,.35);
  box-shadow: inset 0 1px 0 rgba(255,250,52,.2);
}
.fx-module-tab.active[data-target="landing"] {
  color: #FFF; background: #1c1c1c; border-color: #383838;
}
.fx-module-tab.active[data-target="auth"] {
  color: #FFF; background: #1a1614; border-color: #4a3424;
}

.fx-module-tab .indicator { width: 7px; height: 7px; border-radius: 50%; }
.fx-module-tab[data-target="lineup"] .indicator { background: var(--orange); }
.fx-module-tab[data-target="economics"] .indicator { background: var(--cyan); }
.fx-module-tab[data-target="vault"] .indicator { background: var(--yellow); }
.fx-module-tab[data-target="landing"] .indicator { background: #999; }
.fx-module-tab[data-target="auth"] .indicator { background: #E06C2D; }

.fxbar-right { display: flex; align-items: center; gap: 12px; }

.fx-user-pill {
  display: flex; align-items: center; gap: 9px; background: #141414;
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px 3px 5px;
  cursor: pointer; color: inherit;
}
.fx-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #2A2019;
  color: var(--orange); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; border: 1px solid rgba(255,138,71,.4);
}
.fx-user-meta { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.fx-user-name { font-size: 11.5px; font-weight: 600; color: var(--txt); }
.fx-user-role { font-size: 9.5px; color: var(--mut); }

/* ------------------------------------------------------------ main layout */
.fx-main { flex: 1; display: flex; background: var(--bg); min-height: calc(100vh - 58px); }
.module-container { display: none; width: 100%; min-height: 100%; }
.module-container.active { display: flex; }

.fx-sidebar {
  width: 210px; background: #0E0E0E; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.fx-sidebar-header { padding: 16px 18px 12px; }
.fx-sidebar-title { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; }
.fx-sidebar-tagline { font-size: 11px; color: var(--mut); margin-top: 2px; }
.fx-nav-items { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; }

.fx-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--dim);
  background: transparent; border: none; cursor: pointer; text-align: left;
  transition: all .12s; font-family: var(--font-body); width: 100%;
}
.fx-nav-item:hover { background: #181818; color: var(--txt); }
.fx-nav-item.active {
  background: #1F1915; color: var(--orange);
  border-left: 2px solid var(--orange); font-weight: 600;
}
.fx-nav-item svg { opacity: .7; flex: none; }
.fx-nav-item.active svg { opacity: 1; }

.fx-sidebar-footer {
  margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--mut);
}

.fx-content { flex: 1; padding: 24px 30px; overflow-y: auto; max-width: 1440px; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.page-desc { font-size: 13px; color: var(--mut); margin-top: 4px; }
.header-actions { display: flex; gap: 10px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: all .12s; border: 1px solid transparent; text-decoration: none;
  font-family: var(--font-body);
}
.btn-primary { background: var(--orange); color: #0A0A0A; font-weight: 600; }
.btn-primary:hover { background: #ff985e; box-shadow: 0 0 12px rgba(255,138,71,.3); }
.btn-secondary { background: #1C1C1C; color: var(--txt); border-color: var(--line); }
.btn-secondary:hover { background: #252525; border-color: #3a3a3a; }
.btn-cyan { background: var(--cyan); color: #051417; font-weight: 600; }
.btn-cyan:hover { background: #84f2ff; box-shadow: 0 0 12px rgba(100,238,255,.35); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ----------------------------------------------------------- metric cards */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.metric-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #222;
}
.metric-card.accent-orange::before { background: var(--orange); }
.metric-card.accent-cyan::before { background: var(--cyan); }
.metric-card.accent-yellow::before { background: var(--yellow); }
.metric-card.accent-ok::before { background: var(--ok); }
.metric-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--mut); font-weight: 600; }
.metric-val { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--txt); margin: 6px 0 2px; }
.metric-sub { font-size: 11.5px; color: var(--mut); display: flex; align-items: center; gap: 5px; }
.metric-sub .tag {
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: rgba(74,222,128,.12); color: var(--ok); font-weight: 600;
}

/* ----------------------------------------------------------------- panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 22px; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--hairline);
}
.panel-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--txt); }

/* ------------------------------------------------------------------ table */
.table-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search-input {
  background: #121212; border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; font-size: 12.5px; color: var(--txt); outline: none; width: 260px;
  font-family: var(--font-body);
}
.search-input:focus { border-color: var(--orange); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  background: #181818; border: 1px solid var(--line); border-radius: 14px;
  padding: 3px 10px; font-size: 11.5px; color: var(--dim); cursor: pointer;
}
.filter-chip.active { background: #291c14; border-color: var(--orange); color: var(--orange); font-weight: 600; }

.roster-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.roster-table th {
  text-align: left; padding: 10px 12px; color: var(--mut); font-size: 11px;
  text-transform: uppercase; font-weight: 600; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); background: #121212; white-space: nowrap;
}
.roster-table td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); color: var(--dim); }
.roster-table tr:hover td { background: #181818; color: var(--txt); }
.artist-name-cell { display: flex; align-items: center; gap: 10px; }
.artist-avatar {
  width: 28px; height: 28px; border-radius: 4px; background: #252525;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--dim);
  flex: none;
}
.artist-info-text strong { display: block; color: var(--txt); font-size: 13px; }
.artist-info-text span { font-size: 11px; color: var(--mut); }

.badge-momentum { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-rising { background: rgba(74,222,128,.15); color: var(--ok); }
.badge-peaking { background: rgba(255,250,52,.15); color: var(--yellow); }
.badge-cooling { background: rgba(142,142,147,.15); color: var(--mut); }

.score-meter { display: flex; align-items: center; gap: 8px; }
.score-bar-bg { width: 60px; height: 6px; background: #252525; border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; background: var(--orange); border-radius: 3px; }

.btn-action-sm {
  padding: 3px 8px; background: #202020; border: 1px solid var(--line);
  border-radius: 4px; font-size: 11px; color: var(--txt); cursor: pointer;
  font-family: var(--font-body);
}
.btn-action-sm:hover { background: var(--orange); color: #000; border-color: var(--orange); }

/* ------------------------------------------------------------------ modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--card); border: 1px solid #333; border-radius: 10px; width: 640px;
  max-width: 90vw; max-height: 85vh; overflow-y: auto; padding: 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,.8);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.modal-close {
  background: #222; border: 1px solid #333; color: #aaa; width: 28px; height: 28px;
  border-radius: 4px; cursor: pointer; font-size: 14px;
}
.modal-close:hover { background: #333; color: #fff; }
.signal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.signal-box { background: #1A1A1A; border: 1px solid #2B2B2B; border-radius: 6px; padding: 12px; }
.signal-box .provider { font-size: 11px; color: var(--mut); text-transform: uppercase; font-weight: 600; }
.signal-box .value { font-size: 16px; font-weight: 700; color: var(--txt); margin-top: 2px; font-family: var(--font-display); }

/* ----------------------------------------------------------- stage matrix */
.stage-matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.stage-column { background: #111; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.stage-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline);
}
.stage-title { font-size: 13.5px; font-weight: 700; color: var(--txt); }
.stage-capacity { font-size: 11px; color: var(--mut); font-family: var(--font-mono); }
.slot-item {
  background: #191919; border: 1px solid #2a2a2a; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; transition: all .12s;
}
.slot-item:hover { border-color: var(--orange); background: #201a16; }
.slot-item.dragging { opacity: .45; }
.slot-item-top { display: flex; justify-content: space-between; font-weight: 600; font-size: 12.5px; color: var(--txt); }
.slot-item-bottom { display: flex; justify-content: space-between; font-size: 11px; color: var(--mut); margin-top: 4px; }
.slot-empty { font-size: 11.5px; color: var(--mut); border: 1px dashed #2c2c2c; border-radius: 6px; padding: 10px; text-align: center; }

/* --------------------------------------------------------------- economics */
.econ-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.slider-group { margin-bottom: 18px; }
.slider-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; color: var(--dim); margin-bottom: 6px; }
.slider-val { font-family: var(--font-mono); font-weight: 700; color: var(--cyan); }
input[type=range] {
  width: 100%; height: 6px; background: #262626; border-radius: 3px;
  outline: none; accent-color: var(--cyan); cursor: pointer;
}
.pnl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pnl-table td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.pnl-table tr.total-row td {
  font-weight: 700; font-size: 14px; background: #171c1e; color: var(--txt);
  border-top: 1px solid var(--cyan); border-bottom: 2px solid var(--cyan);
}
.pnl-num { text-align: right; font-family: var(--font-mono); }
.pnl-num.pos { color: var(--ok); }
.pnl-num.neg { color: var(--danger); }

/* ------------------------------------------------------------------- vault */
.vault-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.vault-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; position: relative; }
.vault-card.warning { border-color: rgba(255,250,52,.4); background: #16150d; }
.vault-status-badge { font-size: 10.5px; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; font-weight: 700; letter-spacing: .3px; }
.badge-extracted { background: rgba(74,222,128,.15); color: var(--ok); }
.badge-sentinel { background: rgba(255,250,52,.2); color: var(--yellow); }

/* --------------------------------------------------------------------- sso */
.sso-view-wrap { max-width: 480px; margin: 40px auto; text-align: center; }
.sso-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 32px 28px; text-align: left; box-shadow: 0 12px 32px rgba(0,0,0,.6);
}
.sso-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--orange); font-weight: 700; margin-bottom: 6px; }
.sso-input-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--dim); margin: 14px 0 6px; }
.sso-input {
  width: 100%; background: #111; border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; color: #fff; font-size: 13.5px; outline: none;
  font-family: var(--font-body);
}
.sso-input:focus { border-color: var(--orange); }
.sso-user-quickswitch { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.quickswitch-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* ----------------------------------------------------------------- landing */
.landing-hero { text-align: center; padding: 50px 20px 40px; max-width: 900px; margin: 0 auto; }
.landing-kicker {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  background: rgba(255,138,71,.12); border: 1px solid rgba(255,138,71,.3);
  color: var(--orange); font-size: 12px; font-weight: 600; margin-bottom: 16px;
}
.landing-h1 { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1.15; letter-spacing: -0.8px; margin-bottom: 16px; }
.landing-sub { font-size: 16px; color: var(--dim); max-width: 660px; margin: 0 auto 28px; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; text-align: left; }
.feature-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.feature-card h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.landing-logo { width: min(560px, 86vw); height: auto; margin: 0 auto 18px; display: block; }
.landing-stats { display: flex; justify-content: center; gap: 26px; margin-top: 26px; flex-wrap: wrap; }
.landing-stat { font-size: 12px; color: var(--mut); }
.landing-stat strong { display: block; font-family: var(--font-display); font-size: 20px; color: var(--txt); }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1C1917;
  border: 1px solid var(--orange); color: #fff; padding: 12px 18px;
  border-radius: 8px; font-size: 13px; box-shadow: 0 10px 25px rgba(0,0,0,.8);
  display: flex; align-items: center; gap: 10px; z-index: 2000;
  transform: translateY(100px); opacity: 0;
  transition: all .25s cubic-bezier(.16,1,.3,1);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ------------------------------------------------------------------ misc */
.mono { font-family: var(--font-mono); }
.muted { color: var(--mut); }
.empty-state { padding: 28px; text-align: center; color: var(--mut); font-size: 12.5px; }
.kv { display: flex; justify-content: space-between; font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--hairline); }
.skeleton { background: linear-gradient(90deg,#161616,#1f1f1f,#161616); border-radius: 4px; height: 12px; animation: sk 1.2s infinite linear; }
@keyframes sk { 0% { opacity: .6 } 50% { opacity: 1 } 100% { opacity: .6 } }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid, .vault-grid, .stage-matrix { grid-template-columns: 1fr; }
  .econ-layout { grid-template-columns: 1fr; }
  .fx-module-tabs { display: none; }
}
