/* ════════════════════════════════════════════════
   Briq — Design System
   ════════════════════════════════════════════════ */

.hidden { display: none !important; }

:root {
  --bg:         #0a0a0f;
  --surface:    #111116;
  --ink:        #0c0c0f;
  --ink2:       #101014;
  --ink3:       #151519;
  --ink4:       #1c1c22;
  --accent:     #e8ff47;
  --accent-glow: rgba(232, 255, 71, 0.25);
  --signal:     #e8ff47;
  --signal-dim: rgba(232, 255, 71, 0.15);
  --signal-glow: rgba(232, 255, 71, 0.3);
  --signal-mid: rgba(232, 255, 71, 0.4);
  --amber:      #f59e0b;
  --amber-bg:   rgba(245, 158, 11, 0.15);
  --success:    #10b981;
  --danger:     #ef4444;
  --red:        #ef4444;
  --text:       #eeeef2;
  --text-mid:   #9898aa;
  --text-low:   #4e4e5a;
  --wire:       #28282f;
  --wire2:      #35353f;
  --radius:     8px;
  --font-ui:    'Epilogue', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
  --font-syne:  'Syne', sans-serif;
  --font-display: 'Syne', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle scanline */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.025) 2px,
    rgba(0,0,0,0.025) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Overlay / Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  padding: 2.5rem;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}

.modal-logo {
  font-family: var(--font-syne);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.modal-tagline {
  color: var(--text-mid);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.ob-field {
  margin-bottom: 1.5rem;
}

.ob-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--signal);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.ob-field textarea {
  width: 100%;
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.ob-field textarea:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

.ob-field textarea::placeholder { color: var(--text-low); }

.modal-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--signal);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.15s;
}

.btn-ghost:hover { color: var(--text); }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--wire);
  position: sticky;
  top: 0;
  background: rgba(12,12,14,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--signal);
}

.header-rule {
  color: var(--wire2);
  font-weight: 100;
}

.header-sub {
  color: var(--text-low);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* Brand badge */
.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--signal-dim);
  border: 1px solid rgba(232,255,71,0.2);
  border-radius: 100px;
  padding: 0.35rem 0.75rem 0.35rem 0.6rem;
  font-size: 0.72rem;
  color: var(--signal);
  font-family: var(--font-mono);
}

.brand-badge.hidden { display: none; }

.badge-pulse {
  width: 6px;
  height: 6px;
  background: var(--signal);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.badge-label { color: var(--signal); }

.badge-edit {
  background: none;
  border: none;
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  transition: color 0.15s;
}

.badge-edit:hover { color: var(--signal); }

/* ── Tab Nav ── */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--wire);
  padding: 0 2rem;
  gap: 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 1.25rem 2rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover {
  background: var(--signal-dim);
}

.tab-btn.active {
  border-bottom-color: var(--signal);
}

.tab-num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-low);
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 0.25rem;
  transition: color 0.15s;
}

.tab-btn.active .tab-num,
.tab-btn:hover .tab-num {
  color: var(--signal);
}

.tab-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.tab-btn.active .tab-name { color: var(--text); }
.tab-btn:hover .tab-name { color: var(--text); }

.tab-desc {
  font-size: 0.68rem;
  color: var(--text-low);
  margin-top: 0.2rem;
  transition: color 0.15s;
}

.tab-btn.active .tab-desc { color: var(--text-mid); }

/* ── Main / Tabs ── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-intro {
  margin-bottom: 2rem;
}

.tab-intro h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1;
}

.tab-intro p {
  color: var(--text-mid);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 580px;
}

/* ── Input Panel ── */
.input-panel {
  margin-bottom: 2rem;
}

.input-panel.hidden { display: none; }

.main-input {
  width: 100%;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 160px;
}

.main-input:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

.main-input::placeholder { color: var(--text-low); }

.input-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.btn-generate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--signal);
  color: #0a0a0f;
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-generate:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--signal-glow);
}

.btn-generate:active { transform: translateY(0); }

.btn-generate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-text { font-weight: 500; }
.btn-arrow { font-size: 1rem; }

/* ── Form helpers ── */
.context-field {
  margin-top: 0.75rem;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.field-optional {
  color: var(--text-low);
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.field-select {
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.875rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234e4e5a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.25rem;
  transition: border-color 0.15s;
}

.field-select:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

.field-select option {
  background: var(--ink3);
  color: var(--text);
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Upload Zone ── */
.upload-zone {
  border: 1px dashed var(--wire2);
  border-radius: var(--radius);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--signal);
  background: var(--signal-dim);
}

.upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem;
  text-align: center;
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-low);
  margin-bottom: 0.25rem;
}

.upload-prompt p {
  color: var(--text-mid);
  font-size: 0.875rem;
}

.upload-link {
  color: var(--signal);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upload-hint {
  color: var(--text-low);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.file-preview {
  width: 100%;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.file-preview.hidden { display: none; }
.upload-prompt.hidden { display: none; }

.file-preview img {
  max-height: 240px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--wire);
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.preview-filename {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mid);
}

.preview-remove {
  background: none;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.preview-remove:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Output Panel ── */
.output-panel {
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 2rem;
  animation: fadeIn 0.3s ease;
}

.output-panel.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--ink4);
  border-bottom: 1px solid var(--wire);
}

.output-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mid);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.label-dot {
  width: 6px;
  height: 6px;
  background: var(--signal);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.btn-export {
  background: none;
  border: 1px solid var(--wire2);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  letter-spacing: 0.03em;
}

.btn-export:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.btn-secondary {
  background: none;
  border: 1px solid var(--wire2);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  letter-spacing: 0.03em;
}

.btn-secondary:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.output-body {
  padding: 2rem 2.5rem;
  background: var(--ink2);
  line-height: 1.75;
  font-size: 0.9rem;
  font-weight: 300;
  max-height: 75vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--wire2) transparent;
}

.output-body::-webkit-scrollbar { width: 4px; }
.output-body::-webkit-scrollbar-track { background: transparent; }
.output-body::-webkit-scrollbar-thumb { background: var(--wire2); border-radius: 4px; }

/* ── Markdown output styling ── */
.output-body h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
}

.output-body h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--signal);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--wire);
}

.output-body h3 {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.5rem 0 0.4rem;
}

.output-body p {
  margin: 0.6rem 0;
  color: var(--text);
}

.output-body ul, .output-body ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.output-body li {
  margin: 0.35rem 0;
  color: var(--text);
}

