/* Mission Control Dashboard Styles */
/* Mobile-first dark theme with native app feel */
/* Target: Samsung S25 Ultra (~430px width) */

/* ===== CSS VARIABLES (Theme Support) ===== */
:root {
    /* Dark theme (default) */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: #1f1f35;
    --bg-hover: #2a2a45;
    
    --accent: #e94560;
    --accent-hover: #ff6b8a;
    --accent-dim: rgba(233, 69, 96, 0.2);
    
    --success: #00d26a;
    --warning: #ffc107;
    --info: #4ecdc4;
    --purple: #a855f7;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c7c;
    
    --border: #2a2a40;
    --border-light: #3a3a55;
    
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Layout */
    --bottom-nav-height: 60px;
    --header-height: 56px;
    --bob-summary-height: 72px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f5;
    
    --accent: #e94560;
    --accent-hover: #d63653;
    --accent-dim: rgba(233, 69, 96, 0.15);
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;
    
    --border: #e0e0e8;
    --border-light: #d0d0d8;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Status Indicator (Subtle) */
.status-indicator {
    display: flex;
    align-items: center;
    padding: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.loading {
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.theme-icon {
    font-size: 1.125rem;
}

/* Refresh Button */
.btn-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-refresh.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== PULL TO REFRESH ===== */
.pull-refresh-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: transform 0.2s;
}

.pull-refresh-indicator.visible {
    display: flex;
}

.pull-refresh-indicator.refreshing .pull-refresh-spinner {
    animation: spin 0.8s linear infinite;
}

.pull-refresh-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin-bottom: 8px;
    transition: transform 0.2s;
}

.pull-refresh-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== BOB SUMMARY ROW (Compact Chips) ===== */
.bob-summary-row {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    min-height: var(--bob-summary-height);
}

.bob-summary-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
}

.bob-summary-chips::-webkit-scrollbar {
    display: none;
}

.bob-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    min-width: 0;
}

.bob-chip:hover, .bob-chip:active {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: scale(0.98);
}

.bob-chip-emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.bob-chip-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pulsing Status Dots (#8) */
.bob-chip-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bob-chip-status.active {
    background: var(--success);
    animation: statusPulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 210, 106, 0.6);
}

.bob-chip-status.idle {
    background: var(--warning);
}

.bob-chip-status.error {
    background: var(--accent);
}

.bob-chip-status.offline {
    background: var(--text-muted);
}

@keyframes statusPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

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

