/* === CSS Variables === */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a45;
    --bg-input: #0f1729;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #4fc3f7;
    --accent-hover: #39a8db;
    --success: #66bb6a;
    --warning: #ffa726;
    --error: #ef5350;
    --border: #2a3a55;
    --sidebar-width: 300px;
    --header-height: 52px;
    --tab-height: 44px;
    --chat-input-height: 60px;
    --radius: 6px;
    --radius-lg: 10px;

    /* status colors */
    --status-idle: #66bb6a;
    --status-working: #4fc3f7;
    --status-error: #ef5350;
    --status-offline: #757575;
    --status-virtual: #ab47bc;
    --status-spawning: #ffa726;
    --status-remote: #26c6da;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* === Scrollbars === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === Header === */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
    display: inline-block;
    flex-shrink: 0;
}

.connection-dot.connected {
    background: var(--status-idle);
}

.connection-dot.reconnecting {
    background: var(--status-spawning);
    animation: pulse 1.5s infinite;
}

.user-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-logout {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
    font-size: 11px;
    padding: 3px 10px;
}

.btn-logout:hover {
    color: var(--error);
    border-color: var(--error);
}

/* === Hamburger === */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* === Layout === */
#app {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    overflow: hidden;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Sidebar Sections === */
.sidebar-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-section:first-child {
    flex: 1;
    min-height: 0;
}

.sidebar-system {
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* === System Nav === */
.system-nav {
    padding: 8px;
}

.system-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: background 0.15s;
}

