/* ============================================
   L4 Finance Terminal — Design System
   Professional Dark Theme 2026
   ============================================ */

:root {
    /* ============================================
       REFINED DARK FINANCE — Surface Hierarchy
       Emerald accent · Clear depth layers · Readable prose
       ============================================ */

    /* Backgrounds — tight depth scale, same cool-dark temperature */
    --bg-base:       #131316;
    --bg-primary:    #131316;
    --bg-secondary:  #161619;
    --bg-tertiary:   #1c1c20;
    --bg-elevated:   #222228;
    --bg-card:       #161619;
    --bg-hover:      #1e1e24;
    --bg-active:     #26262e;
    --bg-selected:   rgba(16, 185, 129, 0.08);

    /* Borders — Warm-tinted neutrals */
    --border:        rgba(255, 255, 255, 0.06);
    --border-color:  rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.13);
    --border-hover:  rgba(16, 185, 129, 0.30);
    --border-active: rgba(16, 185, 129, 0.50);
    --border-focus:  rgba(16, 185, 129, 0.55);

    /* Text — Clear hierarchy, three tiers */
    --text-primary:   #FFFFFF;
    --text-secondary: #888899;
    --text-muted:     #5A5A6A;
    --text-link:      var(--accent);
    --text-normal:    #e0e1e6;

    /* Accent — Emerald Green (Finance · Profit · Professional) */
    --accent:      #10B981;
    --accent-dim:  rgba(16, 185, 129, 0.09);
    --accent-glow: rgba(16, 185, 129, 0.06);

    /* Semantic Colors — Adjusted for dark bg contrast */
    --success: #10B981;
    --danger:  #e5484d;
    --warning: #d99a2b;
    --purple:  #a78bfa;

    /* Grid & Noise — DISABLED (reduces visual fatigue) */
    --grid-color:    transparent;
    --noise-opacity: 0;

    /* Scrollbars — Minimal, warm */
    --scrollbar-thin-thumb: rgba(255, 255, 255, 0.06);
    --scrollbar-auto-thumb: rgba(255, 255, 255, 0.06);
    --scrollbar-auto-track: transparent;

    /* Legacy Compatibility Aliases */
    --bg-modifier-hover:    var(--bg-hover);
    --bg-modifier-active:   var(--bg-active);
    --bg-modifier-selected: var(--bg-selected);
    --channel-default:      var(--text-secondary);
    --channel-hover:        var(--text-primary);
    --channel-selected:     var(--accent);
    --brand-green:          var(--success);
    --brand-red:            var(--danger);
    --brand-yellow:         var(--warning);
    --brand-blue:           #6ea8fe;

    /* Bot Surface — emerald green-tinted for AI messages */
    --bot-accent:           #10B981;
    --bot-accent-strong:    #34d399;
    --bot-text-muted:       #8b8d98;
    --bot-surface:          rgba(16, 185, 129, 0.04);
    --bot-surface-strong:   rgba(16, 185, 129, 0.08);
    --bot-border:           rgba(16, 185, 129, 0.20);
    --bot-border-soft:      rgba(16, 185, 129, 0.12);
    --bot-glow:             rgba(16, 185, 129, 0.06);
    --bot-success-bg:       rgba(16, 185, 129, 0.10);
    --bot-success-border:   rgba(16, 185, 129, 0.28);
    --bot-success-text:     #6ee7b7;
    --bot-error-bg:         rgba(229, 72, 77, 0.10);
    --bot-error-border:     rgba(229, 72, 77, 0.25);
    --bot-error-text:       #f5a3a5;
    --bot-chart-border:     rgba(16, 185, 129, 0.16);
    --human-avatar-bg:      rgba(99, 102, 241, 0.10);
    --human-avatar-border:  rgba(99, 102, 241, 0.22);

    /* ============================================
       DESIGN TOKENS — Spacing, Radius, Elevation
       ============================================ */

    /* Spacing scale — 4 / 8 / 16 / 24 / 40 */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  40px;

    /* Radius scale — soft, friendly steps */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-pill: 999px;

    /* Elevation — subtle depth, NO colored glow */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);

    /* Signal pair — green/red/warn for financial data */
    --signal-up:        #10B981;
    --signal-up-bg:     rgba(16, 185, 129, 0.12);
    --signal-up-border: rgba(16, 185, 129, 0.30);
    --signal-down:        #e5484d;
    --signal-down-bg:     rgba(229, 72, 77, 0.12);
    --signal-down-border: rgba(229, 72, 77, 0.30);
    --signal-warn:        #d99a2b;
    --signal-warn-bg:     rgba(217, 154, 43, 0.12);
    --signal-warn-border: rgba(217, 154, 43, 0.30);

    /* Neutral ink — contrast-safe (≥4.5:1 on bg-secondary) */
    --ink-primary:   #f0f0f2;
    --ink-secondary: #8b8d98;
    --ink-muted:     #53545e;

    /* Solid borders for surfaces */
    --line:        #252630;
    --line-strong: #32333d;

    /* Mono label — data labels, tickers, timestamps ONLY */
    --font-label:    'JetBrains Mono', ui-monospace, monospace;
    --label-size:    0.6875rem;
    --label-tracking: 0.04em;

    /* Prose font — readable body text for AI chat responses */
    --font-prose:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

    /* Motion — feedback, not choreography (ease-out, short) */
    --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast:  120ms;
    --dur-base:  200ms;
    --dur-slow:  320ms;
}