.output-body blockquote {
  border-left: 3px solid var(--signal);
  margin: 1rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--signal-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.output-body blockquote p {
  font-style: italic;
  font-size: 1rem;
  color: var(--text);
  margin: 0;
}

.output-body strong {
  font-weight: 600;
  color: var(--text);
}

.output-body em {
  font-style: italic;
  color: var(--text-mid);
}

.output-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--ink4);
  border: 1px solid var(--wire);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--cyan);
}

.output-body hr {
  border: none;
  border-top: 1px solid var(--wire);
  margin: 2rem 0;
}

/* ── Loading State ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 2rem;
  gap: 1rem;
}

.loading-logo-pulse {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  color: var(--signal);
  animation: logoPulse 1.8s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 20px var(--signal-glow); }
  50%       { opacity: 0.45; text-shadow: none; }
}

.loading-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.4s ease;
  min-height: 1.2em;
}

.loading-bar {
  width: 160px;
  height: 2px;
  background: var(--wire);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.loading-bar-fill {
  height: 100%;
  width: 40%;
  background: var(--signal);
  border-radius: 2px;
  animation: barSlide 1.6s ease-in-out infinite;
}

@keyframes barSlide {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}

/* Legacy cursor (used inline during streaming) */
.streaming-cursor::after {
  content: '▋';
  color: var(--signal);
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Conversation Thread ── */
.conversation-section {
  border-top: 1px solid var(--wire);
  background: var(--ink);
}

.conversation-section.hidden { display: none; }

.conversation-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-low);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.conversation-divider::before,
.conversation-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--wire);
}

.conversation-thread {
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--wire2) transparent;
}

.conversation-thread::-webkit-scrollbar { width: 4px; }
.conversation-thread::-webkit-scrollbar-thumb { background: var(--wire2); border-radius: 4px; }

.convo-msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: fadeIn 0.2s ease;
}

.convo-msg-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.convo-msg.user .convo-msg-label { color: var(--text-low); }
.convo-msg.assistant .convo-msg-label { color: var(--signal); }

.convo-msg-body {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.convo-msg.user .convo-msg-body {
  background: var(--ink3);
  border: 1px solid var(--wire);
}

.convo-msg.assistant .convo-msg-body {
  background: var(--ink2);
  border: 1px solid var(--wire);
  border-left: 2px solid var(--signal);
}

/* Markdown inside conversation bubbles */
.convo-msg-body h1,
.convo-msg-body h2,
.convo-msg-body h3 { margin: 0.6rem 0 0.3rem; color: var(--text); font-size: 0.95rem; }
.convo-msg-body h2 { color: var(--signal); }
.convo-msg-body p  { margin: 0.4rem 0; }
.convo-msg-body ul,
.convo-msg-body ol { padding-left: 1.25rem; margin: 0.35rem 0; }
.convo-msg-body li { margin: 0.2rem 0; }
.convo-msg-body strong { font-weight: 600; }
.convo-msg-body code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--ink4);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--cyan);
}

.convo-loading .convo-msg-body {
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.conversation-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem 1.25rem;
}

.convo-input {
  flex: 1;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

.convo-input:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

.convo-input::placeholder { color: var(--text-low); }

.convo-send {
  background: var(--ink4);
  border: 1px solid var(--wire2);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.convo-send:hover {
  background: var(--signal);
  color: var(--ink);
  border-color: var(--signal);
}

.convo-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── SVG Visualisations ── */
.viz-arc-wrap,
.viz-archetype-wrap {
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.viz-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-low);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.viz-arc-wrap svg,
.viz-archetype-wrap svg {
  display: block;
  max-width: 100%;
  overflow: visible;
}

/* Hide the raw code blocks for arc/archetype (we replace them with SVGs) */
pre:has(code.language-arc),
pre:has(code.language-archetype) {
  display: none;
}

/* ── Error state ── */
.error-msg {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: var(--radius);
  background: rgba(255,71,87,0.05);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--wire);
  margin-top: 4rem;
}

.footer-sep { margin: 0 0.5rem; }

/* ════════════════════════════════════════════════
   CARD SYSTEM
   ════════════════════════════════════════════════ */

.output-card {
  border: 1px solid var(--wire2);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: var(--ink2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.02);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.output-card:hover { 
  border-color: #4a4a58; 
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, var(--ink3) 0%, var(--ink2) 100%);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.card-header:hover { background: linear-gradient(180deg, var(--ink4) 0%, var(--ink3) 100%); }

.card-header-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-strength-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #c4c4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-insight {
  font-size: 0.85rem;
  color: #9898aa;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-chevron {
  font-size: 1.1rem;
  color: #767687;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.output-card:hover .card-chevron { color: var(--signal); }

.output-card.collapsed .card-chevron { transform: rotate(-90deg); }

.card-body {
  padding: 1.75rem 2rem;
  background: var(--ink);
  border-top: 1px solid var(--wire);
  animation: fadeIn 0.2s ease;
}

.output-card.collapsed .card-body { display: none; }

/* Markdown inside card bodies — same as output-body */
.card-body h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  color: var(--signal);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--wire);
}

.card-body h3 {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.2rem 0 0.35rem;
}

.card-body p { margin: 0.5rem 0; color: var(--text); font-size: 0.9rem; line-height: 1.75; }
.card-body ul, .card-body ol { padding-left: 1.5rem; margin: 0.4rem 0; }
.card-body li { margin: 0.3rem 0; color: var(--text); font-size: 0.9rem; }
.card-body strong { font-weight: 600; }
.card-body em { font-style: italic; color: var(--text-mid); }

.card-body blockquote {
  border-left: 3px solid var(--signal);
  margin: 1rem 0;
  padding: 0.6rem 1.1rem;
  background: var(--signal-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.card-body blockquote p {
  font-style: italic;
  font-size: 1rem;
  color: var(--text);
  margin: 0;
}

.card-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--ink4);
  border: 1px solid var(--wire);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--cyan);
}

.card-body hr { border: none; border-top: 1px solid var(--wire); margin: 1.5rem 0; }

/* ════════════════════════════════════════════════
   VISUAL SCORECARD (Analyse tab)
   ════════════════════════════════════════════════ */

.scorecard-container {
  margin-bottom: 1.25rem;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  background: var(--ink3);
  overflow: hidden;
}

.scorecard-inner {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
}

.scorecard-ring-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--wire);
  gap: 0.4rem;
}

.scorecard-ring-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-low);
}

.scorecard-bars-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem 1.5rem;
  gap: 0.6rem;
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.score-bar-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-low);
  width: 110px;
  flex-shrink: 0;
}

