/* --- CSS VARIABLE DESIGN TOKENS --- */
:root {
    --bg-main: #07070a;
    --bg-sidebar: #0d0d12;
    --bg-card: #121217;
    --bg-card-hover: #171720;
    --bg-input: #1a1a23;
    
    /* Borders do two different jobs and were both doing neither well at 12%
       alpha of a mid-red: too faint to separate surfaces, too warm to read as
       neutral. Structural edges are now a neutral white at low alpha so panels
       actually delineate; the red is kept for interaction states, where it
       means something. */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-hover: rgba(239, 68, 68, 0.35);
    --border-focus: rgba(239, 68, 68, 0.6);

    /* Elevation. Everything sat on one plane before, so nothing looked
       clickable and cards blended into the page. */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 8px 24px rgba(239, 68, 68, 0.18);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary-red: #ef4444;
    --primary-red-hover: #dc2626;
    --primary-red-active: #b91c1c;
    --primary-red-glow: rgba(239, 68, 68, 0.25);
    
    --accent-red-light: #f87171;
    --accent-dark: #7f1d1d;
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.15);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
    --border-radius-sm: 4px;
}

/* --- RESET & SYSTEM STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* --- COMMON COMPONENTS & BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-red), var(--primary-red-hover));
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-red-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary.active {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: var(--primary-red);
    color: #ffffff;
}

.btn-accent {
    background-color: var(--accent-dark);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

.btn-accent:hover {
    background-color: var(--primary-red-hover);
    border-color: var(--primary-red);
    box-shadow: 0 4px 14px var(--primary-red-glow);
}

.btn-block {
    display: flex;
    width: 100%;
}

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

.hidden {
    display: none !important;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background-color: var(--bg-card);
    border-left: 4px solid var(--primary-red);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-smooth);
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.error {
    border-left-color: var(--primary-red);
}

.toast i {
    font-size: 18px;
}

.toast.success i { color: var(--accent-green); }
.toast.info i { color: #3b82f6; }
.toast.error i { color: var(--primary-red); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- AUTH GATE SYSTEM --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: radial-gradient(circle at 30% 50%, #1c1012 0%, var(--bg-main) 70%);
}

/* Split-screen left panel */
.auth-panel-left {
    flex: 1.1;
    background: linear-gradient(160deg, #1c0a0a 0%, #0f0808 60%, #07070a 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 48px 52px;
    gap: 32px;
    position: relative;
    overflow: hidden;
}
.auth-panel-left::before {
    content: '';
    position: absolute; top: -100px; left: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(239,68,68,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.auth-panel-brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-heading); font-weight: 800; font-size: 22px; color: #fff;
}
.auth-panel-brand .logo-icon { color: var(--primary-red); font-size: 20px; filter: drop-shadow(0 0 6px var(--primary-red-glow)); }
.auth-panel-brand .logo-text span { color: var(--primary-red); }
.auth-panel-hero { display: flex; flex-direction: column; gap: 16px; }
.auth-panel-headline {
    font-family: var(--font-heading); font-size: 34px; font-weight: 800;
    color: #fff; line-height: 1.2; letter-spacing: -0.5px;
}
.auth-panel-sub {
    font-size: 14px; color: rgba(255,255,255,0.6); line-height: 1.75; max-width: 400px;
}
.auth-feature-list {
    list-style: none; display: flex; flex-direction: column; gap: 12px; margin-top: 8px;
}
.auth-feature-list li {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: rgba(255,255,255,0.75);
}
.auth-feature-list li i { color: var(--accent-green); font-size: 13px; }
.auth-dashboard-preview {
    flex: 1; display: flex; align-items: flex-end;
    min-height: 0;
}
.auth-dashboard-preview img {
    width: 100%; border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
}

/* Right panel */
.auth-panel-right {
    width: 480px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    background: var(--bg-main);
}

/* Responsive: collapse left panel on small screens */
@media (max-width: 900px) {
    .auth-panel-left { display: none; }
    .auth-panel-right { width: 100%; padding: 24px; }
}

.auth-card {
    background-color: rgba(18, 18, 23, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 36px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 40px rgba(239, 68, 68, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 26px;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--primary-red);
    font-size: 24px;
    filter: drop-shadow(0 0 8px var(--primary-red-glow));
}

.logo-text span {
    color: var(--primary-red);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 8px;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    background: none;
    border: none;
    padding: 12px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
}

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

.auth-form {
    display: none;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .input-group {
    flex: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-group input, .input-group select, .input-group textarea {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: var(--border-radius-md);
    outline: none;
    transition: var(--transition-smooth);
}

.input-group input:hover, .input-group select:hover, .input-group textarea:hover {
    border-color: var(--border-hover);
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* --- APPLICATION LAYOUT --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile-badge {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile-badge .avatar {
    font-size: 32px;
    color: var(--primary-red);
}

.user-profile-badge .profile-details {
    display: flex;
    flex-direction: column;
}

.user-profile-badge .username {
    font-weight: 600;
    color: #ffffff;
}

.badge {
    display: inline-flex;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-accent {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--primary-red);
    border: 1px solid var(--border-color);
}

.sidebar-menu {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-weight: 500;
    text-align: left;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #ffffff;
}

.nav-item.active {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ffffff;
    border-radius: var(--border-radius-md);
    box-shadow: inset 3px 0 0 var(--primary-red);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--primary-red);
}

/* --- MAIN CONTENT & HEADER --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 100vh;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.page-title-area h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.page-title-area .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.business-id-selector {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.business-id-selector .label {
    color: var(--text-secondary);
    font-size: 12px;
}

.business-id-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.business-id-field .value {
    font-family: var(--font-mono);
    color: var(--primary-red);
    font-size: 12px;
    font-weight: 600;
}

.btn-copy {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-copy:hover {
    color: #ffffff;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 1.8s infinite;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- OVERVIEW PANEL --- */
.dashboard-panel {
    display: none;
    flex-direction: column;
    gap: 32px;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-panel.active {
    display: flex;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stat-card {
    background-color: rgba(18, 18, 23, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-card .icon-wrapper {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--primary-red);
    width: 54px;
    height: 54px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-details h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-details .value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin: 4px 0;
}

.stat-details .trend {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-details .trend.positive {
    color: var(--accent-green);
}

.dashboard-content-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.content-card {
    background-color: rgba(18, 18, 23, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
}

/* History List style */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.history-item {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-info .title {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
}

.history-info .meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.history-info .meta span i {
    margin-right: 4px;
}

.history-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.score-badge {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green-glow);
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 11px;
}

.score-badge.pending {
    background-color: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.score-badge.failed {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--primary-red);
    border-color: var(--border-color);
}

/* Where an uploaded document ended up. Shares the score-badge sizing so the
   documents table stays visually consistent, but carries an icon and a label
   naming the destination — a voice document goes into the Brand Brain, a
   reference document into the retrieval index. */
.doc-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.doc-status i { font-size: 10px; }

.doc-status.is-done {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border-color: var(--accent-green-glow);
}

.doc-status.is-pending {
    background-color: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.doc-status.is-failed {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--primary-red);
    border-color: rgba(239, 68, 68, 0.25);
    cursor: help;
}

.history-score .time {
    font-size: 11px;
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 38px;
    color: var(--text-muted);
}

/* Secondary sidebar card inside overview */
.brand-voice-preview {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-item .label {
    font-size: 12px;
    color: var(--text-secondary);
}

.preview-item .count {
    font-weight: 600;
    font-size: 15px;
    color: var(--primary-red);
}

.preview-item .percentage {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

.progress-bar-container {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-red-hover), var(--primary-red));
    border-radius: 3px;
}

.info-alert {
    background-color: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    padding: 16px;
    border-radius: var(--border-radius-md);
    display: flex;
    gap: 12px;
    color: #93c5fd;
    font-size: 12px;
}

.info-alert i {
    font-size: 16px;
    margin-top: 2px;
}

/* --- GENERATOR PANEL --- */
.generator-split {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

.format-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* An odd card out spans the row rather than leaving a gap beside it. */
.format-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.format-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.format-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.format-card i {
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.format-card span {
    font-size: 12px;
    font-weight: 500;
}

.format-card:hover {
    border-color: var(--border-hover);
}

.format-card.active {
    border-color: var(--primary-red);
    background-color: rgba(239, 68, 68, 0.05);
}

.format-card.active i {
    color: var(--primary-red);
    filter: drop-shadow(0 0 4px var(--primary-red-glow));
}

.toggle-row {
    margin: 8px 0;
}

.toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle Switch slider styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-red);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Stream Terminal UI */
.output-card {
    height: auto;
    /* No max-height/overflow:hidden here. With the feedback card shown the
       stack (console + research + draft + feedback) is taller than 850px, and
       clipping it cut the generated draft off with nothing to scroll: the copy
       button worked while the text it copied could not be read. The column
       scrolls with the page instead. */
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.output-header h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
}

.output-status {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.output-status.running {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--primary-red);
    border: 1px solid var(--border-color);
    animation: statusPulse 1.5s ease-in-out infinite;
}

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

/* Button loading state */
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}
.btn.loading span { opacity: 0; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}
@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

.stream-console {
    background-color: #050507;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-md);
    padding: 20px;
    min-height: 240px;
    max-height: 320px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stream-console .placeholder-text {
    color: var(--text-muted);
    font-size: 13px;
    margin: auto;
    text-align: center;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stream-console .placeholder-text i {
    font-size: 26px;
}

.console-log {
    border-left: 2px solid var(--border-color);
    padding-left: 12px;
    animation: fadeInLog 0.2s ease-out;
}

.console-log.highlight {
    border-left-color: var(--primary-red);
    color: #ffffff;
    font-weight: 500;
}

.console-log.success {
    border-left-color: var(--accent-green);
    color: var(--accent-green);
}

.console-log.timestamp {
    color: var(--text-muted);
    font-size: 11px;
}

@keyframes fadeInLog {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

.generated-output-box {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: rgba(255, 255, 255, 0.01);
    overflow: hidden;
    margin-top: 10px;
}

.content-rendered-header {
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-rendered-header h3 {
    font-size: 13px;
    color: #ffffff;
}

.rendered-markdown {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    white-space: pre-wrap;
    color: #e5e7eb;
}

/* Feedback card designs */
.feedback-card {
    background-color: rgba(239, 68, 68, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.card-header-accent {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.card-header-accent h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header-accent p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.feedback-metrics-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.feedback-approve-switch {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.feedback-approve-switch .label {
    font-size: 11px;
    color: var(--text-secondary);
}

.approve-badge-toggle input {
    position: absolute;
    opacity: 0;
}

.approve-label-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-color);
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--primary-red);
}

.approve-label-badge.approved {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.2);
}

.feedback-score-slider {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.score-value {
    font-weight: 700;
    color: var(--primary-red);
}

.feedback-score-slider input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.feedback-score-slider input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-red);
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-red-glow);
    transition: var(--transition-smooth);
}

.feedback-score-slider input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #ffffff;
}

/* --- DOCUMENTS PANEL --- */
.documents-layout {
    display: grid;
    grid-template-columns: 1.1fr 1.8fr;
    gap: 24px;
}

/* Dropzone style */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-dropzone:hover {
    border-color: var(--primary-red);
    background-color: rgba(239, 68, 68, 0.03);
}

.upload-dropzone i {
    font-size: 38px;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.upload-dropzone:hover i {
    color: var(--primary-red);
    transform: translateY(-2px);
}

.upload-dropzone .primary-msg {
    font-weight: 600;
    color: #ffffff;
}

.upload-dropzone .secondary-msg {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 80%;
}

.selected-file-badge {
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.selected-file-badge .file-icon {
    color: var(--primary-red);
}

.selected-file-badge .file-name {
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-clear:hover {
    color: var(--primary-red);
}

/* Guideline Table View */
.documents-table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.01);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.02);
    font-family: var(--font-heading);
    font-weight: 600;
    color: #ffffff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

.table-empty i {
    font-size: 32px;
    margin-bottom: 10px;
}

/* --- LEARNING MEMORY PANEL --- */
.memory-header-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.memory-card-details h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.memory-card-details p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.profile-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.patterns-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.card-header-accent.green {
    border-bottom-color: rgba(16, 185, 129, 0.1);
}

.card-header-accent.green h3 { color: var(--accent-green); }

.card-header-accent.red {
    border-bottom-color: var(--border-color);
}

.card-header-accent.red h3 { color: var(--primary-red); }

.patterns-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 250px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

.pattern-item {
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-smooth);
}

.pattern-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--border-hover);
}

.pattern-item .angle {
    font-weight: 600;
    color: #ffffff;
    font-size: 13px;
}

.pattern-item .feedback {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-body);
}

.pattern-item.approved {
    border-left: 3px solid var(--accent-green);
}

.pattern-item.rejected {
    border-left: 3px solid var(--primary-red);
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media(max-width: 1200px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-content-split {
        grid-template-columns: 1fr;
    }
    
    .generator-split {
        grid-template-columns: 1fr;
    }
    
    .documents-layout {
        grid-template-columns: 1fr;
    }
    
    .patterns-grid {
        grid-template-columns: 1fr;
    }
}


/* ===========================================================================
   VISUAL REFINEMENT LAYER
   ---------------------------------------------------------------------------
   Appended last so it overrides the base rules above without rewriting them.
   The layout and palette were already sound; what the page lacked was depth,
   typographic contrast, and any sign that surfaces sit at different heights.
   Every selector below matches a class that actually appears in index.html.
   =========================================================================== */

/* --- Page ground ----------------------------------------------------------
   A single flat colour behind everything is the main reason the app reads as
   flat. Two faint, fixed pools of light give the page a direction. */
body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(ellipse 900px 600px at 12% -8%, rgba(239, 68, 68, 0.07), transparent 60%),
        radial-gradient(ellipse 700px 500px at 95% 8%, rgba(120, 60, 200, 0.05), transparent 60%);
    background-attachment: fixed;
}

/* --- Type scale -----------------------------------------------------------
   Almost everything sat at 13-14px, so nothing led the eye. */
.auth-panel-headline {
    font-size: clamp(34px, 4vw, 46px);
    line-height: 1.08;
    letter-spacing: -1.4px;
    /* Stops short of pure red so the tail of the headline reads as emphasis
       rather than as a warning. */
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 58%, #ffb0b0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-panel-sub {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.6);
    max-width: 44ch;
}

.page-title-area h1 {
    font-size: 32px;
    letter-spacing: -0.9px;
}

.page-title-area .subtitle {
    font-size: 14.5px;
    color: var(--text-muted);
}

.card-header h2,
.output-header h2 {
    letter-spacing: -0.3px;
}

/* Labels above fields now read as labels, not as more body copy. */
.input-group label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --- The product shot -----------------------------------------------------
   Slight perspective and a warm underglow, so it reads as a screenshot of
   something real rather than a pasted rectangle. */
.auth-dashboard-preview {
    perspective: 1400px;
}

.auth-dashboard-preview img {
    display: block;
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.75),
        0 0 70px -24px rgba(239, 68, 68, 0.45);
    transform: perspective(1400px) rotateX(5deg) rotateY(-7deg) scale(1.02);
    transform-origin: bottom center;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-dashboard-preview img:hover {
    transform: perspective(1400px) rotateX(1deg) rotateY(-2deg) scale(1.04);
}

/* A second pool of light, offset from the existing ::before, so the left
   panel is lit from two corners instead of washed evenly. */
.auth-panel-left::after {
    content: "";
    position: absolute;
    right: -180px;
    bottom: -160px;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.10) 0%, transparent 70%);
    pointer-events: none;
}

/* --- Surfaces -------------------------------------------------------------
   Cards now sit above the page instead of in it: a stronger edge, a real
   shadow, and a top-edge sheen that suggests a light source above. */
.content-card,
.stat-card,
.feedback-card,
.output-card,
.secondary-card,
.memory-header-card,
.approved-patterns-card,
.rejected-patterns-card {
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 140px);
}

.stat-card,
.format-card {
    transition: var(--transition-smooth);
}

/* Only the interactive surfaces lift. Static cards staying put is what makes
   the lift mean something. */
.stat-card:hover,
.format-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.format-card.active,
.format-card.selected {
    border-color: var(--primary-red);
    background-color: rgba(239, 68, 68, 0.08);
    box-shadow: var(--shadow-glow);
}

.upload-dropzone:hover {
    border-color: var(--border-hover);
    background-color: rgba(239, 68, 68, 0.04);
}

/* --- Chrome --------------------------------------------------------------- */
.sidebar {
    background-image: linear-gradient(180deg, rgba(239, 68, 68, 0.05), transparent 220px);
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.03), 8px 0 24px rgba(0, 0, 0, 0.35);
}

/* The header rule was a hairline across the full width. Fading it out at the
   right stops it cutting the page in half. */
.top-header {
    border-bottom: none;
    background-image: linear-gradient(90deg, var(--border-strong), transparent 85%);
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: bottom left;
    padding-bottom: 24px;
}

/* --- Navigation -----------------------------------------------------------
   The active item used an inset box-shadow, which the hover background then
   competed with. A real marker bar plus a directional wash is unambiguous. */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item.active {
    background-image: linear-gradient(90deg, rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.02));
    box-shadow: none;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 62%;
    border-radius: 0 3px 3px 0;
    background: var(--primary-red);
    box-shadow: 0 0 12px var(--primary-red);
}

.nav-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transform: translateX(2px);
}

/* --- Auth tabs -----------------------------------------------------------
   The underline was a flat 2px border. A gradient bar that sits on the tab
   row's own rule reads as a moving indicator. */
.auth-tab {
    position: relative;
}

.auth-tab.active {
    color: #ffffff;
    border-bottom-color: transparent;
}

.auth-tab.active::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-red-light));
    box-shadow: 0 0 10px var(--primary-red-glow);
}