/* ============================================
   Global Resets — Refined Dark Finance
   ============================================ */

/* Friendly border-radius */
button, .btn, input, textarea, select {
    border-radius: var(--radius-md);
}

.stat-card, .channel-item, .auth-tab-btn, .auth-input {
    border-radius: var(--radius-md);
}

.auth-modal, .ui-confirm-modal, .ui-prompt-modal {
    border-radius: var(--radius-lg);
}

/* Corner brackets stay square (decorative elements) */
.stat-card::before, .stat-card::after,
.auth-modal::before, .auth-modal::after,
.ui-confirm-modal::before, .ui-confirm-modal::after,
.ui-prompt-modal::before, .ui-prompt-modal::after {
    border-radius: 0;
}

/* Fast, precise transitions — machine-like */
button, a, .interactive, .channel-item, .stat-card,
input, textarea, select, .dropdown-btn, .hotbar-action-btn {
    transition: all 0.15s ease-out !important;
}

/* ============================================
   Utility Color Classes
   ============================================ */
.text-green  { color: var(--success) !important; }
.text-red    { color: var(--danger) !important; }
.text-yellow { color: var(--warning) !important; }
.text-blue   { color: var(--accent) !important; }
.text-muted  { color: var(--text-secondary) !important; }

.bg-green-subtle  { background: rgba(16, 185, 129, 0.12) !important; }
.bg-red-subtle    { background: rgba(248, 113, 113, 0.12) !important; }
.bg-yellow-subtle { background: rgba(251, 191, 36, 0.12) !important; }
.bg-green  { background: var(--success) !important; }
.bg-red    { background: var(--danger) !important; }
.bg-yellow { background: var(--warning) !important; }
.bg-blue   { background: var(--accent) !important; }

.font-mono { font-family: 'JetBrains Mono', monospace !important; }

/* ============================================
   Grid Trail Canvas — animated background layer
   ============================================ */

/* Canvas sits behind everything — DISABLED for clean surfaces */
#grid-trails {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0 !important;
    pointer-events: none;
    display: none;
}

/* ============================================
   Grid Overlay & Noise Texture
   ============================================ */

/* CSS grid replaced by canvas#grid-trails 3D vertex-mesh animation */
.content-body.grid-overlay::before { display: none; }

/* Grid breathe keyframes kept for reference but unused */
@keyframes grid-breathe {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

/* Subtle noise texture — DISABLED for clean surfaces */
.noise-overlay {
    position: relative;
}

.noise-overlay::before {
    display: none;
}

.noise-overlay > * {
    position: relative;
    z-index: 2;
}

/* ============================================
   Typography Hierarchy — Refined Dark Finance
   Prose for reading · Mono for data only
   ============================================ */

/* Headlines / Section Titles */
.headline,
.section-title,
.channel-header,
h1, h2, h3 {
    font-family: 'Rajdhani', 'Eurostile', 'Orbitron', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.2;
}

h1, .headline { font-size: 24px; }
h2, .section-title { font-size: 20px; }
h3 { font-size: 18px; }

/* Body / Chat Text — PROSE FONT for readability */
.body-text,
.chat-text,
.message-body {
    font-family: var(--font-prose);
    font-size: 15px;
    letter-spacing: -0.01em;
    line-height: 1.62;
}

/* Labels / Meta Text — Monospace for data */
.label-text,
.meta-text,
.timestamp,
.nav-section-label,
.chat-section-label,
.member-category {
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
}

/* Stats / Numbers / Metrics — Monospace for tabular data */
.stat-value,
.metric-number,
.stat-card .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    line-height: 1;
}

