:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #60a5fa;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(12px);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
    overflow: hidden;
}

.menu-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo h2 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.menu-section h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.block-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.block-list li {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    font-weight: 600;
}

.block-list li:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.block-list li.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    border-left: 4px solid var(--accent-blue);
    color: var(--accent-blue-hover);
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent-blue);
    color: white;
}

.tab-content.hidden {
    display: none !important;
}

.test-group-item {
    font-weight: bold !important;
    color: #4a90e2 !important;
}

/* Checkbox List Items */
.checkbox-list {
    gap: 4px !important;
}

.checkbox-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    cursor: pointer;
}

.checkbox-item .item-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-item .item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.checkbox-item .item-title {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkbox-item .item-sub {
    font-size: 9px;
    color: var(--text-muted);
}

.checkbox-item.selected {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

/* Tab Action Buttons */
.tab-actions {
    display: flex;
    padding: 10px 0 4px;
    gap: 6px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    margin-top: 6px;
}

.btn-tab-action {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.btn-edit {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.btn-edit:hover {
    background: rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.btn-create {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.btn-create:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    position: relative;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.dashboard-content.hidden {
    display: none;
}

.row {
    display: flex;
    gap: 1.5rem;
}

.row.full-width {
    width: 100%;
}

.card {
    flex: 1;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.glass {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--glass-shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.icon {
    font-size: 1.2rem;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.highlight-text {
    font-size: 1.5rem;
    color: var(--accent-blue-hover);
    margin-bottom: 0.25rem;
}

.sub-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.metric {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.metric .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.metric .value {
    font-size: 1.2rem;
    font-weight: 800;
}

.val-positive {
    color: var(--success);
}

.val-negative {
    color: var(--danger);
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.profile-item .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-item .value {
    font-weight: 600;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.bg-blue {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
}

.bg-orange {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
}

.premium-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border-left: 4px solid var(--accent-purple);
}

.typewriter-effect p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e2e8f0;
    border-left: 2px solid var(--accent-purple);
    padding-left: 1rem;
    font-style: italic;
}

.action-card {
    border-left: 4px solid var(--accent-orange);
}

.badge {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge.high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Model Badges */
.badge.pro {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid #a78bfa;
}

.badge.flash {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid #60a5fa;
}

.badge.mini {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid #cbd5e1;
}


.recommendation-box p {
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 600;
}

.welcome-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    max-width: 500px;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-screen h2 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    color: var(--text-muted);
    line-height: 1.6;
}

.pulsing-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for list */
.loading {
    color: var(--text-muted);
    font-style: italic;
    animation: blink 1.5s infinite;
}

/* Chat Styles */
.chat-msg {
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 85%;
}

.chat-msg.system {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    align-self: flex-start;
    color: #fff;
}

.chat-msg.user {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    align-self: flex-end;
    color: #fff;
}

.chat-msg.loading {
    font-style: italic;
    opacity: 0.7;
}

#brain-input:focus {
    border-color: #00f2fe !important;
}


@keyframes blink {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ── Date Selection Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.25s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    width: 520px;
    max-width: 92vw;
    border-radius: 20px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.25);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

/* Date option cards */
.date-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.date-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.date-option.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.date-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
}

.date-option-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-option-label {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.date-option-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-blue-hover);
    letter-spacing: -0.3px;
}

.date-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modal buttons */
.btn-modal {
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-run {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.btn-run:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}