/* --- Buttons -------------------------------------------------------------
   The base rules already gradient the primary button; these add the missing
   states so a disabled control cannot look pressable. */
.btn-primary {
    border-color: rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* --- Inputs ---------------------------------------------------------------
   Focus was a colour change alone, which is easy to miss and thin for
   keyboard users. */
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.business-id-field input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* --- Feature list ---------------------------------------------------------
   A bare green tick disappeared against the panel; a filled dot reads as a
   checked item at a glance. */
.auth-feature-list li {
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.78);
}

.auth-feature-list li i {
    background-color: rgba(16, 185, 129, 0.14);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
}

/* --- Empty states --------------------------------------------------------
   These are the first thing a judge sees on a fresh account, so they should
   not look like a rendering failure. */
.empty-state {
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: rgba(255, 255, 255, 0.015);
    padding: 36px 24px;
}

/* --- Scrollbars ----------------------------------------------------------
   The default light scrollbar is the loudest thing on a dark page. */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* --- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .auth-dashboard-preview img {
        transform: none;
    }
}

/* --- Narrow screens -------------------------------------------------------
   The split auth screen crushed the form on a laptop in a demo window. Below
   1000px the marketing panel steps aside so the form is what you see. */
@media (max-width: 1000px) {
    .auth-panel-left {
        display: none;
    }
    .auth-panel-right {
        width: 100%;
        padding: 32px 24px;
    }
}