/* Buttons */
button,
.btn,
.hotbar-action-btn,
.composer-send-btn {
    font-family: var(--font-prose);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============================================
   Custom Select / Dropdown
   ============================================ */
.custom-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 140px;
}
.custom-select:hover  { border-color: var(--border-strong); background-color: var(--bg-active); }
.custom-select:focus  { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
.custom-select option { background: var(--bg-tertiary); color: var(--text-primary); }

/* ============================================
   Phosphor Duotone Icons
   ============================================ */
i[class*="ph-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
    color: var(--text-secondary);
    font-size: 16px;
}
i.ph-duotone { --ph-duotone-opacity: 0.2; }

/* Size aliases (keep class names for template compat) */
.lucide    { font-size: 16px; }  /* Sidebar icons */
.lucide-sm { font-size: 14px; }  /* Label icons */
.lucide-lg { font-size: 18px; }  /* Large icons */

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

body {
    font-family: var(--font-prose);
    font-size: 14px;
    font-weight: 450;
    line-height: 1.5;
    letter-spacing: -0.01em;
    background: radial-gradient(ellipse at top, #1E1E2E 0%, #0F0F14 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
/* ============================================
   Custom Scrollbar — Squared, Minimal
   ============================================ */
::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thin-thumb);
    /* border-radius: 0 handled by global reset */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================================
   Main Layout
   ============================================ */
.app-container {
    --left-panel-width: 256px;
    --right-panel-width: 224px;
    --panel-resizer-width: 6px;
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Server List — hidden legacy Discord element */
.server-list    { display: none !important; }
.server-icon    { display: none !important; }
.server-divider { display: none !important; }

/* ============================================
   Navigation Sidebar (Channel List)
   ============================================ */
.channel-list {
    width: var(--left-panel-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-resizer {
    width: var(--panel-resizer-width);
    margin-left: calc(var(--panel-resizer-width) / -2);
    margin-right: calc(var(--panel-resizer-width) / -2);
    flex-shrink: 0;
    position: relative;
    z-index: 8;
    cursor: col-resize;
    background: transparent;
    touch-action: none;
    user-select: none;
}

.panel-resizer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: transparent;
    opacity: 0;
    box-shadow: none;
    transition: background 0.12s ease-out, box-shadow 0.12s ease-out, opacity 0.12s ease-out;
}

.panel-resizer:hover::before,
body.is-resizing .panel-resizer::before,
.panel-resizer:focus-visible::before {
    background: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
    opacity: 1;
}

.panel-resizer:focus-visible {
    outline: none;
}

body.is-resizing,
body.is-resizing * {
    cursor: col-resize !important;
}

.channel-header {
    height: 52px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

.channel-header-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 4px 10px;
}

.channel-header .status {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.channel-header .status.open {
    background: transparent;
    color: var(--success);
    border: none;
    padding: 0;
    letter-spacing: 0.12em;
}
.channel-header .status.closed {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.channels-container {
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    position: relative;
}

/* One shared active marker for channels only */
.sidebar-active-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 24px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    pointer-events: none;
    z-index: 3;
    opacity: 1;
    /* GPU compositor layer + backface-hidden prevents sub-pixel flicker
       during fast transform interpolation. Does not affect timing. */
    transform: translate3d(0, 0, 0);
    will-change: transform, height;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 260ms cubic-bezier(0.2, 0.85, 0.25, 1),
                height 220ms cubic-bezier(0.2, 0.85, 0.25, 1),
                opacity 120ms ease-out;
}

.sidebar-active-indicator.is-hidden {
    opacity: 0;
}

.channel-category {
    padding: 14px 8px 5px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.channel-category:first-child { padding-top: 4px; }

/* Nav channels section (Perplexity-style, at top of sidebar) */
.nav-channels-section {
    flex-shrink: 0;
    padding: 8px 8px 4px;
}

.nav-section-label {
    padding: 4px 2px 6px;
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    user-select: none;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0 8px 0;
    flex-shrink: 0;
}

.chat-section-label {
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    user-select: none;
}

.view-all-chats-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    padding: 6px 10px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    margin-top: 2px;
}
.view-all-chats-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    margin: 1px 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease-out;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}
.channel-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
    color: var(--text-primary);
}
.channel-item.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.channel-item svg, .channel-item .lucide {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
}
.channel-item i[class*="ph-"] {
    font-size: 16px;
    flex-shrink: 0;
    transition: color 0.15s ease-out, --ph-duotone-opacity 0.15s ease-out;
}
.channel-item:hover i[class*="ph-"] {
    color: var(--accent);
    --ph-duotone-opacity: 0.38;
}
.channel-item.active i[class*="ph-"] {
    color: var(--accent);
    --ph-duotone-opacity: 0.4;
}
.channel-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 100px;
}

/* ============================================
   Chat History (Sidebar section)
   ============================================ */
.chat-history-section {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 8px 8px;
}

.chat-history-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 2px 6px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.new-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.15s ease-out;
    white-space: nowrap;
}
.new-chat-btn:hover {
    background: var(--accent-dim);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 2px;
}

.chat-history-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 10px;
}

.chat-history-item,
.chat-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px 7px 11px;
    border-radius: 2px;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.chat-history-item:hover,
.chat-item:hover { background: transparent; color: var(--text-primary); }
.chat-history-item.active,
.chat-item.active {
    background: transparent;
    color: var(--channel-selected);
    border-color: transparent;
    box-shadow: none;
}

.chat-history-item.active:hover,
.chat-item.active:hover { color: var(--channel-selected); }

.chat-history-icon {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}
.chat-history-icon svg,
.chat-history-icon .lucide { width: 13px; height: 13px; stroke: currentColor; }
.chat-history-icon i[class*="ph-"] { font-size: 13px; }
.chat-history-item.active .chat-history-icon,
.chat-item.active .chat-history-icon { opacity: 1; }

.chat-history-title {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-history-time {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-left: 2px;
}

.chat-history-actions { position: relative; flex-shrink: 0; }
.chat-action-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
}
.chat-history-item:hover .chat-action-btn,
.chat-action-btn:focus-visible { opacity: 1; }
.chat-action-btn:hover { background: var(--bg-active); color: var(--text-primary); }

.chat-item-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 128px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: none;
    z-index: 30;
}
.chat-item-menu.show { display: block; }
.chat-item-menu button {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    text-transform: none;
    letter-spacing: 0;
    text-align: left;
    padding: 9px 12px;
    cursor: pointer;
}
.chat-item-menu button:hover { background: var(--bg-hover); }
.chat-item-menu button.delete-chat { color: var(--danger); }

/* Thin scrollbar for chat history section */
.chat-history-section::-webkit-scrollbar {
    width: 3px;
}

.chat-history-section::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history-section::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thin-thumb);
}

.chat-history-section::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================================
   User Panel (bottom of sidebar)
   ============================================ */
