/* ── VIVIAN ADMIN DESIGN SYSTEM ── */
:root {
  --bg:        #0A1120;
  --bg-b:      #0D1628;
  --sidebar:   #0F1C35;
  --card:      #162340;
  --card-b:    #1A2A4A;
  --active:    #1E3158;
  --border:    rgba(255,255,255,0.07);
  --border-b:  rgba(255,255,255,0.12);
  --purple:    #a064ff;
  --purple-bg: rgba(160,100,255,0.1);
  --purple-b:  rgba(160,100,255,0.25);
  --teal:      #00C8A0;
  --teal-bg:   rgba(0,200,160,0.08);
  --amber:     #D4920C;
  --amber-bg:  rgba(212,146,12,0.1);
  --red:       #E05252;
  --red-bg:    rgba(224,82,82,0.1);
  --text:      #E2EAF6;
  --text-m:    #8BA0C0;
  --text-l:    #4A6080;
  --shadow:    0 2px 12px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}
a { color: var(--purple); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
.hidden { display: none !important; }

/* ── AUTH GATE ── */
.auth-gate {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border-b);
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  box-shadow: var(--shadow);
}
.auth-logo {
  display: flex; align-items: center; gap: 14px; margin-bottom: 32px;
}
.auth-v {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--purple-bg); border: 1px solid var(--purple-b);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: var(--purple); flex-shrink: 0;
}
.auth-name { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.auth-tagline { font-size: 11px; color: var(--text-m); margin-top: 2px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-err {
  font-size: 12px; color: var(--red);
  background: var(--red-bg); border: 1px solid rgba(224,82,82,0.2);
  padding: 8px 12px; border-radius: 4px; text-align: center;
}
.auth-footer {
  margin-top: 20px; font-size: 11px; color: var(--text-l); text-align: center;
  font-family: 'SF Mono', Consolas, monospace;
}

/* ── ADMIN LAYOUT ── */
.admin {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-v {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--purple-bg); border: 1px solid var(--purple-b);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; color: var(--purple);
}
.brand-name { font-size: 13px; font-weight: 800; letter-spacing: 0.05em; }
.brand-sub { font-size: 9.5px; color: var(--text-l); font-family: 'SF Mono', Consolas, monospace; letter-spacing: 0.05em; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 10px 8px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.nav-label {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-l); padding: 12px 8px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 5px;
  font-size: 13px; color: var(--text-m); font-weight: 500;
  cursor: pointer; transition: background 0.1s, color 0.1s;
  user-select: none;
}
.nav-item:hover { background: var(--active); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--purple); }
.nav-icon { font-size: 11px; opacity: 0.6; width: 14px; text-align: center; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--purple-bg); border: 1px solid var(--purple-b);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--purple); flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text-l); }
.user-info { flex: 1; min-width: 0; }
.logout-btn {
  background: none; border: none; color: var(--text-l);
  font-size: 13px; padding: 4px; border-radius: 4px;
  transition: color 0.1s;
}
.logout-btn:hover { color: var(--red); }

/* ── MAIN CONTENT ── */
.main {
  overflow-y: auto; background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.section { padding: 28px 32px; min-height: 100%; }

/* ── SECTION HEADER ── */
.sec-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.sec-eyebrow {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-l); margin-bottom: 5px;
}
.sec-title { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.sec-sub { font-size: 13px; color: var(--text-m); margin-top: 4px; max-width: 520px; }
.sec-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 2px; }