/* --- Destructive actions --------------------------------------------------
   The primary button is already red, so a destructive control cannot lean on
   colour alone to distinguish itself. These read as outlined and quiet until
   hovered, then commit to a solid red — deliberate, not decorative. */
.btn-danger {
    background-color: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--primary-red-hover);
    border-color: var(--primary-red);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

/* The per-row delete button sits beside the status badge, so it stays small
   and colourless until the pointer is on it. */
.doc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.doc-actions .btn-danger {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-muted);
    padding: 6px 8px;
}

.doc-actions .btn-danger:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--primary-red);
    box-shadow: none;
}

/* --- Danger zone ---------------------------------------------------------
   Marked out with a warm left edge so it is visibly not part of the ordinary
   upload flow above it. */
.danger-zone {
    border-color: rgba(239, 68, 68, 0.28) !important;
    border-left: 3px solid var(--primary-red) !important;
    background-image: linear-gradient(180deg, rgba(239, 68, 68, 0.05), transparent 160px) !important;
}

.danger-zone h2 {
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.danger-zone h2 i {
    font-size: 15px;
}

.danger-zone .card-subtitle {
    max-width: 68ch;
}

.danger-zone .input-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.danger-zone .input-group {
    min-width: 240px;
}

/* A neutral companion to .badge-accent, which was the only variant defined —
   bare .badge sets typography but no colour, so it rendered as plain text.
   The document Role column needs a badge that does not shout. */
.badge-neutral {
    background-color: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}


/* Research panel: what the copy was grounded in, brand documents and, when
   web search is on, the Parallel results. */
.research-box {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: rgba(255, 255, 255, 0.01);
    margin-top: 10px;
    overflow: hidden;
}

.research-section {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.research-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.research-tag {
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

.research-tag-parallel {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--primary-red);
}

.research-body {
    padding: 12px 20px 20px;
    max-height: 260px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: #cbd5e1;
}

.research-badge {
    font-size: 11px;
    color: var(--text-secondary);
}


/* Research source selector */
.research-mode-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.research-mode-option {
    flex: 1;
    cursor: pointer;
}

.research-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.research-mode-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    height: 100%;
    white-space: nowrap;
    font-size: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.research-mode-option:hover span {
    color: #e5e7eb;
}

.research-mode-option input:checked + span {
    border-color: var(--primary-red);
    color: #fff;
    background-color: rgba(239, 68, 68, 0.08);
}

.research-mode-option input:focus-visible + span {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}


/* Field label + hint, used by the research source and document kind pickers.
   Both were referenced by markup before they existed here, so the labels
   rendered as unstyled body text. */
.field-label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.field-hint {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
}


/* Brand Brain body: a document, shown as one. */
.brain-body {
    margin-top: 12px;
    padding: 20px;
    background-color: #050507;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-md);
    max-height: 70vh;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: #cbd5e1;
}

/* YouTube Studio (static/youtube.js) */
.yt-notice {
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-red);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-input);
    color: var(--text-secondary);
    font-size: 13px;
}
.yt-tab .content-card + .content-card { margin-top: 20px; }
.yt-form-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.yt-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.yt-detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.yt-detail-head h2 { margin: 0 0 4px; }
.yt-section-title { margin: 24px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.yt-shot-text { white-space: pre-wrap; min-width: 220px; }
.yt-muted { color: var(--text-muted); font-size: 12px; }
.yt-warning { color: #fbbf24; font-size: 13px; margin-top: 8px; }
.yt-error { color: var(--accent-red-light); font-size: 13px; margin-top: 8px; white-space: pre-wrap; }
.yt-track { margin-top: 12px; width: 100%; }
.badge-human { background-color: var(--accent-green-glow); color: var(--accent-green); border: 1px solid var(--border-color); }
.badge-enforcer { background-color: rgba(251, 191, 36, 0.12); color: #fbbf24; border: 1px solid var(--border-color); }
.data-table select { background-color: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; max-width: 220px; }
@media (max-width: 900px) { .yt-form-row { grid-template-columns: 1fr; } }

.yt-speaker-link { color: var(--text-primary, #fff); text-decoration: underline dotted; text-underline-offset: 3px; }
.yt-speaker-link:hover { color: var(--primary-red); }
#yt-preview-hint a { color: var(--primary-red); text-decoration: underline; }

/* YouTube Studio: storyboard, faces, styles (static/youtube.js) */
.yt-style-row { display: grid; grid-template-columns: 1fr 2.5fr; gap: 12px; }
.yt-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.yt-thumb { position: relative; width: 96px; height: 96px; border-radius: var(--border-radius-sm); overflow: hidden; background: var(--bg-input); border: 1px solid var(--border-color); }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-thumb button { position: absolute; top: 4px; right: 4px; padding: 2px 6px; }
.yt-sheet { margin-top: 10px; max-width: 640px; border-radius: var(--border-radius-sm); overflow: hidden; border: 1px solid var(--border-color); background: var(--bg-input); }
.yt-sheet img { width: 100%; display: block; }
.yt-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-secondary); margin: 8px 0 4px; }
.yt-check input { margin-top: 3px; }
.yt-storyboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.yt-storyboard.short { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.yt-frame { border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); background: var(--bg-input); overflow: hidden; display: flex; flex-direction: column; }
.yt-frame-image { aspect-ratio: 16 / 9; background: rgba(255, 255, 255, 0.03); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; text-align: center; padding: 0; }
.yt-storyboard.short .yt-frame-image { aspect-ratio: 9 / 16; }
.yt-frame-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-frame-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.yt-frame-body textarea { width: 100%; min-height: 64px; resize: vertical; background: var(--bg-main, #0d0d12); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 6px 8px; font: inherit; font-size: 12px; }
.yt-frame-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.yt-style-item { border-top: 1px solid var(--border-color); padding: 14px 0; display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: start; }
.yt-style-item:first-child { border-top: none; }
.yt-style-item textarea { width: 100%; min-height: 48px; background: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 6px 8px; font: inherit; font-size: 13px; }
.badge-approved { background-color: var(--accent-green-glow); color: var(--accent-green); border: 1px solid var(--border-color); }
@media (max-width: 900px) { .yt-style-row, .yt-style-item { grid-template-columns: 1fr; } }

#panel-youtube select { background-color: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; max-width: 220px; font: inherit; font-size: 12px; }
#panel-youtube select option { background-color: var(--bg-input); color: var(--text-primary); }

/* YouTube Studio: rendered video */
.yt-video { position: relative; max-width: 720px; margin: 0 0 14px; border-radius: var(--border-radius-sm); overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.yt-video.short { max-width: 300px; aspect-ratio: 9 / 16; }
.yt-video video, .yt-video img { width: 100%; height: 100%; object-fit: contain; display: block; }
.yt-video-poster { all: unset; cursor: pointer; display: block; width: 100%; height: 100%; position: relative; }
.yt-video-poster:focus-visible { outline: 2px solid var(--primary-red); outline-offset: -2px; }
.yt-video-play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.yt-video-poster:hover .yt-video-play { background: rgba(0, 0, 0, 0.8); }

/* YouTube Studio: publishing */
.yt-metadata { display: grid; gap: 10px; margin: 8px 0 14px; max-width: 900px; }
.yt-metadata textarea { width: 100%; resize: vertical; }
.yt-kids { border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 8px 12px; display: flex; gap: 18px; flex-wrap: wrap; }
.yt-kids legend { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.yt-kids label, .yt-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.yt-upload-box { border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 12px 14px; margin-bottom: 14px; max-width: 900px; display: grid; gap: 10px; }
.yt-problems { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 13px; }
.yt-schedule { background: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; color-scheme: dark; }
.yt-steps { padding-left: 20px; display: grid; gap: 8px; }
.yt-steps code, #yt-channel-card code { word-break: break-all; }
#panel-youtube a:not(.btn) { color: var(--accent-red-light); text-decoration: none; }
#panel-youtube a:not(.btn):hover { text-decoration: underline; }

/* Legal links under the sign-in form */
.auth-legal { margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); text-align: center; }
.auth-legal a { color: var(--accent-red-light); text-decoration: none; }
.auth-legal a:hover { text-decoration: underline; }

/* YouTube Studio: products and end card */
.yt-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.yt-asset { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 8px; }
.yt-asset .yt-thumb img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 4px; }
.yt-products { flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 6px 0; }
.yt-end-card { border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 10px 14px; margin: 8px 0 14px; max-width: 900px; }
.yt-end-card summary { cursor: pointer; }
.yt-end-card-body { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; }
.yt-end-card-body .yt-metadata { flex: 1 1 380px; margin: 0; }
.yt-card-preview { width: 320px; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.yt-card-preview.short { width: 180px; aspect-ratio: 9 / 16; }
.yt-card-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* YouTube Studio: import a script */
.yt-import summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.yt-import form { margin-top: 12px; display: grid; gap: 10px; max-width: 900px; }
.yt-import textarea { width: 100%; resize: vertical; font-family: 'Fira Code', monospace; font-size: 13px; }
/* Make a video from approved content */
.yt-make-video { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 14px 0; padding: 14px 16px; border: 1px solid var(--border-color); border-left: 3px solid var(--primary-red); border-radius: var(--border-radius-sm); background: var(--bg-input); }
.yt-make-video select { background: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; }
/* Sound */
.yt-music-icon { display: flex; width: 72px; height: 72px; align-items: center; justify-content: center; font-size: 26px; background: var(--bg-input); border-radius: 4px; color: var(--accent-red-light); }
.yt-sound { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 4px 0; }
.yt-sound input { flex: 1; background: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; font-size: 12px; }
/* Series */
.yt-series { margin: 6px 0 4px; gap: 8px; }
.yt-series select { background: var(--bg-input); color: inherit; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 4px 6px; }
