/* NEX STUDIO CORE UI — v14.10.15 */

@font-face {
  font-family: 'Azonix';
  src: url('../fonts/Azonix.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0f;
  --bg-void: #020204;
  --panel: rgba(20, 20, 30, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --indigo: #6366f1;
  --cyan: #06b6d4;
  --amber: #f59e0b;
  --emerald: #10b981;
  --red: #ef4444;
  --t1: #ffffff;
  --t2: #a1a1aa;
  --t3: #71717a;
  --font-brand: 'Bricolage Grotesque', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Inter', sans-serif;
  --bg-card: rgba(20, 20, 30, 0.4);
  --bg-lift: rgba(255, 255, 255, 0.03);
  --pink: #ec4899;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  height: 58px;
  background: rgba(2,2,6,0.92);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(16px);
  z-index: 100;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Azonix', sans-serif;
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 2px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* TABS & NAVIGATION */
.tabs {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

/* Per-tab accent colors via --tc */
.nav-item[data-tab="dashboard"]    { --tc: #22d3ee; }
.nav-item[data-tab="radar"]        { --tc: #f87171; }
.nav-item[data-tab="persona"]      { --tc: #a78bfa; }
.nav-item[data-tab="forge"]        { --tc: #fbbf24; }
.nav-item[data-tab="arcos"]        { --tc: #f472b6; }
.nav-item[data-tab="social"]       { --tc: #38bdf8; }
.nav-item[data-tab="agenda"]       { --tc: #34d399; }
.nav-item[data-tab="storytelling"] { --tc: #c084fc; }
.nav-item[data-tab="debate"]       { --tc: #fb923c; }
.nav-item[data-tab="singularity"]  { --tc: #fbbf24; }
.nav-item[data-tab="vault"]        { --tc: #2dd4bf; }
.nav-item[data-tab="settings"]     { --tc: #94a3b8; }

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  padding: 5px 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-item .tab-icon { font-size: 13px; line-height: 1; }

.nav-item:hover {
  color: var(--tc, var(--t1));
  background: color-mix(in srgb, var(--tc, #fff) 8%, transparent);
  border-color: color-mix(in srgb, var(--tc, #fff) 20%, transparent);
}

.nav-item.active {
  color: var(--tc, var(--indigo));
  background: color-mix(in srgb, var(--tc, var(--indigo)) 14%, transparent);
  border-color: color-mix(in srgb, var(--tc, var(--indigo)) 40%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--tc, var(--indigo)) 18%, transparent);
  font-weight: 700;
}

/* VERSION CHIPS */
.ver-chip {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.ver-chip-app  { background: rgba(99,102,241,.18); color: #a5b4fc; border: 1px solid rgba(99,102,241,.35); }
.ver-chip-lore { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.ver-chip-eng  { background: rgba(245,158,11,.12); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }

/* STATUS ROW */
#status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--t3);
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.07);
}

/* WORKSPACE LAYOUT & SCROLL RESTORE */
.workspace {
  height: calc(100vh - 60px);
  width: 100vw;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* MODULE SYSTEM */
#studio-content {
  height: calc(100vh - 60px);
  width: 100%;
}

.module {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.module.visible {
  display: flex;
}

/* STUDIO CONTAINER */
.studio {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* TACTICAL UTILS */
.ph {
  display: flex;
  align-items: center;
  padding: 0 32px;
  height: 60px;
  background: rgba(255,255,255,0.02);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--border);
}

.btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: 0.2s;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary { background: var(--indigo); color: #fff; border: none; }
.btn-primary:hover { filter: brightness(1.2); }
.btn-ghost { background: transparent; color: var(--t2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

/* PERSONA LAB LAYOUT */
.persona-layout {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.persona-sidebar {
  width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.p-list-item {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
}

.p-list-item.active { background: rgba(99,102,241,0.05); border-right: 2px solid var(--indigo); }

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 32px;
  overflow-y: auto;
  flex: 1;
}

/* RADAR GRID */
.radar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px 24px;
  overflow-y: auto;
  align-content: start;
}

/* RPG CARD COMPONENTRY */
.rpg-card {
  width: 100%;
  height: 480px;
  position: relative;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.rpg-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rpg-face.back { transform: rotateY(180deg); }
.rpg-card.flipped { transform: rotateY(180deg); }

.rpg-img-container {
  height: 55%;
  background: #000;
  overflow: hidden;
  position: relative;
}

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

.rpg-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* SOCIAL & FORGE */
.social-layout, .forge-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  overflow-y: auto;
}

.t-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--t1);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 100%;
}

.t-input:focus { border-color: var(--indigo); outline: none; }

.t-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* MISSING CLASSES RECOVERY */

.war-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.stat-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.stat-val { font-size: 24px; font-weight: 800; font-family: var(--font-brand); }
.stat-sub { font-size: 10px; color: var(--t3); text-transform: uppercase; font-family: var(--font-mono); margin-top: 4px; }

.lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

.btn-sm {
  font-size: 9px;
  padding: 6px 12px;
}

.input {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--t1);
  font-family: var(--font-body);
  font-size: 13px;
  width: 100%;
}
.input:focus { border-color: var(--indigo); outline: none; }

.loader {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--indigo);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* RPG CARD INTERNALS */
.rpg-level {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(0,0,0,0.8);
  border: 1px solid var(--border);
  color: var(--t1); font-family: var(--font-mono); font-size: 10px; font-weight: 900;
  padding: 2px 6px; border-radius: 4px; z-index: 10;
}
.rpg-category {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,0.8);
  border: 1px solid var(--border);
  color: var(--t1); font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px; z-index: 10;
  text-transform: uppercase;
}
.rpg-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: #111;
}
.rpg-title {
  font-size: 9px; color: var(--amber); font-family: var(--font-mono); text-transform: uppercase;
}
.rpg-name {
  font-size: 18px; font-weight: 900; color: var(--t1); font-family: var(--font-brand); letter-spacing: -0.02em;
  line-height: 1.1; margin-bottom: 8px;
}
.rpg-stats {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.rpg-stat-item {
  display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.4); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); flex: 1; justify-content: center;
}
.rpg-stat-icon { font-size: 10px; }
.rpg-stat-val { font-size: 11px; font-weight: 800; font-family: var(--font-mono); color: var(--t1); }
.rpg-lore-box {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); padding: 12px; border-radius: 6px; flex: 1;
}
.rpg-footer {
  display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; margin-top: auto;
}
.rpg-tier-badge {
  font-size: 9px; font-weight: 900; background: var(--indigo); color: #fff; padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); letter-spacing: 0.1em;
}

/* RARO, LENDARIO, EPICO styles */
.rpg-card.raro .rpg-face { border-color: var(--cyan); box-shadow: 0 0 20px rgba(6, 182, 212, 0.05); }
.rpg-card.raro .rpg-tier-badge { background: var(--cyan); color: #000; }
.rpg-card.epico .rpg-face { border-color: var(--indigo); box-shadow: 0 0 20px rgba(99, 102, 241, 0.05); }
.rpg-card.epico .rpg-tier-badge { background: var(--indigo); }
.rpg-card.lendario .rpg-face { border-color: var(--amber); box-shadow: 0 0 20px rgba(245, 158, 11, 0.05); }
.rpg-card.lendario .rpg-tier-badge { background: var(--amber); color: #000; }

/* THE FORGE / SINGULARITY CLASSES */
.forge-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.forge-editor {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.front-btn, .format-btn {
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--t2);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}
.front-btn:hover, .format-btn:hover {
  color: var(--t1);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.front-btn.active, .format-btn.active {
  border-color: var(--indigo) !important;
  color: #fff !important;
  background: rgba(99, 102, 241, 0.15) !important;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.25) !important;
  transform: translateY(0) !important;
}
.glass-panel {
  background: rgba(20, 20, 30, 0.6);
  backdrop-filter: blur(10px);
}
.mod-knob {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

/* CALENDAR */
.cal-header { background: rgba(255,255,255,0.04); padding: 8px 4px; text-align: center; font-size: 9px; font-weight: 700; color: var(--t3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.cal-day { min-height: 90px; background: var(--bg-card); padding: 6px; display: flex; flex-direction: column; gap: 2px; transition: background 0.15s; cursor: default; }
.cal-day:hover:not(.empty) { background: rgba(255,255,255,0.02); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--indigo); }
.cal-day.empty { background: rgba(0,0,0,0.15); opacity: 0.4; }
.cal-num { font-size: 11px; font-weight: 700; color: var(--t3); font-family: var(--font-mono); margin-bottom: 2px; }
.cal-day.today .cal-num { color: var(--indigo); }
.cal-item { font-size: 9px; padding: 2px 5px; border-radius: 3px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.6; }
.cal-item.published { background: rgba(16,185,129,0.18); color: var(--emerald); }
.cal-item.scheduled { background: rgba(245,158,11,0.18); color: var(--amber); }
.cal-item.ghost { background: rgba(99,102,241,0.12); color: #818cf8; border: 1px dashed rgba(99,102,241,0.35); }
.cal-item:hover { opacity: 0.85; }

/* FORM CHECK (Debate + Story persona selectors) */
.form-check { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--t2); transition: background 0.12s; }
.form-check:hover { background: rgba(255,255,255,0.03); }
.form-check input[type="checkbox"] { accent-color: var(--indigo); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }

/* DEBATE OUTPUT */
.debate-turn { border-left: 2px solid var(--indigo); margin-bottom: 16px; padding: 14px 16px; background: rgba(99,102,241,0.04); border-radius: 0 8px 8px 0; }
.debate-turn-header { font-size: 10px; font-family: var(--font-mono); color: var(--indigo); font-weight: 700; margin-bottom: 6px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.debate-turn-body { font-size: 13px; line-height: 1.7; color: var(--t2); white-space: pre-wrap; }

/* AGENDA LAYOUT */
.agenda-layout { display: flex; height: 100%; overflow: hidden; }
.agenda-sidebar { width: 280px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-card); }
.agenda-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.agenda-upcoming-item { padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); cursor: pointer; transition: background 0.12s; }
.agenda-upcoming-item:hover { background: rgba(255,255,255,0.02); }

/* DASHBOARD REDESIGN */
.dash-quick-btn { flex: 1; min-width: 0; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; transition: all 0.15s; font-family: var(--font-body); }
.dash-quick-btn:hover { border-color: var(--indigo); background: rgba(99,102,241,0.06); transform: translateY(-1px); }
.dash-quick-btn .dqb-icon { font-size: 20px; }
.dash-quick-btn .dqb-label { font-size: 11px; font-weight: 700; color: var(--t1); text-transform: uppercase; letter-spacing: 0.05em; }
.dash-quick-btn .dqb-sub { font-size: 10px; color: var(--t3); }
.dash-agent-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.dash-agent-row:last-child { border-bottom: none; }
.dash-agent-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dash-ticker { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.18); border-radius: 8px; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; overflow: hidden; }

