/* Modern SaaS Theme - Deadlock */
/* Using a local/system font stack to avoid external font imports */

:root {
    /* Neutrals (dark) */
    --bg-0: #0b0b10;        /* page background */
    --bg-1: #0f1017;        /* app shell */
    --bg-2: #151624;        /* surfaces (sidebar/chat cards) */
    --bg-3: #1c1d2e;        /* elevated surfaces (menus/modals) */

    /* Text - WCAG AA compliant colors */
    --text-0: #f3f4ff;      /* primary - high contrast */
    --text-1: #d1d1e8;      /* secondary - improved contrast */
    --text-2: #a5a5c0;      /* muted - improved contrast */
    --text-3: #7a7a92;      /* subtle - improved contrast */

    /* Borders */
    --border-0: rgba(255, 255, 255, 0.10);
    --border-1: rgba(255, 255, 255, 0.06);

    /* Violet accent (ONLY accent family) */
    --violet-0: #7c3aed;    /* primary */
    --violet-1: #6d28d9;    /* hover/active */
    --violet-2: #a78bfa;    /* lighter accent for secondary uses */
    --violet-soft: rgba(124, 58, 237, 0.14);
    --focus-ring: rgba(124, 58, 237, 0.35);

    /* Semantic (avoid "success green"; use blue/purple-friendly semantics) */
    --info: #60a5fa;        /* informational / links */
    --warn: #f59e0b;        /* warning */
    --danger: #ef4444;      /* error/critical */

    /* Legacy mappings for compatibility */
    --bg-primary: var(--bg-0);
    --bg-secondary: var(--bg-2);
    --bg-tertiary: var(--bg-2);
    --bg-elevated: var(--bg-3);
    --text-primary: var(--text-0);
    --text-secondary: var(--text-1);
    --text-muted: var(--text-2);
    --accent-primary: var(--violet-0);
    --accent-secondary: var(--violet-1);
    --accent-hover: var(--violet-1);
    --accent-glow: var(--focus-ring);
    --border-color: var(--border-0);
    --border-subtle: var(--border-1);
    --agent-1-color: var(--violet-0);
    --agent-2-color: var(--violet-2);
    --warning-color: var(--warn);
    --error-color: var(--danger);
    --page-gradient: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.10), transparent 30%), radial-gradient(circle at 80% 0%, rgba(167, 139, 250, 0.08), transparent 25%), var(--bg-0);
    --panel-gradient: linear-gradient(180deg, rgba(15, 16, 23, 0.95) 0%, rgba(11, 11, 16, 0.98) 100%);
    
    /* Shadows (subtle, no glow) */
    --shadow-1: 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.45);
    --shadow-2: 0 1px 0 rgba(255,255,255,0.06), 0 16px 48px rgba(0,0,0,0.55);

    /* Radii */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;

    /* Spacing scale (8px grid) */
    --s-1: 8px;
    --s-2: 12px;
    --s-3: 16px;
    --s-4: 24px;
    --s-5: 32px;

    /* Legacy mappings for compatibility */
    --radius-sm: var(--r-sm);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
    --shadow-sm: var(--shadow-1);
    --shadow-md: var(--shadow-1);
    --shadow-lg: var(--shadow-2);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    /* Typography */
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
    
    /* Icons (SVG data URIs for easy maintenance) */
    --icon-chevron-down: url('data:image/svg+xml;utf8,<svg fill="%23666666" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
}

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

html, body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--page-gradient);
}

/* App Layout - Hybrid Dashboard + Chat */
.app-layout {
    display: flex;
    height: calc(100vh - 72px); /* Full height minus header */
    position: relative;
    overflow: hidden;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 16, 23, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: var(--s-3) var(--s-4);
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--s-1);
    margin: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-2);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--violet-0) 0%, var(--violet-2) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.brand-logo img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.account-badge.free {
    color: var(--text-secondary);
}

.account-badge.director {
    color: var(--violet-0);
    background: var(--violet-soft);
}

.account-badge .badge-icon {
    width: 14px;
    height: 14px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}

.status-dot.active {
    background: var(--violet-0);
}

.status-dot.critical {
    background: var(--warning-color);
}

.status-dot.depleted {
    background: var(--error-color);
}