.user-panel {
    height: 54px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    flex-shrink: 0;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-status {
    font-size: 11px;
    color: var(--text-muted);
}

.user-actions { position: relative; flex-shrink: 0; }
.user-settings-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.user-settings-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.user-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    min-width: 160px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-lg);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(16, 185, 129, 0.05);
    padding: 6px;
    display: none;
    z-index: 40;
}
.user-menu.show { display: block; }
.user-menu button {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    text-align: left;
    padding: 10px 14px;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.user-menu button:hover { background: var(--bg-hover); }
.user-menu button.logout { color: var(--danger); }

/* ============================================
   Auth Modal
   ============================================ */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}
.auth-modal-overlay.show { opacity: 1; pointer-events: auto; }

.auth-modal {
    width: min(92vw, 380px);
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    padding: 22px;
    position: relative;
}

/* Corner brackets on all 4 corners */
.auth-modal::before,
.auth-modal::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--accent);
}

.auth-modal::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.auth-modal::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.auth-modal-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-bottom: 14px;
}
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-tab-btn {
    flex: 1;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
}
.auth-tab-btn.active {
    color: var(--text-primary);
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

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

.auth-input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Settings Shell ────────────────────────── */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 3100;
    padding: 16px;
    transition: opacity 0.18s ease;
}
.settings-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.settings-shell,
.alert-settings-modal {
    width: min(1100px, 100%);
    height: min(780px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: translateY(6px) scale(0.985);
    transition: transform 0.2s ease;
}
.settings-overlay.show .settings-shell,
.settings-overlay.show .alert-settings-modal {
    transform: translateY(0) scale(1);
}
.settings-shell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.settings-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.settings-header-icon {
    font-size: 20px;
    color: var(--text-secondary);
}
.settings-header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.settings-close-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 9px;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 15px;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.settings-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.06);
}

/* Shell body: sidebar + content */
.settings-shell-body {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
}

/* Sidebar navigation */
.settings-nav {
    width: 220px;
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
    overflow-y: auto;
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    text-align: left;
    width: 100%;
}
.settings-nav-item i {
    font-size: 18px;
    flex: 0 0 auto;
}
.settings-nav-item:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.05);
}
.settings-nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    box-shadow: inset 3px 0 0 #ffffff;
}

/* Content area */
.settings-content {
    flex: 1 1 0;
    min-width: 0;
    overflow-y: auto;
    position: relative;
}
.settings-panel {
    display: none;
    padding: 28px 32px;
    animation: settingsFadeIn 0.12s ease;
}
.settings-panel.active {
    display: block;
}
@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
.settings-panel-head {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.settings-panel-head h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.settings-panel-head p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 5px 0 0;
}
.settings-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13px;
}
.settings-placeholder i {
    font-size: 28px;
    opacity: 0.4;
}

/* ── Settings responsive ──────────────────── */
@media (max-width: 800px) {
    .settings-overlay { padding: 8px; }
    .settings-shell {
        height: calc(100vh - 16px);
        border-radius: 12px;
    }
    .settings-shell-body {
        flex-direction: column;
    }
    .settings-nav {
        width: auto;
        flex: 0 0 auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 4px;
    }
    .settings-nav-item {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
    }
    .settings-nav-item span { display: none; }
    .settings-nav-item i { font-size: 19px; }
    .settings-panel { padding: 16px 18px; }
}