/* ── CARDS ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px 20px;
}
.card:hover { border-color: var(--border-b); }
.card-label {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-l); margin-bottom: 6px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 12.5px; color: var(--text-m); line-height: 1.55; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px;
}
.stat-num {
  font-size: 28px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-bottom: 4px;
}
.stat-label { font-size: 11px; color: var(--text-m); }
.stat-card.purple .stat-num { color: var(--purple); }
.stat-card.teal .stat-num { color: var(--teal); }
.stat-card.amber .stat-num { color: var(--amber); }
.stat-card.white .stat-num { color: var(--text); }

/* ── GRIDS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
thead th {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-l); padding: 10px 16px; text-align: left;
  background: var(--bg-b); border-bottom: 1px solid var(--border); font-weight: 700;
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--card-b); }
tbody td { padding: 11px 16px; vertical-align: middle; }
td.td-main { font-weight: 600; color: var(--text); }
td.td-muted { color: var(--text-m); font-size: 13px; }
td.td-mono { font-family: 'SF Mono', Consolas, monospace; font-size: 11.5px; color: var(--text-m); }

/* ── CHIPS ── */
.chip {
  display: inline-flex; align-items: center;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.chip-live   { background: var(--teal-bg);   color: var(--teal);   border: 1px solid rgba(0,200,160,0.2); }
.chip-build  { background: var(--purple-bg);  color: var(--purple); border: 1px solid var(--purple-b); }
.chip-amber  { background: var(--amber-bg);   color: var(--amber);  border: 1px solid rgba(212,146,12,0.2); }
.chip-dark   { background: var(--bg-b);        color: var(--text-m); border: 1px solid var(--border); }

/* ── FORMS ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.label { font-size: 11.5px; font-weight: 600; color: var(--text-m); }
.input, .select, .textarea {
  background: var(--bg-b); border: 1px solid var(--border-b);
  color: var(--text); font-family: inherit; font-size: 13.5px;
  padding: 9px 12px; border-radius: 5px; outline: none; width: 100%;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--purple); }
.input::placeholder, .textarea::placeholder { color: var(--text-l); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.select option { background: var(--card); }
.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--purple); color: #fff; border: none;
  padding: 9px 18px; border-radius: 5px; font-size: 13px; font-weight: 600;
  transition: opacity 0.15s; white-space: nowrap;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--card-b); color: var(--text); border: 1px solid var(--border-b);
  padding: 8px 16px; border-radius: 5px; font-size: 13px; font-weight: 500;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--active); }
.btn-ghost {
  background: none; color: var(--text-m); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 4px; font-size: 12px;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-b); }
.btn-teal {
  background: var(--teal-bg); color: var(--teal); border: 1px solid rgba(0,200,160,0.2);
  padding: 7px 14px; border-radius: 5px; font-size: 12.5px; font-weight: 600;
}
.btn-amber {
  background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(212,146,12,0.2);
  padding: 7px 14px; border-radius: 5px; font-size: 12.5px; font-weight: 600;
}
.btn-full { width: 100%; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── PLATFORM CHECKBOXES ── */
.platform-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.plat-check { display: none; }
.plat-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-b); border: 1px solid var(--border-b);
  color: var(--text-m); font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 4px; cursor: pointer;
  transition: all 0.12s; user-select: none;
}
.plat-check:checked + .plat-label {
  background: var(--purple-bg); color: var(--purple); border-color: var(--purple-b);
}

/* ── SIGNAL RESULTS ── */
.signal-results { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.plat-result { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.plat-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-b); border-bottom: 1px solid var(--border);
}
.plat-result-name { font-size: 12px; font-weight: 700; color: var(--purple); letter-spacing: 0.04em; }
.result-fields { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.result-field {}
.result-field-label {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-l); margin-bottom: 5px; display: flex;
  align-items: center; justify-content: space-between;
}
.result-field-body {
  background: var(--bg-b); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 12px;
  font-size: 13px; color: var(--text); line-height: 1.65;
  white-space: pre-wrap;
  min-height: 48px; outline: none;
}
.result-field-body:focus { border-color: var(--purple); }
.copy-btn {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-l); font-size: 10px; padding: 2px 7px;
  border-radius: 3px; cursor: pointer; transition: all 0.1s;
}
.copy-btn:hover { color: var(--teal); border-color: rgba(0,200,160,0.3); }
.copy-btn.copied { color: var(--teal); border-color: rgba(0,200,160,0.3); }

/* ── SIGNAL GENERATING STATE ── */
.generating {
  text-align: center; padding: 40px;
  color: var(--text-m); font-size: 14px;
}
.gen-pulse {
  font-size: 28px; display: block; margin-bottom: 12px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.gen-bar {
  width: 200px; height: 2px; background: var(--border);
  border-radius: 2px; margin: 12px auto 0; overflow: hidden;
}
.gen-bar-fill {
  height: 100%; background: var(--purple);
  animation: genbar 1.6s ease-in-out infinite;
}
@keyframes genbar { 0% { width:0; margin-left:0; } 50% { width:60%; } 100% { width:0; margin-left:100%; } }

/* ── REPORT CARDS ── */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.12s;
}
.report-card:hover { border-color: var(--border-b); }
.report-type {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-l);
}
.report-title { font-size: 14px; font-weight: 700; }
.report-desc { font-size: 12px; color: var(--text-m); line-height: 1.5; flex: 1; }
.report-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ── CLIENT PROFILE ── */
.client-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.client-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px 20px; cursor: pointer;
  transition: border-color 0.12s;
}
.client-card:hover { border-color: var(--purple-b); }
.client-initial {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; margin-bottom: 12px;
}
.client-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.client-type { font-size: 11.5px; color: var(--text-m); margin-bottom: 10px; }
.client-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.client-tag {
  font-size: 10px; background: var(--bg-b); border: 1px solid var(--border);
  color: var(--text-m); padding: 2px 7px; border-radius: 3px;
}

