/* ═══════════════════════════════════════════════════════════════════════════════
   Atlora — Global dark-theme stylesheet
   Design tokens, animations, component styles, and utility classes.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ───────────────────────────────────────────────────────────── */
:root {
    /* Background layers — warm dark (mirrors html[data-theme="dark"]) */
    --bg-base:        #1A1715;
    --bg-surface:     #1E1C1A;
    --bg-elevated:    #242220;
    --bg-card:        #2A2825;
    --bg-input:       #1E1C1A;

    /* Border shades */
    --border-faint:   #2E2C29;
    --border-subtle:  #3A3835;
    --border-default: #4A4845;
    --border-muted:   #625F5A;

    /* Text */
    --text-primary:   #F5F0E8;
    --text-secondary: #E8E3D8;
    --text-tertiary:  #D8D3C8;
    --text-muted:     #B8B4AC;
    --text-faint:     #968F87;
    --text-ghost:     #726E67;

    /* Accent — Claude warm orange */
    --accent:         #D97757;
    --accent-dim:     #D9775740;
    --accent-glow:    #D9775718;

    /* Status */
    --status-ready:      #5FA876;
    --status-processing: #D4965A;
    --status-pending:    #968F87;
    --status-failed:     #E06050;
    --status-replaced:   #9B7FD4;

    /* Success */
    --success-bg:     #0D1F14;
    --success-border: #1E4D30;
    --success-text:   #6FD99A;

    /* Danger */
    --danger:         #E06050;
    --danger-bg:      #2A1A18;
    --danger-border:  #6A3028;
    --danger-text:    #F0A898;

    /* UI chrome — dark mode defaults */
    --ui-border-color: #4A4845;
    --ui-input-bg:     #1E1C1A;

    /* User avatar */
    --avatar-bg:       #2E2C29;
    --avatar-border:   #4A4845;
    --avatar-text:     #B8B4AC;

    /* Typography */
    --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    /* Radii */
    --radius-sm:  4px;
    --radius-md:  6px;
    --radius-lg:  8px;
    --radius-xl:  10px;

    /* Transitions */
    --transition-fast: 0.12s ease;
    --transition-base: 0.18s ease;
    --transition-slow: 0.28s ease;
}

/* ── Dark theme — warm dark browns (Claude-inspired) ─────────────────────────── */
html[data-theme="dark"] {
    /* Background layers */
    --bg-base:        #1A1715;
    --bg-surface:     #1E1C1A;
    --bg-elevated:    #242220;
    --bg-card:        #2A2825;
    --bg-input:       #1E1C1A;

    /* Border shades */
    --border-faint:   #2E2C29;
    --border-subtle:  #3A3835;
    --border-default: #4A4845;
    --border-muted:   #625F5A;

    /* Text */
    --text-primary:   #F5F0E8;
    --text-secondary: #E8E3D8;
    --text-tertiary:  #D8D3C8;
    --text-muted:     #B8B4AC;
    --text-faint:     #968F87;
    --text-ghost:     #726E67;

    /* Accent — Claude warm orange */
    --accent:         #D97757;
    --accent-dim:     #D9775740;
    --accent-glow:    #D9775718;

    /* Status */
    --status-ready:      #5FA876;
    --status-processing: #D4965A;
    --status-pending:    #968F87;
    --status-failed:     #E06050;
    --status-replaced:   #9B7FD4;

    /* Success */
    --success-bg:     #0D1F14;
    --success-border: #1E4D30;
    --success-text:   #6FD99A;

    /* Danger */
    --danger:         #E06050;
    --danger-bg:      #2A1A18;
    --danger-border:  #6A3028;
    --danger-text:    #F0A898;

    /* UI chrome */
    --ui-border-color: #4A4845;
    --ui-input-bg:     #1E1C1A;

    /* User avatar */
    --avatar-bg:       #2E2C29;
    --avatar-border:   #4A4845;
    --avatar-text:     #B8B4AC;
}