.score-bar-track {
  flex: 1;
  height: 5px;
  background: var(--ink4);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-bar-value {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .scorecard-inner { grid-template-columns: 1fr; }
  .scorecard-ring-col { border-right: none; border-bottom: 1px solid var(--wire); }
}

/* ════════════════════════════════════════════════
   HEALTH BANNER (Diagnose tab)
   ════════════════════════════════════════════════ */

.health-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.health-score-ring {
  flex-shrink: 0;
}

.health-verdict-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.health-verdict-text {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text);
  line-height: 1.5;
}

.health-urgency-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  display: inline-block;
  width: fit-content;
}

/* ════════════════════════════════════════════════
   UPDATED VIZ WRAPPERS
   ════════════════════════════════════════════════ */

.viz-arc-wrap,
.viz-archetype-wrap {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.viz-arc-wrap svg { max-width: 100%; }
.viz-archetype-wrap svg { max-width: 100%; }

/* Hide raw code blocks for data blocks — replaced by visuals */
pre:has(code.language-arc),
pre:has(code.language-archetype),
pre:has(code.language-scorecard),
pre:has(code.language-health),
pre:has(code.language-strength) {
  display: none !important;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  header { padding: 1rem 1.25rem; }
  .header-sub { display: none; }
  .tab-nav { padding: 0 1rem; }
  .tab-btn { padding: 1rem 1.25rem 0.85rem; }
  main { padding: 1.75rem 1.25rem; }
  .tab-intro h1 { font-size: 1.75rem; }
  .output-body { padding: 1.25rem 1.5rem; }
  .modal { padding: 1.75rem; }
  .main-input { padding-bottom: 3.5rem; }
  .btn-generate { width: 100%; justify-content: center; padding: 1rem; font-size: 0.95rem; }
  .input-actions { width: 100%; margin-top: 1rem; }
}

/* ════════════════════════════════════════════════
   EMAIL GATE
   ════════════════════════════════════════════════ */

.email-gate-modal { max-width: 480px; }

.gate-input {
  width: 100%;
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.gate-input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-dim); }
.gate-input::placeholder { color: var(--text-low); }

.gate-select {
  width: 100%;
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  appearance: none;
  cursor: pointer;
  outline: none;
}
.gate-select:focus { border-color: var(--signal); }
.gate-select option { background: var(--ink3); }

.gate-error {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  margin-top: -0.75rem;
  margin-bottom: 0.5rem;
}
.gate-error.hidden { display: none; }

.gate-sub {
  text-align: center;
  color: var(--text-low);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  margin-top: 1rem;
  letter-spacing: 0.03em;
}

/* ════════════════════════════════════════════════
   PAYWALL
   ════════════════════════════════════════════════ */

.paywall-modal { max-width: 420px; text-align: center; }
.paywall-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.paywall-modal .modal-logo { font-size: 1.3rem; }

.paywall-features {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 1rem;
  width: 100%;
  margin-top: 0.5rem;
}
.pw-feat {
  font-size: 0.85rem;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ════════════════════════════════════════════════
   APP LAYOUT — SIDEBAR + MAIN
   ════════════════════════════════════════════════ */

.app-body {
  display: flex;
  min-height: calc(100vh - 250px);
  align-items: flex-start;
}

/* ── Sidebar ── */
.brand-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--ink2);
  border-right: 1px solid var(--wire);
  overflow-y: auto;
  max-height: calc(100vh - 130px);
  position: sticky;
  top: 130px;
  transition: width 0.25s ease, opacity 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--wire2) transparent;
}

.brand-sidebar::-webkit-scrollbar { width: 3px; }
.brand-sidebar::-webkit-scrollbar-thumb { background: var(--wire2); border-radius: 3px; }

.brand-sidebar.collapsed {
  width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wire);
  position: sticky;
  top: 0;
  background: var(--ink2);
  z-index: 10;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal);
}

.sidebar-close-btn {
  background: none;
  border: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.25rem;
  transition: color 0.15s;
}
.sidebar-close-btn:hover { color: var(--text); }

.sidebar-body { padding: 1rem; }

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--wire);
}

.sidebar-section.hidden { display: none; }

.sf-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sf-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-low);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sf-value-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  color: var(--signal);
  letter-spacing: 0;
  text-transform: none;
}

.sf-input {
  width: 100%;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}
.sf-input:focus { border-color: var(--signal); box-shadow: 0 0 0 2px var(--signal-dim); }
.sf-input::placeholder { color: var(--text-low); font-size: 0.78rem; }

.sf-select {
  width: 100%;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  appearance: none;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234e4e5a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  transition: border-color 0.15s;
}
.sf-select:focus { border-color: var(--signal); }
.sf-select option { background: var(--ink3); }

.sf-textarea {
  width: 100%;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.82rem;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.sf-textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 2px var(--signal-dim); }
.sf-textarea::placeholder { color: var(--text-low); font-size: 0.78rem; }

.sf-char-count {
  color: var(--text-low);
  font-size: 0.58rem;
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
}

.sf-hint {
  font-size: 0.75rem;
  color: var(--text-low);
  line-height: 1.5;
  margin-top: -0.1rem;
}

/* ── Multi-select pills ── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pill {
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: 3px;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.pill:hover { border-color: var(--wire2); color: var(--text-mid); }

.pill.active {
  background: var(--signal-dim);
  border-color: rgba(232,255,71,0.4);
  color: var(--signal);
}

/* ── Dual slider ── */
.dual-slider-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.dual-slider-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--wire);
  border-radius: 3px;
  z-index: 0;
}

.dual-range {
  position: absolute;
  width: 100%;
  height: 3px;
  background: none;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  z-index: 1;
}

.dual-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--signal);
  cursor: pointer;
  pointer-events: all;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--signal);
}

.dual-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--signal);
  cursor: pointer;
  pointer-events: all;
  border: 2px solid var(--ink);
}

/* ── Personality sliders ── */
.personality-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.1rem;
}

.ps-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ps-label-left,
.ps-label-right {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-low);
  white-space: nowrap;
  width: 60px;
  flex-shrink: 0;
}
.ps-label-right { text-align: right; }

.ps-range {
  flex: 1;
  height: 3px;
  background: var(--wire);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.ps-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--signal);
  cursor: pointer;
  border: 2px solid var(--ink);
}
.ps-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--signal);
  border: 2px solid var(--ink);
}

/* ── Media spend slider stops ── */
.spend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}
.spend-labels span {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text-low);
  text-align: center;
  flex: 1;
}

/* ── Deep mode toggle ── */
.deep-toggle {
  width: 100%;
  background: none;
  border: 1px dashed var(--wire);
  border-radius: var(--radius);
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.6rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
  margin: 0.5rem 0;
}
.deep-toggle:hover { border-color: var(--signal); color: var(--signal); }
.deep-toggle.active { border-color: var(--signal); color: var(--signal); }