/* ── CLIENT DETAIL PANEL ── */
.client-detail {
  background: var(--card); border: 1px solid var(--border-b);
  border-radius: 8px; padding: 24px; margin-top: 16px;
}
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-l); margin-bottom: 10px;
  font-family: 'SF Mono', Consolas, monospace;
}
.detail-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: flex-start; }
.detail-key { font-size: 12px; color: var(--text-m); min-width: 120px; flex-shrink: 0; }
.detail-val { font-size: 13px; color: var(--text); line-height: 1.55; }

/* ── DEPLOY ── */
.deploy-project {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  margin-bottom: 6px;
}
.deploy-project:hover { border-color: var(--border-b); }
.deploy-project-name { font-size: 14px; font-weight: 700; }
.deploy-project-meta { font-size: 11.5px; color: var(--text-m); margin-top: 2px; }
.deploy-actions { display: flex; gap: 6px; flex-shrink: 0; }
.deploy-log {
  background: var(--bg-b); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px 16px; margin-top: 12px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px; color: var(--text-m); line-height: 1.8;
  max-height: 220px; overflow-y: auto;
  white-space: pre-wrap;
}

/* ── SWOT ── */
.swot-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  margin-top: 20px;
}
.swot-cell { padding: 18px 20px; }
.swot-cell.S { background: rgba(0,200,160,0.07); }
.swot-cell.W { background: rgba(224,82,82,0.06); }
.swot-cell.O { background: rgba(160,100,255,0.07); }
.swot-cell.T { background: rgba(212,146,12,0.07); }
.swot-label {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 10px;
}
.swot-cell.S .swot-label { color: var(--teal); }
.swot-cell.W .swot-label { color: var(--red); }
.swot-cell.O .swot-label { color: var(--purple); }
.swot-cell.T .swot-label { color: var(--amber); }
.swot-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.swot-list li { font-size: 13px; color: var(--text); padding-left: 14px; position: relative; line-height: 1.5; }
.swot-list li::before { content: '—'; position: absolute; left: 0; color: var(--text-l); }

/* ── ABILITIES ── */
.ability-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px; margin-bottom: 6px;
  display: flex; gap: 14px; align-items: flex-start;
}
.ability-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px;
}
.ability-dot.live { background: var(--teal); }
.ability-dot.new  { background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.ability-dot.plan { background: var(--amber); }
.ability-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.ability-desc { font-size: 12.5px; color: var(--text-m); line-height: 1.55; }

/* ── SETTINGS ── */
.settings-group { margin-bottom: 28px; }
.settings-group-title {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-l); margin-bottom: 12px; font-weight: 700;
}
.key-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; margin-bottom: 4px;
  display: flex; align-items: center; gap: 12px;
}
.key-row-label { font-size: 12.5px; font-weight: 600; min-width: 160px; flex-shrink: 0; }
.key-row-val {
  flex: 1; font-family: 'SF Mono', Consolas, monospace; font-size: 12px;
  color: var(--text-m); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-row-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 20px; right: 24px;
  background: var(--card); border: 1px solid var(--border-b);
  color: var(--text); font-size: 13px; padding: 10px 16px;
  border-radius: 6px; box-shadow: var(--shadow); z-index: 9999;
  animation: toastin 0.2s ease;
}
@keyframes toastin { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

/* ── PHASE 2 STUB ── */
.phase2-stub {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 60px 40px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.phase2-badge {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-b);
  padding: 4px 10px; border-radius: 3px; margin-bottom: 16px;
}
.phase2-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.phase2-desc { font-size: 13.5px; color: var(--text-m); max-width: 480px; line-height: 1.7; }
.phase2-list {
  list-style: none; margin-top: 16px; text-align: left;
  background: var(--bg-b); border: 1px solid var(--border); border-radius: 6px;
  padding: 14px 18px; max-width: 400px; width: 100%;
}
.phase2-list li {
  font-size: 13px; color: var(--text-m); padding: 4px 0; padding-left: 14px;
  position: relative;
}
.phase2-list li::before { content: '→'; position: absolute; left: 0; color: var(--text-l); }