/* ── Light theme — warm cream (Claude-inspired) ──────────────────────────────── */
html[data-theme="light"] {
    /* Background layers */
    --bg-base:        #FAF9F5;
    --bg-surface:     #ffffff;
    --bg-elevated:    #ECEBE2;
    --bg-card:        #ffffff;
    --bg-input:       #FAF9F5;

    /* Border shades */
    --border-faint:   #E8E6DC;
    --border-subtle:  #DDDAD0;
    --border-default: #C8C5BB;
    --border-muted:   #A09D93;

    /* Text */
    --text-primary:   #1A1815;
    --text-secondary: #2D2B26;
    --text-tertiary:  #35322C;
    --text-muted:     #4E4B44;
    --text-faint:     #635F58;
    --text-ghost:     #7A7770;

    /* Accent — Claude warm orange */
    --accent:         #D97757;
    --accent-dim:     #D9775740;
    --accent-glow:    #D9775714;

    /* Status */
    --status-ready:      #4A7C59;
    --status-processing: #C17D3C;
    --status-pending:    #635F58;
    --status-failed:     #C44E3C;
    --status-replaced:   #7C5CBF;

    /* Success */
    --success-bg:     #eaf7ee;
    --success-border: #9ED8B4;
    --success-text:   #2A6B44;

    /* Danger */
    --danger:         #C44E3C;
    --danger-bg:      #FDF4F2;
    --danger-border:  #EDB5AD;
    --danger-text:    #C44E3C;

    /* UI chrome */
    --ui-border-color: #C8C5BB;
    --ui-input-bg:     #ffffff;

    /* User avatar */
    --avatar-bg:       #E8E6DC;
    --avatar-border:   #C8C5BB;
    --avatar-text:     #4A4740;
}

/* Light — scrollbar */
html[data-theme="light"] {
    scrollbar-color: var(--border-default) var(--bg-surface);
}
html[data-theme="light"]::-webkit-scrollbar-track    { background: var(--bg-surface); }
html[data-theme="light"]::-webkit-scrollbar-thumb    { background: var(--border-default); }
html[data-theme="light"]::-webkit-scrollbar-thumb:hover { background: var(--border-muted); }