/* ── Document upload ── */
.sidebar-docs { border-top: 1px solid var(--wire); padding-top: 0.75rem; margin-top: 0.25rem; border-bottom: none; }

.doc-upload-btn {
  width: 100%;
  background: var(--ink3);
  border: 1px dashed var(--wire2);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.55rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.doc-upload-btn:hover { border-color: var(--signal); color: var(--signal); }

.doc-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.doc-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  gap: 0.5rem;
}

.doc-file-name {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.doc-file-status {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-low);
  flex-shrink: 0;
}
.doc-file-status.ready { color: #4ade80; }
.doc-file-status.error { color: var(--red); }

.doc-file-remove {
  background: none;
  border: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.doc-file-remove:hover { color: var(--red); }

/* ── Sidebar footer ── */
.sidebar-footer {
  padding: 0.75rem 0 0.5rem;
  text-align: center;
}

.save-indicator {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ── Sidebar toggle button (header) ── */
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-low);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  margin-right: 0.1rem;
  line-height: 1;
}
.sidebar-toggle-btn:hover { color: var(--signal); background: var(--signal-dim); }

/* ── Header brand name display ── */
.header-brand-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--signal);
}
.header-brand-name.hidden { display: none; }

/* ── Generation counter ── */
.gen-counter-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--text-low);
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  transition: all 0.2s ease;
}

.gen-counter-badge.pro-active {
  border-color: var(--signal);
  background: var(--signal-mid);
  box-shadow: 0 0 10px var(--signal-glow);
  font-weight: 700;
}

/* ── Main — flex fill next to sidebar ── */
main {
  flex: 1;
  min-width: 0;
  max-width: 900px;
  padding: 2.5rem 2rem;
}

/* ════════════════════════════════════════════════
   VIDEO ANALYSIS
   ════════════════════════════════════════════════ */

.media-type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
  margin-bottom: 1.25rem;
}

.mtoggle-btn {
  background: var(--ink3);
  border: none;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mtoggle-btn + .mtoggle-btn { border-left: 1px solid var(--wire); }
.mtoggle-btn.active { background: var(--signal); color: var(--ink); font-weight: 600; }
.mtoggle-btn:not(.active):hover { background: var(--ink4); color: var(--text-mid); }

.video-src-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
  margin-bottom: 1rem;
}

.vsrc-btn {
  background: var(--ink3);
  border: none;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.vsrc-btn + .vsrc-btn { border-left: 1px solid var(--wire); }
.vsrc-btn.active { background: var(--signal-mid); color: var(--signal); }
.vsrc-btn:not(.active):hover { background: var(--ink4); }

.video-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vtoggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-mid);
  cursor: pointer;
}

.vtoggle-row input[type="checkbox"] {
  accent-color: var(--signal);
  cursor: pointer;
}

/* ════════════════════════════════════════════════
   SCORECARD IMPROVEMENTS
   ════════════════════════════════════════════════ */

/* Bigger ring */
.scorecard-ring-col { padding: 1.75rem 1.25rem; }

/* Taller score bars */
.score-bar-track { height: 16px; border-radius: 4px; }
.score-bar-fill  { height: 100%; border-radius: 4px; }

/* Percentage label */
.score-bar-pct {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════
   RESPONSIVE — SIDEBAR
   ════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .brand-sidebar {
    width: 260px;
  }
}

@media (max-width: 700px) {
  .app-body { display: block; }
  .brand-sidebar {
    width: 100%;
    max-height: none;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--wire);
  }
  .brand-sidebar.collapsed { display: none; width: auto; }
}

/* ══════════════════════════════════════════════════
   BULK LEADERBOARD
   ══════════════════════════════════════════════════ */

.bulk-drop-zone {
  border: 1px dashed var(--wire2);
  border-radius: var(--radius);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  flex-direction: column;
}

.bulk-drop-zone:hover,
.bulk-drop-zone.drag-over {
  border-color: var(--signal);
  background: var(--signal-dim);
}

.bulk-drop-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem;
  text-align: center;
}

.bulk-drop-prompt strong { color: var(--signal); }

.bulk-file-list {
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bulk-file-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: 100px;
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-mid);
  max-width: 200px;
}

.bulk-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.bulk-chip-remove {
  background: none;
  border: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 0.1rem;
  flex-shrink: 0;
  transition: color 0.15s;
}

.bulk-chip-remove:hover { color: var(--red); }

.bulk-add-more {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--signal);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.25rem 0.5rem;
}

/* Leaderboard table */
.leaderboard-container {
  padding: 0;
  background: var(--ink2);
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 48px 1fr 80px 80px 80px 80px 80px;
  gap: 0;
  background: var(--ink4);
  border-bottom: 1px solid var(--wire);
  padding: 0.6rem 1rem;
}

.leaderboard-header > div {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.leaderboard-header > div:nth-child(1) { text-align: left; padding-left: 0.25rem; }
.leaderboard-header > div:nth-child(2) { text-align: left; }

.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 1fr 80px 80px 80px 80px 80px;
  border-bottom: 1px solid var(--wire);
  padding: 0.9rem 1rem;
  transition: background 0.15s;
  animation: fadeIn 0.3s ease forwards;
}

.leaderboard-row:hover { background: rgba(255,255,255,0.02); }

.leaderboard-row.lb-top {
  background: rgba(232,255,71,0.03);
  border-left: 2px solid var(--signal);
}

.lb-rank {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-low);
  padding-top: 0.1rem;
}