/* ── Alert Settings (inner content) ───────── */
.alert-settings-message {
    min-height: 0;
    font-size: 12px;
    margin: 0;
}
.alert-settings-message:not(:empty) {
    margin: 10px 0 4px;
}
.alert-settings-message[data-kind="error"] { color: var(--danger); }
.alert-settings-message[data-kind="success"] { color: var(--success); }
.alert-settings-message[data-kind="info"] { color: var(--text-muted); }
.alert-settings-statusbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.alert-settings-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 0;
}
.alert-settings-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.alert-toggle-track {
    width: 38px;
    height: 21px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    position: relative;
    flex: 0 0 auto;
}
.alert-toggle-track::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: transform 0.16s ease, background 0.16s ease;
}
.alert-settings-toggle input:checked + .alert-toggle-track {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.18);
}
.alert-settings-toggle input:checked + .alert-toggle-track::after {
    transform: translateX(17px);
    background: #ffffff;
}
.alert-settings-toggle strong,
.alert-settings-toggle small {
    display: block;
}
.alert-settings-toggle strong {
    font-size: 13px;
}
.alert-settings-toggle small {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 1px;
}
.alert-settings-connection {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
    color: var(--text-muted);
    font-size: 11px;
}
.alert-settings-connection span,
.alert-connection-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.025);
}
.alert-connection-pill[data-state="ready"] {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
}
.alert-connection-pill[data-state="missing"] {
    color: var(--warning);
    border-color: rgba(255, 170, 0, 0.3);
    background: rgba(255, 170, 0, 0.05);
}
.alert-settings-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.alert-section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.alert-section-head span {
    color: var(--text-primary);
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.alert-section-head small {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.alert-settings-field {
    display: grid;
    gap: 7px;
    color: var(--text-primary);
    font-size: 12px;
    margin-top: 11px;
}
.alert-settings-field > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-weight: 700;
}
.alert-settings-field input,
.alert-settings-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.32);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.alert-settings-field textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.4;
}
.alert-settings-field input:focus,
.alert-settings-field textarea:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.42);
    outline: none;
}
.alert-settings-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.alert-mode-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.018);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.alert-mode-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.alert-mode-card:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}
.alert-mode-card:has(input:checked) {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
}
.alert-mode-card:has(input:checked) .alert-mode-icon {
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}
.alert-mode-card:has(input:checked) .alert-mode-title {
    color: #ffffff;
}
.alert-mode-icon {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    font-size: 18px;
    transition: border-color 0.15s, color 0.15s;
}
.alert-mode-label {
    min-width: 0;
}
.alert-mode-title {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
    transition: color 0.15s;
}
.alert-mode-copy {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
}
.alert-webhook-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
}
.alert-webhook-copy button,
.alert-settings-actions button,
.alert-settings-history-summary button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.alert-webhook-copy button {
    padding: 0;
    font-size: 16px;
    border-radius: 8px;
}
.alert-webhook-copy button:hover,
.alert-settings-actions button:hover,
.alert-settings-history-summary button:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.075);
}
.alert-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 0;
}
.alert-settings-actions .alert-primary-action {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.alert-settings-actions .alert-primary-action:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}
.alert-settings-actions .alert-secondary-action {
    color: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.12);
}
.alert-settings-actions .alert-secondary-action:hover {
    color: var(--text-primary);
}
.alert-settings-history-details {
    border-top: 1px solid var(--border);
    padding-top: 4px;
}
.alert-settings-history-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    cursor: pointer;
    list-style: none;
}
.alert-settings-history-summary::-webkit-details-marker { display: none; }
.alert-settings-history-summary > div {
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-settings-history-title {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.alert-settings-history-details[open] .alert-settings-history-title {
    color: var(--text-primary);
}
.alert-settings-history-copy {
    color: var(--text-muted);
    font-size: 11px;
}
.alert-settings-history-summary button {
    width: 34px;
    height: 34px;
    padding: 0;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 15px;
    border-radius: 8px;
}
.alert-settings-history-summary button:hover {
    border-color: rgba(255, 59, 59, 0.4);
    background: rgba(255, 59, 59, 0.06);
    color: var(--danger);
}
.alert-settings-history-list {
    display: grid;
    gap: 7px;
    color: var(--text-muted);
    font-size: 12px;
    max-height: 140px;
    overflow: auto;
    padding-right: 2px;
}
.alert-history-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.018);
}
.alert-history-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.alert-history-item strong {
    color: var(--text-primary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alert-history-item span {
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    flex: 0 0 auto;
    font-weight: 600;
}
.alert-history-item[data-status="failed"] span,
.alert-history-item[data-status="partial"] span {
    color: var(--warning);
}
.alert-history-meta {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}
.alert-history-item p {
    margin: 3px 0 0;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alert-history-empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.012);
}
@media (max-width: 720px) {
    .alert-settings-statusbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .alert-settings-connection {
        justify-content: flex-start;
    }
    .alert-settings-mode-grid {
        grid-template-columns: 1fr;
    }
    .alert-webhook-copy button {
        height: 36px;
    }
    .alert-settings-actions {
        flex-direction: column-reverse;
    }
    .alert-settings-actions button {
        width: 100%;
    }
}

.auth-submit {
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
}
.auth-submit:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
}

.auth-message { min-height: 16px; font-size: 12px; line-height: 1.3; }
.auth-message.error { color: #FC8181; }
.auth-message.info  { color: var(--text-muted); }

/* ============================================
   UI Dialogs — Confirm & Prompt
   ============================================ */
.ui-confirm-overlay,
.ui-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.72);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.ui-confirm-overlay  { z-index: 3200; }
.ui-prompt-overlay   { z-index: 3210; }
.ui-confirm-overlay.show,
.ui-prompt-overlay.show { opacity: 1; pointer-events: auto; }

.ui-confirm-modal,
.ui-prompt-modal {
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    padding: 20px;
    position: relative;
}

/* Corner brackets on all 4 corners */
.ui-confirm-modal::before,
.ui-prompt-modal::before,
.ui-confirm-modal::after,
.ui-prompt-modal::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--accent);
}

.ui-confirm-modal::before,
.ui-prompt-modal::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.ui-confirm-modal::after,
.ui-prompt-modal::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.ui-confirm-modal { width: min(92vw, 360px); }
.ui-prompt-modal  { width: min(92vw, 380px); }

.ui-confirm-title,
.ui-prompt-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.ui-confirm-message,
.ui-prompt-message {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.ui-prompt-message { margin-bottom: 10px; }

.ui-confirm-actions,
.ui-prompt-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ui-prompt-input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.ui-prompt-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ui-confirm-btn {
    border: 1px solid var(--border-strong);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.ui-confirm-btn:hover { background: var(--bg-active); }
.ui-confirm-btn-confirm {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
}
.ui-confirm-btn-confirm:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.6);
}
.ui-confirm-btn-confirm.is-danger {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.1);
    color: #FCA5A5;
}
.ui-confirm-btn-confirm.is-danger:hover {
    background: rgba(248, 113, 113, 0.22);
    border-color: rgba(248, 113, 113, 0.6);
}