/* Light — status badges */
html[data-theme="light"] .badge-ready      { background: #e6f7f0; color: var(--status-ready);      border-color: #a3d9c4; }
html[data-theme="light"] .badge-processing { background: #fff8e6; color: var(--status-processing);  border-color: #fcd88a; }
html[data-theme="light"] .badge-pending    { background: #f0f1f5; color: var(--status-pending);     border-color: #c3c6d4; }
html[data-theme="light"] .badge-failed     { background: #fff0f2; color: var(--status-failed);      border-color: #f5a0ac; }
html[data-theme="light"] .badge-replaced   { background: #f3f0ff; color: var(--status-replaced);    border-color: #c4b5fd; }

/* Light — skeleton */
html[data-theme="light"] .skeleton {
    background: linear-gradient(90deg, #e8eaf0 25%, #f0f2f7 50%, #e8eaf0 75%);
    background-size: 200% 100%;
}
html[data-theme="light"] .skeleton-row { border-bottom: 1px solid var(--border-faint); }

/* Light — chat bubbles */
html[data-theme="light"] .bubble-user {
    background: #ebedf5;
    border-color: var(--border-default);
    color: var(--text-secondary);
}
html[data-theme="light"] .bubble-asst {
    background: #ffffff;
    border-color: var(--border-subtle);
    color: var(--text-tertiary);
}
html[data-theme="light"] .chat-avatar-asst {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}
html[data-theme="light"] .chat-avatar-user {
    background: #ebedf5;
    border-color: var(--border-default);
}

/* Light — toasts */
html[data-theme="light"] .toast-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
html[data-theme="light"] .toast-error   { background: #fff0f2; border-color: #f5a0ac; color: #d83a52; }
html[data-theme="light"] .toast-info    { background: var(--accent-glow); border-color: var(--accent-dim); color: var(--accent); }

/* Light — alerts */
html[data-theme="light"] .alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
html[data-theme="light"] .alert-error   { background: #fff0f2; border-color: #f5a0ac; color: #d83a52; }
html[data-theme="light"] .alert-warn    { background: var(--accent-glow); border-color: var(--accent-dim); color: var(--accent); }

/* Light — modals */
html[data-theme="light"] .modal-backdrop { background: rgba(50,51,56,0.55); }
html[data-theme="light"] .modal-panel    { box-shadow: 0 20px 60px rgba(0,0,0,0.18); }

/* Light — Uppy overrides */
html[data-theme="light"] .uppy-Dashboard-inner             { background: var(--bg-surface) !important; }
html[data-theme="light"] .uppy-Dashboard-AddFiles          { border-color: var(--border-default) !important; background: var(--bg-surface) !important; }
html[data-theme="light"] .uppy-Dashboard-AddFiles-title,
html[data-theme="light"] .uppy-Dashboard-note              { color: var(--text-faint) !important; }
html[data-theme="light"] .uppy-Dashboard-browse            { color: var(--accent) !important; }
html[data-theme="light"] .uppy-DashboardContent-bar        { background: var(--bg-surface) !important; border-bottom: 1px solid var(--border-default) !important; }
html[data-theme="light"] .uppy-DashboardContent-title      { color: var(--text-secondary) !important; }
html[data-theme="light"] .uppy-DashboardTab-btn            { color: var(--text-muted) !important; }
html[data-theme="light"] .uppy-DashboardTab-btn:hover      { color: var(--text-primary) !important; background: var(--bg-elevated) !important; }
html[data-theme="light"] .uppy-Dashboard-Item              { background: var(--bg-elevated) !important; border: 1px solid var(--border-default) !important; }
html[data-theme="light"] .uppy-Dashboard-Item-name         { color: var(--text-secondary) !important; }
html[data-theme="light"] .uppy-Dashboard-Item-statusSize   { color: var(--text-faint) !important; }
html[data-theme="light"] .uppy-StatusBar                                          { background: var(--bg-surface) !important; border-top: none !important; }
html[data-theme="light"] .uppy-StatusBar.is-uploading,
html[data-theme="light"] .uppy-StatusBar.is-complete                              { border-top: 1px solid var(--border-default) !important; }
html[data-theme="light"] .uppy-StatusBar-status            { color: var(--text-muted) !important; }
html[data-theme="light"] .uppy-StatusBar-actions .uppy-StatusBar-actionBtn--upload { background: var(--text-primary) !important; color: #ffffff !important; }
html[data-theme="light"] .uppy-ProgressBar-container       { background: var(--border-default) !important; }
html[data-theme="light"] .uppy-ProgressBar-inner           { background: var(--accent) !important; }

/* ── Reset & base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg-base);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Heading scale ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
h5 { font-size: 14px; font-weight: 600; letter-spacing: 0; }
h6 { font-size: 13px; font-weight: 600; letter-spacing: 0; }

/* ── Code & pre ────────────────────────────────────────────────────────────── */
code, kbd, samp {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    color: var(--text-secondary);
}
pre {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    overflow-x: auto;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre;
}
pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* ── Scrollbars ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 4px; height: 4px; }
::-webkit-scrollbar-track    { background: var(--bg-surface); }
::-webkit-scrollbar-thumb    { background: var(--border-default); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-default) var(--bg-surface); }

/* ── Focus ring ───────────────────────────────────────────────────────────────── */
textarea:focus,
input:focus,
select:focus,
button:focus-visible {
    outline: none;
    border-color: var(--border-muted) !important;
    box-shadow: 0 0 0 1px var(--border-muted);
}
button:focus:not(:focus-visible) { outline: none; }

/* ── Links ────────────────────────────────────────────────────────────────────── */
a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════════════════════
   KEYFRAME ANIMATIONS
   ══════════════════════════════════════════════════════════════════════════════ */

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

/* Heartbeat / status pulse */
@keyframes pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.6; }
}

/* Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade in */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Slide + fade up (page sections, messages) */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Slide down (modals, notifications) */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Skeleton shimmer */
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

/* Progress bar fill */
@keyframes growWidth {
    from { width: 0; }
}

/* Accent glow pulse (logo / badge) */
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    50%       { box-shadow: 0 0 10px 3px rgba(16, 185, 129, 0.15); }
}

/* Toast slide in from right */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════════════════════════════════════ */

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    color: var(--text-faint);
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
    text-decoration: none;
}
.nav-link:hover {
    color: var(--text-tertiary);
    border-color: var(--border-default);
    background: var(--bg-card);
}
.nav-link.active {
    background: var(--bg-card);
    border-color: var(--border-default);
    color: var(--text-primary);
}

/* Brand logo */
.nav-brand {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
    color: var(--accent);
    transition: opacity var(--transition-fast);
}
.nav-brand:hover { opacity: 0.85; }

/* ═══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */

button {
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primary — light fill */
.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: -0.01em;
    transition: opacity var(--transition-fast);
    cursor: pointer;
}
.btn-primary:hover:not(:disabled) { opacity: 0.85; }

/* Ghost / outline */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-muted);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-sans);
}
.btn-ghost:hover:not(:disabled) {
    border-color: var(--text-faint);
    color: var(--text-tertiary);
}

/* Danger */
.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-sans);
}
.btn-danger:hover:not(:disabled) { border-color: #991B1B; }

/* Icon-only square */
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-faint);
    font-size: 14px;
    flex-shrink: 0;
}
.btn-icon:hover:not(:disabled) {
    border-color: var(--border-muted);
    color: var(--text-tertiary);
}

/* Send button (chat) */
.btn-send {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: var(--text-primary);
    color: var(--bg-surface);
    border: none;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}
.btn-send:disabled  { opacity: 0.4; cursor: not-allowed; }
.btn-send:not(:disabled):hover { opacity: 0.88; }