/* Sidebar (Dashboard Panel) */
.sidebar {
    width: clamp(260px, 320px, 480px);
    background: var(--bg-1);
    border-right: 1px solid var(--border-0);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: relative;
}

/* Sidebar Resize Handle (desktop only) */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--violet-0);
    border-radius: 1px;
}

.sidebar:hover .sidebar-resize-handle {
    opacity: 1;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
    opacity: 1;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.resizing::after {
    background: var(--violet-2);
    width: 3px;
}

/* Sidebar collapse toggle */
.sidebar-collapse-btn {
    position: absolute;
    top: var(--s-3);
    right: var(--s-3);
    width: 32px;
    height: 32px;
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-2);
    transition: all var(--transition-fast);
    z-index: 5;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-3);
    color: var(--text-0);
    border-color: var(--violet-0);
}

.sidebar-collapse-btn svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-inner {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

.sidebar-inner {
    padding: var(--s-4);
    padding-bottom: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--s-3) var(--s-4);
    border-top: 1px solid var(--border-1);
    margin-top: var(--s-4);
    background: var(--bg-0);
}

.sidebar-footer-version {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-bottom: var(--s-2);
    font-weight: 600;
}

.sidebar-footer-links {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

.footer-link {
    font-size: 0.75rem;
    color: var(--text-2);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--violet-2);
}

.footer-divider {
    color: var(--text-3);
    font-size: 0.75rem;
}

.sidebar-section {
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--border-1);
}

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

.sidebar-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-0);
    margin-bottom: var(--s-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fuel-info {
    background: var(--bg-2);
    border-radius: var(--r-md);
    padding: var(--s-3);
    border: 1px solid var(--border-1);
}

.fuel-status-card {
    margin-top: var(--s-2);
}

.fuel-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-2);
}

.fuel-percent {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-0);
}

.fuel-help-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-2);
    margin: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 10;
        transform: translateX(-100%);
        box-shadow: var(--shadow-2);
        width: 320px !important; /* Fixed width on mobile */
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }

    /* Hide resize handle and collapse button on mobile */
    .sidebar-resize-handle,
    .sidebar-collapse-btn {
        display: none;
    }
}

/* Main Chat Area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-0);
}

/* Accessibility - Visible Focus Rings */
*:focus-visible {
    outline: 2px solid var(--violet-0);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--violet-0);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--violet-0);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Reduce Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Fuel Bar */
.fuel-container {
    flex: 1;
    max-width: 200px;
    min-width: 120px;
}

@media (max-width: 900px) {
    .fuel-container {
        display: none;
    }
}

.fuel-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.fuel-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--violet-0) 0%, var(--violet-2) 100%);
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s ease;
}

.fuel-fill.warning {
    background: linear-gradient(90deg, var(--warning-color) 0%, #fbbf24 100%);
}

.fuel-fill.critical {
    background: linear-gradient(90deg, var(--error-color) 0%, #f87171 100%);
}

.fuel-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.fuel-state-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fuel-state-pill::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.fuel-state-pill.warning {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.12);
}

.fuel-state-pill.warning::before {
    background: var(--warning-color);
}

.fuel-state-pill.critical {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.12);
}

.fuel-state-pill.critical::before {
    background: var(--error-color);
    animation: pulse 2s ease-in-out infinite;
}

.fuel-state-pill.depleted {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.2);
}

.fuel-state-pill.depleted::before {
    background: var(--error-color);
}

.fuel-state-pill.healthy {
    color: var(--accent-primary);
    background: rgba(91, 141, 239, 0.12);
}

.fuel-state-pill.healthy::before {
    background: var(--accent-primary);
}

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

.fuel-action {
    color: var(--accent-primary);
    font-weight: 600;
}

.fuel-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Conversation Window */
.conversation-window {
    flex: 1;
    padding: var(--s-4);
    padding-bottom: var(--s-5);
    overflow-y: auto;
    overflow-x: hidden;
}

.conversation-inner {
    max-width: 1000px;
    margin: 0 auto;
}

/* Custom Scrollbars - Applied to all scroll containers */
.conversation-window::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.sidebar-inner::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.conversation-window::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.sidebar-inner::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-window::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.sidebar-inner::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.conversation-window::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-inner::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    background-clip: padding-box;
}