/* Loading dots */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 12px;
    padding-bottom: calc(var(--bottom-nav-height) + 80px + var(--safe-area-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

/* ===== COLLAPSIBLE SECTIONS (#6) ===== */
.collapsible-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

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

.collapse-chevron {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.collapsible-section.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 16px 16px;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.section-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-filters {
    display: flex;
    gap: 8px;
}

.filter-select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    outline: none;
    min-height: 36px;
}

.filter-select:focus {
    border-color: var(--accent);
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

/* ===== ACTIVITY FEED ===== */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.activity-item:active {
    background: var(--bg-hover);
}

.activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-icon.commit { background: var(--accent-dim); }
.activity-icon.task { background: rgba(0, 210, 106, 0.2); }
.activity-icon.event { background: rgba(78, 205, 196, 0.2); }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.activity-meta {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ===== FLOATING ACTION BUTTON (FAB) (#3) ===== */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px + var(--safe-area-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
    z-index: 40;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab.open {
    transform: rotate(45deg);
}

.fab-icon {
    transition: transform 0.3s ease;
}

/* FAB Menu (Bottom Sheet) */
.fab-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.fab-menu.open {
    display: block;
}

.fab-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.fab-menu-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    animation: slideUp 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.fab-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.fab-menu-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.fab-menu-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.fab-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.fab-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
}

.fab-action-btn:hover, .fab-action-btn:active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(0.98);
}

.fab-action-icon {
    font-size: 1.5rem;
}

.fab-action-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

/* ===== BOTTOM NAVIGATION (#1) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    z-index: 60;
    max-width: 600px;
    margin: 0 auto;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 4px;
    min-width: 0;
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 1.375rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ===== MORE DRAWER (#1) ===== */
.more-drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.more-drawer.open {
    display: block;
}

.more-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.more-drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    animation: slideUp 0.3s ease;
}

.more-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.more-drawer-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.more-drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.more-drawer-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.more-item:hover, .more-item:active {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: scale(0.98);
}

.more-icon {
    font-size: 1.75rem;
}

.more-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ===== CIRCULAR CONTEXT GAUGES (#9) ===== */
.context-gauge {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.context-gauge svg {
    transform: rotate(-90deg);
}

.context-gauge-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.context-gauge-fill {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s;
}

.context-gauge-fill.low { stroke: var(--success); }
.context-gauge-fill.medium { stroke: var(--warning); }
.context-gauge-fill.high { stroke: var(--accent); }

.context-gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.625rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
}

.modal.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Bottom Sheet Modal */
.modal-bottom-sheet {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.modal-body pre {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== BOB DETAIL MODAL ===== */
.bob-detail-card {
    padding: 16px;
}

.bob-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.bob-detail-emoji {
    font-size: 2.5rem;
}

.bob-detail-info h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.bob-detail-channel {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.bob-detail-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.bob-detail-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.bob-detail-status-dot.active {
    background: var(--success);
    animation: statusPulse 2s ease-in-out infinite;
}

.bob-detail-status-dot.idle {
    background: var(--warning);
}

.bob-detail-status-dot.error {
    background: var(--accent);
}

.bob-detail-status-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.bob-detail-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.bob-detail-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bob-metric-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bob-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 80px;
}

.bob-metric-value {
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ===== SEARCH ===== */
.search-header {
    margin-bottom: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    min-width: 0;
}

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

.search-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-checkbox input {
    accent-color: var(--accent);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-emoji {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===== CALENDAR ===== */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.current-week {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.calendar-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
}

.calendar-day.today {
    border-color: var(--accent);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.day-header .day-date {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-day.today .day-date {
    color: var(--accent);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-event {
    padding: 8px;
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-event:active {
    background: rgba(233, 69, 96, 0.3);
}

/* ===== EVENT DETAIL PANEL ===== */
.event-detail-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: right 0.3s ease;
    z-index: 100;
}

.event-detail-panel.open {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-content {
    padding: 16px;
    color: var(--text-secondary);
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== BOB CHAT TAB ===== */
.bob-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: calc(100vh - 200px);
    min-height: 400px;
    padding: 16px;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    position: relative;
}

/* Header / Selector */
.bob-chat-header {
    width: 100%;
    max-width: 400px;
}

.bob-chat-selector {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.bob-chat-selector:focus {
    border-color: var(--accent);
}

/* Avatar */
.bob-chat-avatar {
    --ring-opacity: 0.2;
    --ring-scale: 1;
    --ring-blur: 15px;
    --ring-color: 59, 130, 246;
    position: relative;
    width: 180px;
    height: 180px;
    min-width: 180px;
    min-height: 180px;
    max-width: 180px;
    max-height: 180px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.bob-chat-avatar::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--ring-color), 0.4) 0%, rgba(var(--ring-color), 0) 70%);
    opacity: var(--ring-opacity);
    transform: scale(var(--ring-scale));
    filter: blur(var(--ring-blur));
    transition: opacity 0.1s, transform 0.1s;
    pointer-events: none;
    z-index: 0;
}

.bob-chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(var(--ring-color), 0.3);
    position: relative;
    z-index: 1;
}

/* Status */
.bob-chat-status {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 1.4em;
    transition: color 0.2s;
}

.bob-chat-status--recording {
    color: #ef4444;
    font-weight: 600;
}

.bob-chat-status--thinking {
    color: #a855f7;
}

.bob-chat-status--speaking {
    color: #3b82f6;
}

/* Audio Unlock Button (Mobile) */
.bob-chat-audio-unlock {
    display: none;
    padding: 10px 20px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    color: #3b82f6;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.bob-chat-audio-unlock:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* Messages */
.bob-chat-messages {
    flex: 1;
    width: 100%;
    max-width: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    min-height: 0;
}

.bob-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
    text-align: center;
}

.bob-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
    animation: bobChatMsgIn 0.2s ease-out;
}

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

.bob-chat-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bob-chat-msg--bot {
    align-self: flex-start;
    background: rgba(168, 85, 247, 0.15);
    color: var(--text);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-bottom-left-radius: 4px;
}

/* Controls */
.bob-chat-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.bob-chat-mic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.bob-chat-mic:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(59, 130, 246, 0.4);
}

.bob-chat-mic:active:not(:disabled),
.bob-chat-mic.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    transform: scale(0.95);
    box-shadow: 0 2px 16px rgba(239, 68, 68, 0.4);
}

.bob-chat-mic:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bob-chat-clear {
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.bob-chat-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* API Notice */
.bob-chat-api-notice {
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 12px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.bob-chat-api-notice p {
    margin: 0;
}

.bob-chat-api-notice button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8125rem;
    text-decoration: underline;
    padding: 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .bob-chat {
        padding: 12px 8px;
        height: calc(100vh - 180px);
    }

    .bob-chat-avatar {
        width: 120px;
        height: 120px;
        min-width: 120px;
        min-height: 120px;
        max-width: 120px;
        max-height: 120px;
    }

    .bob-chat-mic {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    .bob-chat-mic {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
}

/* ===== SESSIONS ===== */
.sessions-panel {
    padding: 0;
}

.sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sessions-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.sessions-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.session-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.filter-btn:hover:not(.active) {
    background: var(--bg-hover);
}

.filter-count {
    opacity: 0.7;
    margin-left: 4px;
}

.session-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-sort label {
    display: none;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== KANBAN BOARD ===== */
.kanban-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
}

.kanban-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
}

/* On wider screens, show horizontal columns */
@media (min-width: 768px) {
    .kanban-board {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .kanban-column {
        min-width: 280px;
        flex: 1;
    }
}

/* ===== COST TRACKER ===== */
.cost-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.cost-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.cost-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.cost-amount {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.cost-amount.cost-low { color: var(--success); }
.cost-amount.cost-medium { color: var(--warning); }
.cost-amount.cost-high { color: var(--accent); }

.cost-tokens {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 20px + var(--safe-area-bottom));
    left: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-hiding {
    opacity: 0;
    transform: translateY(20px);
}

.toast-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--accent); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ===== FORM STYLES ===== */
.qa-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-height: 44px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== UPDATE TIME ===== */
.update-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ===== DATA FRESHNESS BADGES ===== */
.freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-xl);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.freshness-badge.fresh {
    background: rgba(0, 210, 106, 0.15);
    color: var(--success);
}

.freshness-badge.stale {
    background: rgba(255, 193, 7, 0.15);
    color: var(--warning);
}

.freshness-badge.outdated {
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

/* ===== TOKEN BREAKDOWN ===== */
.token-breakdown {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.token-item {
    flex: 1;
    text-align: center;
}

.token-label {
    display: block;
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.token-value {
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ===== MODEL USAGE BARS ===== */
.model-breakdown {
    margin-bottom: 20px;
}

.section-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.model-bar-container {
    margin-bottom: 12px;
}

.model-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.model-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.model-cost {
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.model-bar-track {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.model-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

/* ===== WEEKLY USAGE CHART (Horizontal Bars) ===== */
.weekly-chart {
    margin-top: 16px;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-bar {
    display: grid;
    grid-template-columns: 40px 1fr 50px;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.chart-bar.today {
    background: var(--accent-dim);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    margin: 0 -10px;
}

.chart-bar-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.chart-bar.today .chart-bar-label {
    color: var(--accent);
    font-weight: 600;
}

.chart-bar-track {
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 10px;
    transition: width 0.5s ease-out;
}

.chart-bar.today .chart-bar-fill {
    background: linear-gradient(90deg, var(--accent), #ff8fa3);
}

.chart-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-align: right;
}

.chart-bar.today .chart-bar-value {
    color: var(--accent);
}

.no-data {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== BOB CHIPS (simple pills, tap to open detail) ===== */

.bob-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}

.bob-action-btn:hover {
    background: var(--accent-hover);
}

.bob-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.bob-tg-link {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
    text-align: center;
}

.bob-tg-link:hover {
    background: var(--bg-card);
}

/* ===== BOB MESSAGE MODAL ===== */
.bob-message-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.bob-message-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bob-message-textarea:focus {
    border-color: var(--accent);
}

.bob-message-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bob-msg-send-btn {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
}

.bob-msg-send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.bob-msg-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bob-msg-tg-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #0088cc;
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 40px;
}

.bob-msg-tg-link:hover {
    background: #006699;
}

.bob-message-status {
    font-size: 0.85rem;
    min-height: 20px;
    text-align: center;
}

.bob-message-status.success {
    color: #00ff88;
}

.bob-message-status.error {
    color: #e94560;
}

/* ===== QUICK SEARCH MODAL ===== */
.search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 1rem;
}

.search-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

.quick-search-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}

.quick-search-modal.open {
    display: flex;
}

.quick-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.15s ease;
}

.quick-search-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
    overflow: hidden;
}

.quick-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.quick-search-header svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.quick-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

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

.quick-search-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.quick-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.quick-search-group {
    margin-bottom: 16px;
}

.quick-search-group-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px;
}

.quick-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}

.quick-search-item:hover, .quick-search-item.selected {
    background: var(--bg-hover);
}

.quick-search-item-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

.quick-search-item-content {
    flex: 1;
    min-width: 0;
}

.quick-search-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-search-item-path {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.quick-search-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-emoji {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

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

/* ===== DESKTOP ADJUSTMENTS ===== */
@media (min-width: 768px) {
    .dashboard {
        max-width: 800px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .bottom-nav {
        max-width: 800px;
    }
    
    .bob-summary-chips {
        justify-content: center;
    }
    
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 8px;
    }
    
    .calendar-day {
        min-height: 120px;
    }
    
    .modal-bottom-sheet {
        top: 50%;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 500px;
        border-radius: var(--radius-lg);
        animation: modalIn 0.2s ease;
    }
    
    .event-detail-panel {
        width: 400px;
        right: -400px;
    }
}

/* ===== CFO CENTER STYLES ===== */
.cfo-container {
    padding: 12px;
}

.cfo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cfo-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cfo-header-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.cfo-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cfo-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.cfo-refresh-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.cfo-refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

/* Portfolio Overview Card */
.cfo-portfolio-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.portfolio-health {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.health-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.health-indicator {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.portfolio-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.portfolio-stat {
    text-align: center;
}

.portfolio-stat .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.portfolio-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.portfolio-debt {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

.debt-label {
    color: var(--text-muted);
}

.debt-value {
    color: var(--warning);
    font-weight: 600;
}

/* Section Styling */
.cfo-section {
    margin-bottom: 20px;
}

.cfo-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-left: 4px;
}

/* Company Cards Grid */
.cfo-companies-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Company Card */
.cfo-company-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--company-color, var(--accent));
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s;
}

.cfo-company-card:hover {
    border-color: var(--company-color, var(--accent));
    background: var(--bg-hover);
}

.cfo-company-card.expanded {
    border-color: var(--company-color, var(--accent));
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    cursor: pointer;
}

.company-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.company-name-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

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

.company-status {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.company-revenue {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.company-card-metrics {
    display: flex;
    gap: 16px;
    padding: 0 12px 10px 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.company-card-metrics .metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.company-card-metrics .metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.company-card-metrics .metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.company-card-metrics .metric-value.negative {
    color: var(--accent);
}

.company-card-expand {
    text-align: center;
    padding: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* Expanded Card Content */
.company-card-expanded {
    padding: 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.expanded-section {
    margin-bottom: 12px;
}

.expanded-section:last-child {
    margin-bottom: 0;
}

.expanded-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.expanded-section p {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.key-facts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.key-facts-list li {
    font-size: 0.8rem;
    color: var(--text-primary);
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.key-facts-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--info);
}

.company-alerts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.company-alerts-list li {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.company-alerts-list li.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    color: var(--warning);
}

.company-alerts-list li.alert-critical {
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
}

/* Alerts Section */
.cfo-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cfo-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.cfo-alert.alert-critical {
    border-left: 3px solid var(--accent);
    background: rgba(233, 69, 96, 0.08);
}

.cfo-alert.alert-warning {
    border-left: 3px solid var(--warning);
    background: rgba(255, 193, 7, 0.08);
}

.cfo-alert.alert-info {
    border-left: 3px solid var(--info);
    background: rgba(78, 205, 196, 0.08);
}

.alert-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.alert-company {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

/* Quick Actions */
.cfo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cfo-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.cfo-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.cfo-action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.cfo-action-btn.primary:hover {
    background: var(--accent-hover);
}

.action-icon {
    font-size: 1.25rem;
}

.action-label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* CFO Desktop Adjustments */
@media (min-width: 768px) {
    .cfo-container {
        padding: 20px;
    }
    
    .portfolio-stats {
        gap: 24px;
    }
    
    .cfo-companies-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .cfo-actions {
        flex-direction: row;
    }
    
    .cfo-action-btn {
        flex: 1;
        justify-content: center;
    }
}

/* ========================================
   Gateway Status Indicator
   ======================================== */

.gateway-status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.gateway-status-indicator:hover {
    background: var(--bg-hover, rgba(255,255,255,0.08));
}

.gateway-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.gateway-dot.gw-connected {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.gateway-dot.gw-disconnected {
    background: #6b7280;
}

.gateway-dot.gw-error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
    animation: gw-pulse-error 2s ease-in-out infinite;
}

.gateway-dot.gw-unknown {
    background: #f59e0b;
    animation: gw-pulse-unknown 1.5s ease-in-out infinite;
}

@keyframes gw-pulse-error {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes gw-pulse-unknown {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ========================================
   Settings Modal Extras
   ======================================== */

.token-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.token-input-row input {
    flex: 1;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary, #888);
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover, rgba(255,255,255,0.08));
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-color, #e94560);
    color: var(--accent-color, #e94560);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.btn-outline:hover {
    background: var(--accent-color, #e94560);
    color: white;
}

.settings-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bg-secondary, rgba(255,255,255,0.04));
    margin: 12px 0;
}

.settings-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.settings-status-dot.gw-connected {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.settings-status-dot.gw-disconnected {
    background: #6b7280;
}

.settings-status-dot.gw-error {
    background: #ef4444;
}

.settings-status-dot.gw-unknown {
    background: #f59e0b;
}

.settings-status-text {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}