/* ═══════════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════════════════════════════════════ */

.input, .textarea {
    display: block;
    width: 100%;
    background: var(--ui-input-bg);
    border: 1px solid var(--ui-border-color);
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
.input:focus, .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.input::placeholder, .textarea::placeholder {
    color: var(--text-ghost);
}

.textarea { resize: vertical; line-height: 1.55; }

.form-label {
    display: block;
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════════════════════ */

.atlora-table {
    width: 100%;
    border-collapse: collapse;
}
.atlora-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    white-space: nowrap;
}
.atlora-table tbody tr {
    border-bottom: 1px solid var(--bg-card);
    transition: background var(--transition-fast);
}
.atlora-table tbody tr:hover td {
    background: var(--bg-elevated);
}
.atlora-table tbody td {
    padding: 14px 16px;
    vertical-align: top;
    transition: background var(--transition-fast);
}
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Living status dot — processing */
.badge-dot.pulsing {
    animation: pulse 1.5s ease-in-out infinite;
}

.badge-ready      { background: #10B98118; color: var(--status-ready);      border: 1px solid #10B98140; }
.badge-processing { background: #F59E0B18; color: var(--status-processing);  border: 1px solid #F59E0B40; }
.badge-pending    { background: #6B728018; color: var(--status-pending);     border: 1px solid #6B728040; }
.badge-failed     { background: #EF444418; color: var(--status-failed);      border: 1px solid #EF444440; }
.badge-replaced   { background: #8B5CF618; color: var(--status-replaced);    border: 1px solid #8B5CF640; }

/* ═══════════════════════════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════════════════════════ */

.progress-track {
    height: 2px;
    background: var(--border-default);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.4s ease;
    animation: growWidth 0.5s ease;
}
.progress-fill.danger { background: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════════
   CARDS (collections)
   ══════════════════════════════════════════════════════════════════════════════ */

.col-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base);
    animation: fadeInUp var(--transition-slow) both;
}
.col-card:hover {
    background: var(--bg-card);
    border-color: var(--border-muted);
}
.col-card-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: var(--accent-glow);
    border: 1px solid var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--accent);
    flex-shrink: 0;
}
.col-card-arrow {
    font-size: 16px;
    color: var(--border-muted);
    flex-shrink: 0;
    padding-top: 2px;
    transition: color var(--transition-fast), transform var(--transition-fast);
}
.col-card:hover .col-card-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* Add tile */
.col-add-tile {
    background: transparent;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    transition: border-color var(--transition-base), background var(--transition-base);
    animation: fadeInUp var(--transition-slow) both;
}
.col-add-tile:hover {
    border-color: var(--border-muted);
    background: var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
    backdrop-filter: blur(2px);
}

.modal-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 440px;
    max-width: 90vw;
    animation: slideDown 0.18s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}
.modal-subtitle {
    font-size: 13px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    line-height: 1.55;
    margin-bottom: 20px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ALERTS / BANNERS
   ══════════════════════════════════════════════════════════════════════════════ */

.alert-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 12px;
    font-family: var(--font-mono);
    animation: fadeInUp 0.2s ease;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 12px;
    font-family: var(--font-mono);
    animation: fadeInUp 0.2s ease;
}

.alert-warn {
    background: var(--accent-glow);
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 12px;
    font-family: var(--font-mono);
    animation: fadeInUp 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════════ */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-family: var(--font-mono);
    min-width: 260px;
    max-width: 380px;
    pointer-events: auto;
    animation: slideInRight 0.22s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.toast-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}
.toast-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}
.toast-info {
    background: var(--accent-glow);
    border: 1px solid var(--accent-dim);
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SKELETON LOADING
   ══════════════════════════════════════════════════════════════════════════════ */

.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--bg-card);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CHAT UI
   ══════════════════════════════════════════════════════════════════════════════ */

/* Streaming cursor */
.stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.9s step-start infinite;
}

/* Message content */
.msg-content {
    font-size: 16px;
    white-space: pre-wrap;
    line-height: 1.65;
    word-break: break-word;
}

/* Message bubble — new messages slide in */
.msg-bubble-wrap {
    animation: fadeInUp 0.18s ease;
}

/* User bubble */
.bubble-user {
    border-radius: 10px;
    border-top-right-radius: 3px;
    padding: 12px 16px;
    background: #1A1F2E;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

/* Assistant bubble */
.bubble-asst {
    border-radius: 10px;
    border-top-left-radius: 3px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
}

/* Avatar icons */
.chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    font-family: var(--font-mono);
}
.chat-avatar-asst {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--accent);
}
.chat-avatar-user {
    background: #1A1F2E;
    border: 1px solid var(--border-default);
    color: var(--text-muted);
}