.compact-summary-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3220;
}
.compact-summary-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.compact-summary-modal {
    width: min(92vw, 760px);
    max-height: min(78vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    padding: 20px;
    position: relative;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}
.compact-summary-modal::before,
.compact-summary-modal::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--accent);
}
.compact-summary-modal::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}
.compact-summary-modal::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}
.compact-summary-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-primary);
}
.compact-summary-meta {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.compact-summary-content {
    flex: 1;
    min-height: 180px;
    overflow: auto;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 14px 16px;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.65;
}
.compact-summary-actions {
    display: flex;
    justify-content: flex-end;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    min-width: 0;
}

.content-header {
    height: 52px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
    gap: 2px;
}
.content-header svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    margin-right: 6px;
    flex-shrink: 0;
}
.content-header .channel-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.content-header .channel-desc {
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--border-strong);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Token usage badge */
.token-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: 100px;
    border: 1px solid transparent;
    background: var(--bg-hover);
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.01em;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.token-badge-low    { color: var(--text-muted); border-color: rgba(255, 255, 255, 0.06); }
.token-badge-medium { color: var(--warning); border-color: rgba(217, 154, 43, 0.3); }
.token-badge-high   { color: var(--danger);  border-color: rgba(229, 72, 77, 0.4); animation: token-badge-pulse 1.8s ease-in-out infinite; }
@keyframes token-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.1); }
    50%       { box-shadow: 0 0 0 5px rgba(229, 72, 77, 0.15); }
}

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 0;
    box-sizing: border-box;
    position: relative;
}

/* Mouse-light effect removed */

/* ============================================
   System Panel (right sidebar)
   ============================================ */
.member-list {
    width: var(--right-panel-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    flex-shrink: 0;
    padding: 16px 12px;
    overflow-y: auto;
}

.member-category {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 14px 4px 6px;
}
.member-category:first-child { padding-top: 0; }

.member-item {
    display: flex;
    align-items: center;
    padding: 5px 6px;
    margin: 1px 0;
    border-radius: 7px;
    cursor: default;
    transition: background 0.12s;
}
.member-item:hover { background: var(--bg-hover); }

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    color: white;
    border: 1px solid var(--border-color);
}
.member-avatar.bot {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.25);
    color: #10B981;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.05em;
}
.member-avatar.human {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.24);
    font-size: 11px;
}

.member-name { font-size: 13px; color: var(--text-primary); }
.member-name .bot-tag {
    background: var(--bot-surface-strong);
    color: var(--bot-accent);
    border: 1px solid var(--bot-border-soft);
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: 700;
}

.member-stats-card {
    width: 100%;
    padding: 10px 0;
}

.member-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    max-height: 42px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 160ms ease;
}

.member-stat-row + .member-stat-row {
    margin-top: 0;
}

.member-stat-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.member-stat-label {
    color: var(--text-normal);
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.member-stat-badge {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    font: 700 10px/1 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

.member-stat-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.member-stat-copy strong {
    color: var(--text-normal);
    font-size: 13.5px;
    line-height: 1.1;
    white-space: nowrap;
}

.member-stat-copy small {
    color: #888899;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-stat-value {
    color: #888899;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    white-space: nowrap;
}

/* ============================================
   Chat Message Styles — Clear user/bot separation
   ============================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.chat-message {
    display: flex;
    padding: 4px 20px;
    margin-top: 32px;
}
.chat-message:hover { background: rgba(255, 255, 255, 0.01); }
.chat-message.same-author { margin-top: 2px; }
.chat-message.same-author .msg-avatar { visibility: hidden; }

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-right: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
}
.msg-avatar.bot    { background: rgba(16, 185, 129, 0.12); color: var(--accent); border: 1px solid rgba(16, 185, 129, 0.28); }
.msg-avatar.user   { background: rgba(99, 102, 241, 0.10); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.22); }
.msg-avatar.system { background: rgba(217, 154, 43, 0.10); color: var(--warning); }

.msg-content { flex: 1; min-width: 0; }
.msg-header  { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author  { font-weight: 700; font-size: 13px; }
.msg-author.bot  { color: var(--accent); }
.msg-author.user { color: #818cf8; }
.msg-timestamp   { font-size: 11px; color: var(--text-muted); }

.msg-body {
    color: var(--text-normal);
    font-family: var(--font-prose);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.msg-body strong { font-weight: 700; }
.msg-body code {
    background: var(--bg-tertiary);
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border);
}

/* Chat Input base wrapper (layout) */
.chat-input-container {
    padding: 0 16px 20px;
    flex-shrink: 0;
}
.chat-input-wrapper {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 16px;
    display: flex;
    align-items: center;
}
.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 11px 0;
    font-family: inherit;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-send-btn:hover { background: #2563EB; }

/* ============================================
   Markdown Content — Prose-readable
   ============================================ */
.markdown-content {
    font-family: var(--font-prose);
    font-size: 15px;
    line-height: 1.62;
    letter-spacing: -0.01em;
}
.markdown-content h1 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 14px 0 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 7px;
}
.markdown-content h2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 7px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.markdown-content h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 10px 0 5px;
}
.markdown-content p    { margin: 6px 0; color: var(--text-normal); line-height: 1.65; }
.markdown-content strong { font-weight: 700; color: var(--accent); }
.markdown-content em   { font-style: italic; }
.markdown-content ul,
.markdown-content ol   { margin: 8px 0; padding-left: 20px; }
.markdown-content li   { margin: 4px 0; color: var(--text-normal); line-height: 1.55; }
.markdown-content a    { color: var(--accent); text-decoration: none; }
.markdown-content a:hover { text-decoration: underline; }
.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 14px;
    margin: 8px 0;
    background: var(--accent-dim);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
}
.markdown-content code {
    background: var(--bg-tertiary);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border);
}
.markdown-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 10px 0;
}
.markdown-content pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: 12px;
    line-height: 1.6;
}
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}
.markdown-content th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
}
.markdown-content td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.markdown-content tr:hover td { background: var(--bg-hover); }
.markdown-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ============================================
   Scanner
   ============================================ */