.lb-rank-gold { color: #ffd700; }
.lb-rank-silver { color: #c0c0c0; }
.lb-rank-bronze { color: #cd7f32; }

.lb-name {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 1rem;
}

.lb-filename {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 500;
}

.lb-summary {
  font-size: 0.75rem;
  color: var(--text-mid);
  line-height: 1.4;
}

.lb-score-col {
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════════════════════════════════════════
   PERFORMANCE MATRIX — ACTION FEED
   ══════════════════════════════════════════════════ */

.matrix-header {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.7fr 0.7fr 0.8fr 0.8fr 0.8fr 36px;
  gap: 0;
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;
}

.matrix-col-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0.25rem;
}

.matrix-rows {
  border: 1px solid var(--wire);
  border-top: none;
  background: var(--ink2);
}

.matrix-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.7fr 0.7fr 0.8fr 0.8fr 0.8fr 36px;
  gap: 0;
  border-bottom: 1px solid var(--wire);
  transition: background 0.15s;
}

.matrix-row:last-child { border-bottom: none; }

.matrix-row-breaching {
  background: rgba(255,71,87,0.06);
  border-left: 2px solid var(--red);
}

.matrix-row-breaching .matrix-cell {
  background: transparent;
}

.matrix-cell {
  background: transparent;
  border: none;
  border-right: 1px solid var(--wire);
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 300;
  outline: none;
  width: 100%;
  transition: background 0.1s;
}

.matrix-cell:focus {
  background: var(--signal-dim);
}

.matrix-cell:last-of-type { border-right: none; }

.matrix-cell-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
}

.matrix-row-remove {
  background: none;
  border: none;
  border-left: 1px solid var(--wire);
  color: var(--text-low);
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  padding: 0 0.5rem;
}

.matrix-row-remove:hover {
  color: var(--red);
  background: rgba(255,71,87,0.08);
}

.btn-matrix-add {
  background: none;
  border: 1px solid var(--wire);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.04em;
}

.btn-matrix-add:hover {
  background: var(--signal-dim);
  color: var(--signal);
}

.matrix-thresholds {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
}

.threshold-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.threshold-chip {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-mid);
  background: var(--ink4);
  border: 1px solid var(--wire);
  border-radius: 100px;
  padding: 0.2rem 0.6rem;
}

.threshold-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--wire2);
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  width: 42px;
  padding: 0 0.1rem;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.threshold-input::-webkit-outer-spin-button,
.threshold-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Feed output — alert cards */
.feed-output-body .output-card {
  border-left-color: var(--red);
}

/* Alert badges in feed output */
.output-body h2:has(+ p strong) {
  color: var(--red);
}

/* ════════════════════════════════════════════════
   RESPONSIVENESS (Mobile/Tablet)
   ════════════════════════════════════════════════ */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Tablets & Small Desktop */
@media (max-width: 1024px) {
  .brand-sidebar {
    width: 260px;
  }
  main {
    max-width: 100%;
    padding: 2rem 1.5rem;
  }
}

/* Phones & Small Tablets */
@media (max-width: 768px) {
  header {
    padding: 0.75rem 1rem;
  }
  .logo { font-size: 1.25rem; }
  .header-sub, .header-rule, .header-brand-name {
    display: none !important;
  }
  
  .sidebar-toggle-btn {
    padding: 0.5rem;
  }

  .tab-nav {
    padding: 0 0.5rem;
  }
  .tab-btn {
    padding: 1rem 1.25rem 0.75rem;
    min-width: 120px;
  }
  .tab-name { font-size: 0.8rem; }
  .tab-desc { display: none; }

  .app-body {
    display: block;
    min-height: auto;
  }

  /* SIDEBAR AS DRAWER */
  .brand-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85%;
    z-index: 2000;
    background: var(--ink2);
    border-right: 1px solid var(--wire);
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 100vh;
  }

  .brand-sidebar.collapsed {
    transform: translateX(-100%);
    width: 320px; /* Keep width for animation */
    opacity: 1;
    pointer-events: all;
    display: block !important;
  }
  
  .sidebar-header {
    height: 60px;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .tab-intro h1 {
    font-size: 1.6rem;
  }
  .tab-intro p {
    font-size: 0.8rem;
  }

  .main-input {
    padding: 0.9rem 1rem;
    font-size: 0.85rem;
  }

  /* Modals */
  .modal {
    padding: 1.75rem 1.25rem;
    max-width: 100%;
    margin: 0.5rem;
  }
  
  .modal-logo {
    font-size: 1.6rem;
  }

  /* PDF Export - override desktop styles for mobile view */
  body.pdf-exporting {
    min-width: 1100px !important;
    overflow-x: auto !important;
  }
  
  body.pdf-exporting .app-body {
    display: flex !important;
  }
  
  body.pdf-exporting .brand-sidebar {
    position: sticky !important;
    transform: none !important;
    width: 300px !important;
  }
  
  body.pdf-exporting main {
    max-width: 800px !important;
  }
}

/* Very Small Phones */
@media (max-width: 480px) {
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary {
    width: 100%;
    text-align: center;
    padding: 0.8rem;
  }
  
  .personality-sliders .ps-row {
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
  }
  .ps-range { width: 100%; }
}

/* ── UX & Conversion Overhaul Extensions ── */

/* Header & Status */
.btn-upgrade-header {
  background: linear-gradient(135deg, #e8ff47 0%, #00d4ff 100%);
  color: #000;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  cursor: pointer;
  margin-right: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 15px rgba(232, 255, 71, 0.25);
  animation: headerPulse 3s infinite;
}

@keyframes headerPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 15px rgba(232, 255, 71, 0.25); }
  50% { transform: scale(1.03); box-shadow: 0 0 25px rgba(232, 255, 71, 0.5); }
}

.btn-upgrade-header:hover {
  transform: translateY(-1px) scale(1.05);
  filter: brightness(1.1);
}

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--signal);
  color: #000;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 900;
  margin-left: 4px;
  animation: heartPulse 1.5s infinite;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--signal-dim);
  border: 1px solid var(--signal-mid);
  color: var(--signal);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--signal-mid);
  border-color: var(--signal);
}

.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--wire);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  z-index: 900;
  animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.status-text {
  color: var(--text-mid);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.status-btn {
  background: none;
  border: 1px solid var(--signal);
  color: var(--signal);
  padding: 0.35rem 1rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-btn:hover {
  background: var(--signal);
  color: #000;
}

/* Magic Wand */
.textarea-container {
  position: relative;
  width: 100%;
}

.magic-wand-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--ink4);
  border: 1px solid var(--wire);
  color: var(--signal);
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.magic-wand-btn:hover {
  transform: rotate(15deg) scale(1.1);
  background: var(--wire);
  border-color: var(--signal);
}

.magic-wand-btn.casting {
  animation: wandCast 0.6s ease;
}

@keyframes wandCast {
  0% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.5) rotate(45deg); filter: brightness(1.5); }
  100% { transform: scale(1) rotate(0); }
}

/* ── Onboarding Engine ── */
.onboarding-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  pointer-events: auto;
  transition: opacity 0.4s ease;
}