/* Source chips */
.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    animation: fadeIn 0.2s ease;
}

/* Suggestion cards */
.suggestion-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-faint);
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-mono);
    text-align: left;
    line-height: 1.4;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.suggestion-btn:hover {
    border-color: var(--border-muted);
    color: var(--text-muted);
    background: var(--bg-elevated);
}

/* Chat textarea */
.chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-family: var(--font-sans);
    resize: none;
    outline: none;
    line-height: 1.5;
    min-height: 48px;
    max-height: 200px;
    overflow-y: auto;
    transition: border-color var(--transition-fast);
}
.chat-input:focus {
    border-color: var(--border-muted);
}
.chat-input::placeholder {
    color: var(--text-ghost);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UPPY DARK THEME OVERRIDES
   ══════════════════════════════════════════════════════════════════════════════ */

.uppy-Dashboard-inner {
    background: var(--bg-elevated) !important;
    border: none !important;
    border-radius: 0 !important;
}
.uppy-Dashboard-AddFiles {
    border-color: var(--border-default) !important;
    background: var(--bg-elevated) !important;
}
.uppy-Dashboard-AddFiles-title,
.uppy-Dashboard-note {
    color: var(--text-faint) !important;
}
.uppy-Dashboard-browse {
    color: var(--accent) !important;
}
.uppy-Dashboard-browse:hover {
    color: var(--accent) !important;
    opacity: 0.8;
}
.uppy-DashboardTab-btn {
    color: var(--text-muted) !important;
}
.uppy-DashboardTab-btn:hover {
    color: var(--text-tertiary) !important;
    background: var(--bg-card) !important;
}
.uppy-DashboardContent-bar {
    background: var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border-default) !important;
}
.uppy-DashboardContent-title {
    color: var(--text-secondary) !important;
    font-family: var(--font-sans) !important;
}
.uppy-DashboardContent-back,
.uppy-DashboardContent-addMore {
    color: var(--accent) !important;
}
.uppy-Dashboard-Item {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-default) !important;
}
.uppy-Dashboard-Item-name {
    color: var(--text-secondary) !important;
    font-family: var(--font-mono) !important;
    font-size: 12px !important;
}
.uppy-Dashboard-Item-statusSize {
    color: var(--text-faint) !important;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
}
.uppy-StatusBar {
    background: var(--bg-elevated) !important;
    /* border-top hidden by default — only shown when the bar is active */
    border-top: none !important;
}
.uppy-StatusBar.is-uploading,
.uppy-StatusBar.is-complete {
    border-top: 1px solid var(--border-default) !important;
}
.uppy-StatusBar-status {
    color: var(--text-muted) !important;
    font-family: var(--font-mono) !important;
}
.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator {
    color: var(--accent) !important;
}
.uppy-StatusBar-actions .uppy-StatusBar-actionBtn--upload {
    background: var(--text-primary) !important;
    color: var(--bg-surface) !important;
    font-family: var(--font-sans) !important;
    font-weight: 600 !important;
    border-radius: var(--radius-md) !important;
}
.uppy-ProgressBar-container { background: var(--border-default) !important; }
.uppy-ProgressBar-inner     { background: var(--accent) !important; }

/* ═══════════════════════════════════════════════════════════════════════════════
   PAGE STRUCTURE HELPERS
   ══════════════════════════════════════════════════════════════════════════════ */

/* Page-level entry animation */
.page-content {
    animation: fadeIn 0.25s ease;
}

/* Section headers */
.section-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.section-subtitle {
    font-size: 15px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    margin-top: 6px;
}

/* Separator line */
.separator {
    border: none;
    border-top: 1px solid var(--border-faint);
}

/* Mono label (table cells, counts) */
.mono-sm {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-faint);
}
.mono-xs {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-ghost);
}

/* Empty-state centering */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}
.empty-icon {
    font-size: 40px;
    color: var(--border-default);
    margin-bottom: 20px;
    line-height: 1;
}
.empty-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--border-muted);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.empty-body {
    font-size: 15px;
    color: var(--border-muted);
    font-family: var(--font-mono);
    max-width: 380px;
    line-height: 1.6;
}

/* Spinner utility */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* Inline file icon */
.file-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

/* Action row */
.action-row {
    display: flex;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════════════════════ */

.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap   { white-space: nowrap; }

.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-faint   { color: var(--text-faint); }
.text-primary { color: var(--text-primary); }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

/* Accent border-left (info callout) */
.callout {
    border-left: 2px solid var(--accent);
    padding-left: 12px;
    font-size: 13px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    line-height: 1.6;
}