.scan-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    border-radius: 8px;
    padding: 9px 20px;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.18s;
}
.scan-btn:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
}
.scan-btn.loading { opacity: 0.6; cursor: wait; }
.scan-btn svg { width: 15px; height: 15px; }

.results-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.results-header {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}
.results-header .count {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
}

.signal-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.signal-row:hover { background: var(--bg-hover); }
.signal-row:last-child { border-bottom: none; }

.signal-ticker {
    font-weight: 700;
    font-size: 14px;
    width: 72px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.signal-type {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.signal-type.whisper  { background: rgba(167, 139, 250, 0.12); color: #C4B5FD; }
.signal-type.earnings { background: rgba(59, 130, 246, 0.12);  color: #93C5FD; }
.signal-type.combined { background: rgba(16, 185, 129, 0.12);  color: #6EE7B7; }

.signal-metrics { display: flex; gap: 20px; flex: 1; }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.metric-value {
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}
.metric-value.positive { color: var(--success); }
.metric-value.negative { color: var(--danger); }

.signal-confidence { width: 56px; text-align: right; }
.confidence-bar {
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}
.confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.confidence-fill.high   { background: var(--success); }
.confidence-fill.medium { background: var(--warning); }
.confidence-fill.low    { background: var(--danger); }

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.15s ease-out;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Corner brackets — top-left and bottom-right */
.stat-card::before,
.stat-card::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--accent);
    opacity: 0.5;
}

.stat-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.stat-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.stat-card .label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    line-height: 1;
}

.stat-card .change {
    font-size: 12px;
    margin-top: 8px;
    font-weight: 500;
}

/* ============================================
   Hotbar / Composer (Bottom Input Bar) - INDUSTRIAL
   ============================================ */

/* Main container - elevated with depth */
.ios-composer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
    padding: 12px 16px;
    position: relative;
}

.hotbar-main-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Layout sections */
.composer-left,
.composer-center,
.composer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-center {
    flex: 1;
    flex-direction: column;
    gap: 6px;
}

/* Buttons - lightly rounded industrial style */
.hotbar-action-btn,
.composer-plus-btn,
.composer-send-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.hotbar-action-btn:hover,
.composer-plus-btn:hover,
.composer-send-btn:hover {
    border-color: var(--border-active);
    background: var(--accent-dim);
}

.composer-send-btn {
    border-color: var(--accent);
}

.composer-send-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.hotbar-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Input field - squared with monospace */
.composer-input-shell {
    width: 100%;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    padding: 2px;
    transition: all 0.15s ease-out;
}

.composer-input-shell:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.composer-input {
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.02em;
    resize: none;
    outline: none;
}

.composer-input::placeholder {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Meta pills/badges */
.composer-meta-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.composer-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

/* Extras menu dropdown - industrial style */
.extras-menu-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    min-width: 220px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    padding: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: all 0.15s ease-out;
    z-index: 1000;
}

.extras-menu-panel.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.extras-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.extras-menu-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-active);
}

.extras-menu-item i {
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.15s ease-out;
}

.extras-menu-item:hover i {
    color: var(--accent);
}

.extras-menu-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.extras-menu-text span:first-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.extras-menu-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Model switcher wrapper */
.composer-mode-wrap {
    display: flex;
    align-items: center;
}