/* Spotlight Effect */
.onboarding-spotlight {
  position: absolute;
  z-index: 10001;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  border: 1.5px solid var(--signal);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.onboarding-tooltip {
  position: fixed;
  z-index: 10002;
  background: rgba(24, 24, 30, 0.85);
  border: 1px solid rgba(232, 255, 71, 0.3);
  border-radius: 16px;
  padding: 1.75rem;
  width: 340px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(232, 255, 71, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: otFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes otFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ot-content h4 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--signal);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.ot-content p {
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.ot-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ot-btn-skip {
  background: none;
  border: none;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ot-btn-skip:hover { 
  color: var(--text-mid);
  background: rgba(255,255,255,0.05);
}

.ot-btn-next {
  background: var(--signal);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(232, 255, 71, 0.2);
}

.ot-btn-next:hover { 
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(232, 255, 71, 0.4);
  filter: brightness(1.1);
}

.ot-btn-next:active {
  transform: translateY(0);
}

/* ── Authentication Modal ── */
.auth-modal {
  max-width: 480px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--wire);
  margin-bottom: 1.5rem;
  gap: 0;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--text-low);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab:hover { color: var(--text-mid); }

.auth-tab.active {
  color: var(--signal);
  border-bottom-color: var(--signal);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.btn-google:hover {
  background: #f8f8f8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--wire);
}

.auth-divider span {
  padding: 0 1rem;
  color: var(--text-low);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── User Indicator ── */
.user-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--signal-dim);
  border: 1px solid rgba(232,255,71,0.15);
  border-radius: 100px;
  padding: 0.3rem 0.6rem 0.3rem 0.9rem;
}

.user-email-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-mid);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: none;
  border: 1px solid var(--wire);
  color: var(--text-low);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Paywall Close ── */
.paywall-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: 1px solid var(--wire);
  color: var(--text-mid);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.paywall-close-x:hover {
  border-color: var(--text);
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* ════════════════════════════════════════════════
   SUMMARY DASHBOARD (THE BOXES)
   ════════════════════════════════════════════════ */

.summary-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  animation: fadeIn 0.4s ease;
}

.dash-box {
  background: var(--ink3);
  border: 1px solid var(--wire);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.dash-box:hover {
  transform: translateY(-4px);
  border-color: var(--wire2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.dash-box.highlight {
  border-color: rgba(232,255,71,0.2);
  background: linear-gradient(145deg, var(--ink3) 0%, var(--ink2) 100%);
  border-width: 1.5px;
}

.dash-box.critical {
  border-color: rgba(255, 71, 87, 0.4);
  background: rgba(255, 71, 87, 0.08);
}

.dash-box-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.dash-box-value {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--text);
  font-weight: 700;
}

.dash-box-value.small {
  font-size: 1.4rem;
  font-family: var(--font-mono);
  color: var(--signal);
  margin-top: 0.25rem;
}

.dash-box-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  font-weight: 500;
}

.dash-box-bar {
  height: 6px;
  background: var(--wire);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.dash-box-bar div {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tablet / Mobile Grid adjustments */
@media (max-width: 900px) {
  .summary-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .summary-dashboard {
    grid-template-columns: 1fr;
  }
  .dash-box-value {
    font-size: 1.8rem;
  }
}


/* Simple sections (non-cards) */
.section-simple {
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
  animation: fadeIn 0.3s ease;
}
.section-simple h2, .section-simple h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--signal);
}
.section-simple p {
  color: var(--text-mid);
  line-height: 1.6;
}

/* ── Dashboard Layouts & Components ── */

.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--wire);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

/* Strategic POV */
.strategic-pov-card {
  border-left: 4px solid var(--accent);
  padding: 2rem;
}

.strategic-pov-card h2 {
  font-family: var(--font-syne);
  font-weight: 800;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.strategic-pov-card p {
  color: var(--text-mid);
  font-size: 1rem;
}

.badge-generated {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255,255,255,0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* Angles Grid */
.angles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
}

@media (max-width: 580px) {
}

.angle-card h3 {
  font-family: var(--font-syne);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.hook-box {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.indian-insight {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-bottom: 1.25rem;
  font-style: italic;
}

.format-badge {
  display: inline-block;
  background: rgba(232, 255, 71, 0.12);
  color: var(--accent);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid rgba(232, 255, 71, 0.3);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.4;
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
  overflow: visible;
}

.platform-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.platform-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.p-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.p-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.p-rationale {
  font-size: 0.75rem;
  color: var(--text-low);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  border-top: 1px solid var(--wire);
  padding-top: 1rem;
  margin-bottom: 1.5rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.m-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-mid);
}

.m-bar-bg {
  height: 4px;
  background: var(--wire);
  border-radius: 2px;
  overflow: hidden;
}

.m-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.metric-item.na { opacity: 0.4; }
.metric-item.na .m-bar-fill { background: var(--text-low); }

.btn-toggle-rationale {
  width: 100%;
  background: none;
  border: 1px solid var(--wire);
  color: var(--text-mid);
  padding: 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-toggle-rationale:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.full-rationale-box {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.6;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}

.case-study-ref {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--amber);
  border-top: 1px dashed var(--wire);
  padding-top: 0.75rem;
}

/* Persona Cards */
.persona-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .persona-grid { grid-template-columns: 1fr; }
}

.persona-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.p-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.p-avatar {
  width: 80px;
  height: 80px;
  background: var(--wire);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-mid);
  border: 2px solid var(--accent);
}

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

.p-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.p-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.p-name-main {
  font-family: var(--font-syne);
  font-weight: 700;
  font-size: 1.1rem;
}

.p-age-city {
  font-size: 0.85rem;
  color: var(--text-mid);
}

.p-job {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.p-nccs {
  background: var(--wire);
  color: var(--text-mid);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  width: fit-content;
}

.p-trigger, .p-message {
  font-size: 0.85rem;
  line-height: 1.6;
}

.p-trigger em, .p-message span {
  display: block;
  margin-top: 0.2rem;
}

.label-mini {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.p-message span { color: var(--text); }
.p-trigger em { color: var(--text-mid); font-style: italic; }

/* Table Component */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.custom-table th {
  background: rgba(255,255,255,0.03);
  text-align: left;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-low);
  text-transform: uppercase;
  border-bottom: 1px solid var(--wire);
  white-space: nowrap;
}

/* Column width distribution for platform strategy table */
.custom-table th:nth-child(1) { width: 12%; }
.custom-table th:nth-child(2) { width: 18%; }
.custom-table th:nth-child(3) { width: 12%; }
.custom-table th:nth-child(4) { width: 26%; }
.custom-table th:nth-child(5) { width: 32%; }

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wire);
  color: var(--text);
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.5;
}

/* Platform name column should never wrap */
.custom-table td:first-child {
  white-space: nowrap;
}

.custom-table tr:last-child td { border-bottom: none; }

.table-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-p-bar {
  flex: 1;
  height: 6px;
  background: var(--wire);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.table-p-fill {
  height: 100%;
  background: var(--accent);
}

/* Checklist */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.check-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.check-num {
  width: 28px;
  height: 28px;
  background: rgba(232, 255, 71, 0.12);
  color: var(--accent);
  border: 1px solid rgba(232, 255, 71, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.check-text { font-size: 0.95rem; }

/* Budget Metrics */
.budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
}

.b-metric-card {
  background: var(--wire);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  min-width: 0;
}

.b-amount {
  font-family: var(--font-syne);
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  line-height: 1.3;
}

.b-label {
  font-size: 0.75rem;
  color: var(--text-mid);
  line-height: 1.5;
}

/* Bottom Bar */
.output-bottom-bar {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--wire);
  padding-top: 1.5rem;
}

@media (max-width: 480px) {
  .output-bottom-bar { flex-direction: column; }
  .output-bottom-bar button { width: 100%; }
}

/* Score Ring */
.score-circle-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.score-ring {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-svg { transform: rotate(-90deg); }

.ring-bg {
  fill: none;
  stroke: var(--wire);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-out;
}

.score-number {
  position: absolute;
  font-family: var(--font-syne);
  font-weight: 800;
  font-size: 2rem;
}

.score-meta h4 {
  font-family: var(--font-syne);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.score-meta p {
  color: var(--text-mid);
  font-size: 0.9rem;
}

/* Audit Split Screen */
.audit-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 800px) {
  .audit-split { grid-template-columns: 1fr; }
}

.audit-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-media {
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--wire);
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.panel-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.empty-direction-box {
  padding: 2rem;
  text-align: center;
  color: var(--text-low);
  font-style: italic;
  font-size: 0.9rem;
}

/* Annotation Markers */
.marker {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: help;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  z-index: 10;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  transition: transform 0.2s;
}

.marker:hover { transform: scale(1.2); }

.marker.problem { background: var(--danger); }
.marker.strength { background: var(--success); }

.marker-tooltip {
  position: absolute;
  background: #fff;
  color: #000;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
}

.marker:hover .marker-tooltip { opacity: 1; }

/* Fix Cards */
.fix-cards-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
}

@media (max-width: 580px) {
}

.fix-card {
  background: var(--surface);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  min-width: 0;
  word-break: break-word;
}

.fix-num {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--wire);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.prio-dot {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.prio-dot.critical { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.prio-dot.major { background: var(--amber); }
.prio-dot.minor { background: var(--text-low); }

.fix-content {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.f-prob { color: var(--text-mid); font-size: 0.85rem; }
.f-sol { color: #fff; font-size: 0.95rem; font-weight: 500; }
.f-impact {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--success);
  margin-top: 0.5rem;
}

/* Indian Market Notes Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chip {
  background: var(--wire);
  color: var(--text-mid);
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
}

/* Diagnose Platform Badge */
.platform-badge-main {
  background: rgba(232, 255, 71, 0.12);
  color: var(--accent);
  border: 1px solid rgba(232, 255, 71, 0.3);
  width: fit-content;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

/* Summary Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* Action Cards */
.action-cards-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .action-cards-container { flex-direction: row; }
}

.action-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prio-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  width: fit-content;
}

.prio-badge.do_today { background: var(--danger); color: #fff; }
.prio-badge.do_this_week { background: var(--amber); color: #000; }

.action-headline {
  font-family: var(--font-syne);
  font-weight: 700;
  font-size: 1.15rem;
}

.action-detail { color: var(--text-mid); font-size: 0.85rem; }

.money-box {
  background: rgba(16,185,129,0.1);
  color: var(--success);
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px dashed var(--success);
}

.how-to-box {
  background: #000;
  padding: 0.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-low);
  line-height: 1.5;
}

/* Chart Section */
.chart-container {
  height: 300px;
  margin: 1.5rem 0;
}

.chart-insight-box {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-mid);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

/* Benchmarks Row */
.benchmark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.benchmark-chip {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--wire);
  padding: 1rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.b-verdict-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Creative Fatigue */
.fatigue-card { border-top: 2px solid var(--danger); }

.f-metric-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.f-m-item { text-align: center; }
.f-val { font-family: var(--font-mono); font-size: 1.1rem; display: block; }
.f-lbl { font-size: 0.7rem; color: var(--text-low); text-transform: uppercase; }

/* CSV Upload Styling */
.diagnose-upload-single {
  margin-bottom: 1.5rem;
}

/* Keep old class for backwards compat */
.diagnose-upload-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .diagnose-upload-row { grid-template-columns: 1fr; }
}

.upload-btn-card {
  background: var(--surface);
  border: 1px dashed var(--wire);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

/* Single-button upload variant: full-width, horizontal layout */
.upload-btn-card--single {
  flex-direction: row;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-style: dashed;
  border-width: 2px;
}

.upload-btn-card--single .u-hint {
  font-size: 0.75rem;
  color: var(--text-mid);
  text-align: left;
}

.upload-btn-card--single .u-label {
  font-size: 1rem;
  font-weight: 700;
}


.upload-btn-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.u-icon { font-size: 1.5rem; }
.u-label { font-size: 0.85rem; font-weight: 600; text-align: center; }
.u-hint { font-size: 0.65rem; color: var(--text-low); font-family: var(--font-mono); }

.or-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  color: var(--text-low);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.or-divider::before, .or-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--wire);
}

.help-text-row { margin-bottom: 1.5rem; }
.help-details {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-low);
}

.help-details summary:hover { color: var(--text-mid); }

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  margin-top: 0.75rem;
}

@media (max-width: 600px) {
  .help-grid { grid-template-columns: 1fr; }
}

/* Preview Panel */
.preview-panel {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

#csv-preview-title { font-weight: 700; color: var(--accent); }
.btn-remove-csv {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.75rem;
  cursor: pointer;
}

.preview-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

/* User Requested Fixes */
.budget-card h2, .budget-amount {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.2;
}

.platform-table td:last-child, .custom-table td:last-child {
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  font-size: 13px;
  line-height: 1.5;
}

.card, .card-body, .output-card {
  line-height: 1.5;
}

.card *, .output-card *, .angle-card * {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.angle-card {
  padding: 20px !important;
  overflow: hidden;
}

.angle-card .format-badge {
  overflow: visible !important;
}

.card p, .card li, .output-card p, .output-card li {
  font-size: 14px;
}

/* Ensure the platform strategy table rationale text is fully visible */
.custom-table td:last-child {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* Budget grid responsive fix */
.budget-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (max-width: 480px) {
  .budget-grid {
    grid-template-columns: 1fr !important;
  }
  .angles-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .angles-grid {
    grid-template-columns: 1fr !important;
  }
  .fix-cards-row {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1024px) {
  .angles-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Briq Angles rebuild */
.briq-angles-dashboard {
  background: #0A0F1E;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: -2rem -2.5rem;
  padding: 1.5rem;
}

.briq-output-actions {
  display: flex;
  justify-content: flex-end;
}

.briq-summary-card,
.briq-angle-card,
.briq-panel {
  background: #111827;
  border: 1px solid #1F2937;
  border-radius: 12px;
  overflow: hidden;
}

.briq-summary-card,
.briq-panel {
  padding: 1.25rem;
}

.briq-summary-card p,
.briq-panel p,
.briq-card-section p {
  color: #D1D5DB;
  font-size: 0.9rem;
  line-height: 1.65;
}

.briq-section-label,
.briq-meta-label {
  color: #F5C842;
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
}

.briq-angles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.briq-angle-card {
  min-width: 0;
}

.briq-angle-header {
  align-items: flex-start;
  border-bottom: 1px solid #1F2937;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1.1rem;
}

.briq-angle-eyebrow {
  color: #F5C842;
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.briq-angle-header h2 {
  color: #FFFFFF;
  font-family: var(--font-syne);
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
}

.briq-angle-header-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
}

.briq-type-badge {
  border-radius: 999px;
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  max-width: 140px;
  overflow: hidden;
  padding: 4px 10px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.briq-type-emotional { background: #253142; color: #F5C842; }
.briq-type-rational { background: #1F3A5F; color: #60A5FA; }
.briq-type-social-proof { background: #1A3A2A; color: #4ADE80; }
.briq-type-fomo { background: #3A1F1F; color: #F87171; }
.briq-type-pride { background: #3A2A0A; color: #FCD34D; }

.briq-collapse-btn {
  align-items: center;
  background: #0A0F1E;
  border: 1px solid #1F2937;
  border-radius: 8px;
  color: #F5C842;
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  height: 32px;
  justify-content: center;
  line-height: 1;
  transition: transform 0.15s ease, border-color 0.15s ease;
  width: 32px;
}

.briq-angle-card.collapsed .briq-angle-body {
  display: none;
}

.briq-angle-card.collapsed .briq-collapse-btn {
  transform: rotate(-90deg);
}

.briq-angle-body {
  display: flex;
  flex-direction: column;
}

.briq-card-section {
  border-bottom: 1px solid #1F2937;
  padding: 1rem 1.1rem;
}

.briq-card-section:last-child {
  border-bottom: none;
}

.briq-hook-row {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  padding: 0.55rem 0;
}

.briq-hook-row + .briq-hook-row {
  border-top: 1px solid rgba(31, 41, 55, 0.7);
}

.briq-hook-row span {
  color: #9CA3AF;
  font-size: 0.78rem;
  font-weight: 700;
}

.briq-hook-row p {
  color: #FFFFFF;
  font-size: 0.88rem;
  margin: 0;
}

.briq-hook-hindi p {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 0.95rem;
}

.briq-copy-btn {
  background: #0A0F1E;
  border: 1px solid #1F2937;
  border-radius: 8px;
  color: #F5C842;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  min-width: 54px;
  padding: 0.35rem 0.55rem;
  text-align: center;
}

.briq-copy-btn.copied {
  border-color: #4ADE80;
  color: #4ADE80;
}

.briq-persona-line {
  align-items: center;
  color: #9CA3AF;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.briq-persona-line strong {
  color: #FFFFFF;
}

.briq-persona-line span::before {
  color: #4B5563;
  content: "|";
  margin-right: 0.45rem;
}

.briq-trigger {
  margin-top: 0.6rem;
}

.briq-platform-table {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.briq-platform-row {
  align-items: start;
  background: #0A0F1E;
  border: 1px solid #1F2937;
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 68px 78px minmax(0, 1fr);
  padding: 0.7rem;
}

.briq-platform-row span {
  color: #FFFFFF;
  font-weight: 800;
}

.briq-platform-row strong {
  color: #F5C842;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.briq-platform-row p {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.briq-benchmark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.briq-benchmark-row span {
  background: #0A0F1E;
  border: 1px solid #1F2937;
  border-radius: 8px;
  color: #D1D5DB;
  flex: 1 1 160px;
  font-size: 0.82rem;
  padding: 0.65rem;
}

.briq-benchmark-row strong,
.briq-notes-grid strong {
  color: #FFFFFF;
}

.briq-source {
  color: #9CA3AF !important;
  font-family: var(--font-mono);
  font-size: 0.72rem !important;
  margin-top: 0.75rem;
}

.briq-notes-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.briq-notes-grid p {
  background: #0A0F1E;
  border: 1px solid #1F2937;
  border-radius: 8px;
  margin: 0;
  padding: 0.75rem;
}

.briq-panel h3 {
  color: #FFFFFF;
  font-family: var(--font-syne);
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.briq-panel-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #F5C842;
  cursor: pointer;
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.1em;
  padding: 0;
  text-transform: uppercase;
  width: 100%;
}

.briq-kb-panel.collapsed .briq-kb-body {
  display: none;
}

.briq-kb-panel.collapsed .briq-toggle-icon {
  transform: rotate(-90deg);
}

.briq-kb-body {
  margin-top: 1rem;
}

.briq-kb-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.briq-kb-grid strong {
  color: #FFFFFF;
  display: block;
}

.briq-kb-copy p {
  margin-bottom: 1rem;
}

.briq-kb-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.briq-pdf-mode {
  max-height: none !important;
  overflow: visible !important;
}

.briq-pdf-mode .briq-output-actions,
.briq-pdf-mode .briq-kb-actions,
.briq-pdf-mode .briq-collapse-btn,
.briq-pdf-mode .briq-copy-btn {
  display: none !important;
}

.briq-pdf-mode .briq-angle-card,
.briq-pdf-mode .briq-panel,
.briq-pdf-mode .briq-summary-card {
  break-inside: avoid;
  page-break-inside: avoid;
}

@media (max-width: 1024px) {
  .briq-angles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .briq-angles-dashboard {
    margin: -1.25rem -1.5rem;
    padding: 1rem;
  }

  .briq-angles-grid,
  .briq-kb-grid,
  .briq-notes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .briq-platform-row,
  .briq-hook-row {
    grid-template-columns: 1fr;
  }

  .briq-copy-btn {
    justify-self: start;
  }

  .briq-kb-actions,
  .briq-output-actions {
    flex-direction: column;
  }

  .briq-kb-actions button,
  .briq-output-actions button {
    width: 100%;
  }
}