/* Firefox scrollbar styling */
.conversation-window,
.sidebar,
.sidebar-inner {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Messages */
.message {
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    animation: slideIn 0.3s ease;
    border: 1px solid var(--border-subtle);
}

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

.message.agent-1 {
    background: var(--bg-secondary);
    border-left: 3px solid var(--agent-1-color);
}

.message.agent-2 {
    background: var(--bg-secondary);
    border-left: 3px solid var(--agent-2-color);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.agent-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.message.agent-1 .agent-avatar {
    background: var(--agent-1-color);
}

.message.agent-2 .agent-avatar {
    background: var(--agent-2-color);
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.agent-model {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.message-content {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* System Messages */
.system-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 16px 20px;
    margin: 20px 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.system-message.warning {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.system-message.error {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Button Groups */
.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: var(--icon-chevron-down);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.input-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Director Panel */
.director-panel {
    /* No extra border/spacing since it's in sidebar-section */
}

.director-panel.locked {
    opacity: 0.85;
}

.director-panel-header {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    margin-bottom: var(--s-3);
}

.lock-pill {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-2);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.lock-copy {
    font-size: 0.88rem;
    color: var(--text-2);
    margin-bottom: var(--s-3);
    line-height: 1.5;
}

.director-panel input:disabled,
.director-panel select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.director-panel-header svg {
    width: 16px;
    height: 16px;
    fill: var(--violet-0);
}

.director-panel-header span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--violet-0);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-upgrade {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-1);
    background: var(--violet-soft);
    border: 1px solid var(--violet-0);
    color: var(--violet-0);
    padding: var(--s-2) var(--s-3);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: var(--s-3);
}

.btn-upgrade svg {
    width: 16px;
    height: 16px;
}

.btn-upgrade:hover {
    background: var(--violet-0);
    color: white;
}

/* Topic Summary (Active Debate) */
.topic-summary {
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-left: 3px solid var(--violet-0);
    padding: var(--s-3);
    border-radius: var(--r-md);
}

.topic-summary h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-0);
    margin-bottom: var(--s-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#topicSummaryContent {
    font-size: 0.9rem;
    color: var(--text-1);
    line-height: 1.6;
    margin-bottom: var(--s-3);
}

.debate-controls {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-top: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--border-1);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent-primary);
    border: none;
    color: white;
    padding: 12px 24px;
    min-height: 44px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn.small {
    padding: 10px 16px;
    min-height: 44px;
    font-size: 0.85rem;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn:disabled,
.btn.disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn.secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
}

.btn.secondary:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.btn.ghost {
    background: transparent;
    color: var(--accent-primary);
    border: 1px dashed var(--border-color);
}

.btn.ghost:hover {
    background: var(--violet-soft);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-group input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group label {
    cursor: pointer;
    user-select: none;
}

/* Loading Animation */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-left: 3px solid var(--violet-0);
    color: var(--text-0);
    padding: 16px 24px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    animation: slideInUp 0.3s ease, slideOutDown 0.3s ease 2.7s;
    pointer-events: none;
}

.toast.success {
    border-left-color: #10b981;
}

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

.toast-icon {
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

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

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

/* Presets & Recent Topics */
.section-header-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-3);
}

.section-header-with-action h3 {
    margin-bottom: 0;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-3);
    border: 1px solid var(--border-0);
    color: var(--text-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--violet-soft);
    color: var(--violet-0);
    border-color: var(--violet-0);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.preset-form {
    background: var(--bg-3);
    padding: var(--s-3);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    border: 1px solid var(--border-0);
}

.preset-form .btn-group {
    margin-top: var(--s-2);
}

.preset-list,
.recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.preset-item,
.recent-item {
    background: var(--bg-3);
    border: 1px solid var(--border-0);
    border-radius: var(--r-md);
    padding: var(--s-2) var(--s-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.preset-item:hover,
.recent-item:hover {
    background: var(--bg-elevated);
    border-color: var(--violet-0);
}

.preset-item-info,
.recent-item-info {
    flex: 1;
    min-width: 0;
}

.preset-item-name,
.recent-item-topic {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-0);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-item-details,
.recent-item-date {
    font-size: 0.7rem;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-item-actions,
.recent-item-actions {
    display: flex;
    gap: 4px;
}

.btn-icon-small {
    width: 36px;
    height: 36px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: 4px;
}

.btn-icon-small:hover {
    background: var(--bg-2);
    color: var(--text-0);
}

.btn-icon-small.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-icon-small svg {
    width: 14px;
    height: 14px;
}

.empty-state {
    text-align: center;
    padding: var(--s-3) var(--s-2);
    color: var(--text-3);
    font-size: 0.85rem;
    font-style: italic;
}

/* Tooltips & Help */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-3);
    color: var(--text-3);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
}

.help-icon:hover {
    background: var(--violet-soft);
    color: var(--violet-2);
}

.help-icon svg {
    width: 12px;
    height: 12px;
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--bg-3);
    color: var(--text-0);
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border-0);
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 4px solid transparent;
    border-top-color: var(--bg-3);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

/* Inline help text */
.help-text {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-top: 4px;
    line-height: 1.4;
}

/* Collapsible help section */
.collapsible-help {
    margin-top: var(--s-2);
}

.collapsible-help-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 0.75rem;
    padding: 4px 0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.collapsible-help-trigger:hover {
    color: var(--violet-2);
}

.collapsible-help-trigger svg {
    width: 14px;
    height: 14px;
    transition: transform var(--transition-fast);
}

.collapsible-help-trigger.expanded svg {
    transform: rotate(90deg);
}

.collapsible-help-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-help-content.expanded {
    max-height: 500px;
    margin-top: var(--s-2);
}

.collapsible-help-content p {
    font-size: 0.8rem;
    color: var(--text-2);
    line-height: 1.5;
    margin: 0;
    padding: var(--s-2);
    background: var(--bg-3);
    border-radius: var(--r-sm);
    border-left: 2px solid var(--violet-0);
}

/* Welcome State & Centered Composer */
.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.welcome-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.welcome-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-state p {
    font-size: 0.95rem;
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: var(--s-4);
}

.todays-prompt {
    background: var(--violet-soft);
    border: 1px solid var(--violet-0);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    max-width: 500px;
    text-align: left;
}

.todays-prompt-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--violet-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--s-1);
}