/* Thinking state - industrial style */
.hotbar-thinking-state {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.ios-composer.is-thinking .hotbar-thinking-state {
    display: flex;
}

.hotbar-thinking-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.hotbar-thinking-text {
    flex: 1;
}

.hotbar-thinking-timer {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

/* ============================================
   Feature Cards (Capability Cards in Chat)
   ============================================ */
.feature-card,
.capability-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 12px;
    transition: all 0.15s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-card:hover,
.capability-card:hover {
    border-color: var(--border-active);
    box-shadow: 0 0 8px var(--accent-glow);
}

.feature-card-icon,
.capability-card-icon {
    color: var(--text-secondary);
    font-size: 18px;
    transition: color 0.15s ease-out;
}

.feature-card:hover .feature-card-icon,
.capability-card:hover .capability-card-icon {
    color: var(--accent);
}

.feature-card-content,
.capability-card-content {
    flex: 1;
}

.feature-card-title,
.capability-card-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.feature-card-subtitle,
.capability-card-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
}

/* ============================================
   Data Table
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
}
.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-hover); }

/* ============================================
   Loading
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-request .loading-indicator { display: inline-flex !important; }
.loading-indicator { display: none; }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: #2563EB; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-active); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}
.badge-green { background: rgba(16, 185, 129, 0.14); color: var(--success); }
.badge-red   { background: rgba(248, 113, 113, 0.14); color: var(--danger); }

.score-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}
.score-badge.high   { background: rgba(16, 185, 129, 0.14); color: var(--success); }
.score-badge.medium { background: rgba(251, 191, 36, 0.14);  color: var(--warning); }
.score-badge.low    { background: rgba(248, 113, 113, 0.14); color: var(--danger); }

/* ============================================
   Welcome Banner
   ============================================ */
.welcome-banner {
    padding: 16px 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.welcome-banner h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.welcome-banner p  { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
}
.empty-state svg { width: 44px; height: 44px; fill: var(--text-muted); margin-bottom: 14px; opacity: 0.4; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state .desc  { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   Generic pre / code (outside markdown context)
   ============================================ */
pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.6;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
}
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* ============================================
   Inline message compat (used in channels)
   ============================================ */
.message .text {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ============================================
   Industrial Animations — Precise & Fast
   ============================================ */

/* Page entrance — vertical wipe */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Border draw — circuit connecting effect */
@keyframes border-draw {
    0% {
        clip-path: inset(0 100% 100% 0);
    }
    25% {
        clip-path: inset(0 0 100% 0);
    }
    50% {
        clip-path: inset(0 0 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

/* Text reveal — fade from muted to primary */
@keyframes text-reveal {
    from {
        opacity: 0;
        color: var(--text-muted);
    }
    to {
        opacity: 1;
        color: var(--text-primary);
    }
}

/* Cursor blink — loading state */
@keyframes cursor-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Processing pulse — loading text */
@keyframes processing-pulse {
    0%, 100% { color: var(--text-muted); }
    50% { color: var(--text-primary); }
}

/* Spin — keep for loading states */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Content area entrance — staggered */
.content-body > * {
    animation: fadeSlideIn 0.2s ease-out both;
}
.content-body > *:nth-child(1) { animation-delay: 0.00s; }
.content-body > *:nth-child(2) { animation-delay: 0.03s; }
.content-body > *:nth-child(3) { animation-delay: 0.06s; }
.content-body > *:nth-child(4) { animation-delay: 0.09s; }

/* ============================================
   Hover States — No Transform, Border + Glow
   ============================================ */

/* Channel items — border + subtle bg on hover */
.channel-item {
    transition: all 0.15s ease-out;
}
.channel-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}
.channel-item.active {
    color: var(--accent);
    border-color: transparent;
    background: var(--accent-dim);
}

/* Stat cards — border accent on hover */
.stat-card {
    transition: all 0.15s ease-out;
}
.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Signal rows — border glow only */
.signal-row {
    transition: all 0.15s ease-out;
}
.signal-row:hover {
    border-color: var(--border-hover);
}

/* Chat history items — subtle hover */
.chat-history-item, .chat-item {
    transition: all 0.15s ease-out;
}
.chat-history-item:hover, .chat-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* Buttons — no scale, subtle background fill */
.btn, .scan-btn, .auth-submit, .ui-confirm-btn {
    transition: all 0.15s ease-out;
}
.btn:hover, .scan-btn:hover, .auth-submit:hover, .ui-confirm-btn:hover {
    border-color: var(--border-hover);
    background: var(--accent-dim);
}
.btn:active, .scan-btn:active, .auth-submit:active, .ui-confirm-btn:active {
    background: rgba(16, 185, 129, 0.14);
}

/* New chat button — mechanical plus rotation */
.new-chat-btn {
    transition: border-color 0.15s ease-out, background 0.15s ease-out, color 0.15s ease-out;
}
.new-chat-btn:hover {
    border-color: var(--border-active);
    background: var(--accent-dim);
}
.new-chat-btn .new-chat-plus-icon,
.new-chat-btn i[class*="ph-"] {
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
    transform-origin: center;
}
.new-chat-btn:hover .new-chat-plus-icon,
.new-chat-btn:hover i[class*="ph-"] {
    transform: rotate(90deg);
}

/* User settings button — keep gear spin but make it linear */
.user-settings-btn:hover i[class*="ph-"] {
    animation: spin 0.3s linear;
}

/* Content header icon */
.content-header i[class*="ph-"] {
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Duotone icon depth on focus */
button:focus-visible i[class*="ph-"],
a:focus-visible i[class*="ph-"] {
    --ph-duotone-opacity: 0.5;
}

/* ============================================
   Loading States
   ============================================ */

/* Blinking cursor for loading */
.loading-cursor::after {
    content: '█';
    animation: cursor-blink 1s infinite;
}

/* Processing text pulse */
.processing-text {
    animation: processing-pulse 1s infinite;
}

/* Spinner (keep existing) */
.spinner {
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Chart & Data Visualization Components
   ============================================ */

/* TradingView Widget Container */
.tradingview-widget-container {
    margin: 16px 0;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.tradingview-widget-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
    opacity: 0.5;
}

/* Plotly Chart Container */
.plotly-chart-container {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 2px;
    position: relative;
}

.plotly-chart-container img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

/* Data Table Styling */
.data-table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.data-table thead {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-strong);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   REDUCED MOTION (A+C redesign, task 14)
   "fewer and gentler, not zero" — keep opacity/color
   transitions that aid comprehension, kill movement.
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Decorative ambient grid-trail canvas: silence it entirely. */
    #grid-trails {
        display: none !important;
    }

    /* Opacity/color cues stay legible (re-enable just those, gently). */
    .token-badge,
    .status,
    .member-stat-value {
        transition-duration: 120ms !important;
    }
}