.system-nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.system-nav-item.selected {
    background: rgba(79,195,247,0.1);
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.agent-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.agent-card:hover {
    border-color: var(--accent);
    background: #243352;
}

.agent-card.selected {
    border-color: var(--accent);
    background: #1a3050;
    box-shadow: inset 3px 0 0 var(--accent);
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.agent-card-name {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* === Agent Card Status Row === */
.agent-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.agent-status-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.agent-model {
    font-size: 13px;
    color: var(--text-secondary);
}

/* === Status Dot === */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.idle { background: var(--status-idle); }
.status-dot.working {
    background: var(--status-working);
    animation: pulse 1.5s infinite;
}
.status-dot.error { background: var(--status-error); }
.status-dot.offline { background: var(--status-offline); }
.status-dot.virtual { background: var(--status-virtual); }
.status-dot.spawning {
    background: var(--status-spawning);
    animation: pulse 1.5s infinite;
}
.status-dot.remote { background: var(--status-remote); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Badge === */
.badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-model {
    background: #2a3a55;
    color: var(--accent);
}

.badge-remote {
    background: var(--status-remote);
    color: #000;
    margin-left: 4px;
}

.badge-remotei {
    background: var(--status-virtual);
    color: #fff;
    margin-left: 4px;
}

.badge-agent-type {
    margin-left: 4px;
    font-size: 9px;
}

.badge-type-planning { background: #7c3aed; color: #fff; }
.badge-type-review { background: #0891b2; color: #fff; }
.badge-type-development { background: #059669; color: #fff; }
.badge-type-orchestrator { background: #dc2626; color: #fff; }
.badge-type-action { background: #d97706; color: #fff; }

.agent-meta-row { font-size: 11px; color: var(--text-secondary); padding: 1px 0 1px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-meta-icon { margin-right: 4px; font-size: 10px; }

.badge-cost {
    color: var(--text-secondary);
}

/* === Main Panel === */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
}

.agent-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* === Agent Header === */
.agent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    z-index: 10;
}

.btn-back {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.agent-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.agent-header-name {
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-header-actions {
    display: flex;
    gap: 8px;
}

/* === Tabs === */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* === Tab Content === */
.tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-pane {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-pane.hidden {
    display: none;
}

/* === System Views === */
.system-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.system-view.hidden {
    display: none !important;
}

.system-view-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.system-view-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* === Chat === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 3px;
}

.chat-msg.agent {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 3px;
}

.chat-msg.system {
    align-self: center;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
    max-width: 90%;
    text-align: center;
}

.chat-msg .msg-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.chat-msg.user .msg-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-msg code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

.chat-msg pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.4;
}

.chat-msg pre code {
    background: none;
    padding: 0;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    min-width: 0;
}

.chat-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 10px 12px;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
}

.chat-input:focus {
    border-color: var(--accent);
}

.btn-send {
    align-self: flex-end;
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 2px;
}

.filter-btn {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.filter-select {
    padding: 5px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    outline: none;
}

.filter-select:focus {
    border-color: var(--accent);
}

/* === Report List === */
.report-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.report-card:hover {
    border-color: var(--accent);
}

.report-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.report-card-title {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-card-body {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: none;
}

.report-card.expanded .report-card-body {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.report-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Session Stats */
.session-summary {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

.session-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.session-stat-group {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 8px 10px;
}

.session-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.session-stat {
    font-size: 13px;
    color: var(--text-primary);
    padding: 1px 0;
}

.session-errors {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(198, 40, 40, 0.1);
    border-radius: 6px;
}

/* Severity Badges */
.badge-severity {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    text-transform: uppercase;
}

.badge-severity.critical {
    background: var(--error);
    color: #fff;
}

.badge-severity.high {
    background: var(--warning);
    color: #000;
}

.badge-severity.medium {
    background: #ffee58;
    color: #000;
}

.badge-severity.low {
    background: var(--success);
    color: #000;
}

/* Status Chips */
.badge-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    text-transform: uppercase;
}

.badge-status.new {
    background: var(--accent);
    color: #000;
}

.badge-status.in-progress {
    background: var(--warning);
    color: #000;
}

.badge-status.complete {
    background: var(--success);
    color: #000;
}

.badge-status.wont-fix, .badge-status.wontfix {
    background: #6b7280;
    color: #fff;
}

.badge-plan-status { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-plan-status.planning { background: #7c3aed; color: #fff; }
.badge-plan-status.review { background: #0891b2; color: #fff; }
.badge-plan-status.ready { background: #059669; color: #fff; }
.badge-plan-status.development { background: #d97706; color: #fff; }
.badge-plan-status.completed { background: #6b7280; color: #fff; }

.plan-checklist { list-style: none; padding: 0; margin: 8px 0 0 0; }
.plan-checklist li { padding: 4px 0; color: var(--text-secondary); font-size: 13px; }
.plan-checklist li.checked { text-decoration: line-through; opacity: 0.6; }
.plan-checklist li::before { content: '☐ '; }
.plan-checklist li.checked::before { content: '☑ '; }
.plan-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.plan-meta span { margin-right: 12px; }
.plan-progress { font-size: 11px; color: var(--text-secondary); margin-left: 8px; }

/* Error count badge */
.badge-error-count {
    background: var(--error);
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* Session card extras */
.session-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* === Config Form === */
.config-form {
    padding: 20px 16px;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* Toggle switch */
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-primary) !important;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 38px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(18px);
    background: #fff;
}

/* === Config Actions === */
.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* === Activity Feed === */
.activity-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.activity-entry {
    display: flex;
    gap: 14px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.activity-entry .activity-time {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
    min-width: 80px;
    font-family: monospace;
}

.activity-entry .activity-agent {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
    min-width: 110px;
}

.activity-entry .activity-summary {
    color: var(--text-primary);
    flex: 1;
    font-size: 14px;
}

.activity-entry.type-agentcrashed .activity-summary,
.activity-entry.type-agentstopped .activity-summary {
    color: var(--error);
}

.activity-entry.type-webhookreceived .activity-agent {
    color: var(--warning);
}

.activity-entry.type-reportcreated .activity-agent {
    color: var(--status-virtual);
}

/* === Buttons === */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-accent {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-warning {
    background: transparent;
    color: var(--warning);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: #000;
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* === Utility === */
.hidden {
    display: none !important;
}

/* === Login Page === */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
}

.login-title {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}

.login-error {
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.google-btn-wrapper {
    display: flex;
    justify-content: center;
}

.login-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Sidebar Overlay (mobile) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
}

.sidebar-overlay.visible {
    display: block;
}

/* === Toast Notifications === */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-info { background: #1565c0; }
.toast-success { background: #2e7d32; }
.toast-error { background: #c62828; }
.toast-warning { background: #e65100; }

/* === Mobile Responsive === */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 85%;
        max-width: 340px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .btn-back {
        display: block;
    }

    .chat-msg {
        max-width: 90%;
    }

    .tab {
        padding: 10px 14px;
        font-size: 12px;
    }

    .filter-bar {
        padding: 8px 12px;
        gap: 6px;
    }

    .filter-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .chat-input-area {
        padding: 8px 12px;
        gap: 6px;
    }

    .chat-input {
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }

    .btn-send {
        flex-shrink: 0;
        padding: 8px 12px;
    }

    .report-list {
        padding: 10px 12px;
    }

    .config-form {
        padding: 16px 12px;
    }
}