.todays-prompt-text {
    font-size: 0.9rem;
    color: var(--text-0);
    font-weight: 500;
    line-height: 1.5;
}

/* Centered Debate Composer */
.centered-composer {
    width: 100%;
    max-width: 600px;
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    box-shadow: var(--shadow-1);
}

.composer-input-group {
    margin-bottom: var(--s-3);
}

.composer-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-1);
    margin-bottom: var(--s-2);
}

.composer-topic-input {
    width: 100%;
    background: var(--bg-0);
    border: 2px solid var(--border-0);
    border-radius: var(--r-md);
    color: var(--text-0);
    padding: 14px 18px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-fast);
}

.composer-topic-input::placeholder {
    color: var(--text-3);
}

.composer-topic-input:focus {
    border-color: var(--violet-0);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.composer-actions {
    display: flex;
    gap: var(--s-2);
    margin-bottom: var(--s-4);
}

.composer-actions .btn {
    flex: 1;
}

.composer-actions .btn-surprise {
    background: var(--bg-3);
    color: var(--text-1);
    border: 1px solid var(--border-0);
    flex: 0 0 auto;
    padding: 12px 20px;
}

.composer-actions .btn-surprise:hover {
    background: var(--violet-soft);
    color: var(--violet-0);
    border-color: var(--violet-0);
}

.composer-divider {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin: var(--s-4) 0;
    color: var(--text-3);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: center;
}

.topic-chip {
    background: var(--bg-3);
    border: 1px solid var(--border-0);
    color: var(--text-1);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.topic-chip:hover {
    background: var(--violet-soft);
    color: var(--violet-2);
    border-color: var(--violet-0);
    transform: translateY(-2px);
}

.topic-chip:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 640px) {
    .header {
        padding: var(--s-2) var(--s-3);
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .account-badge {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    
    .account-badge span {
        display: none;
    }

    .conversation-window {
        padding: var(--s-3);
    }

    .sidebar-inner {
        padding: var(--s-3);
    }

    .message {
        padding: var(--s-3);
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
}
