:root {
    /* Cores Principais - Esquema Verde Moderno */
    --primary-color: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --primary-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);
    
    /* Cores de Superfície */
    --bg-color: #f0fdf4;
    --surface-color: #ffffff;
    --surface-elevated: #ffffff;
    --surface-hover: #f8fafc;
    
    /* Cores de Texto */
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Cores de Estado */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Bordas e Sombras */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 40px -10px rgba(5, 150, 105, 0.3);
    
    /* Espaçamento e Tamanhos */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Animações */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Identidade do painel operacional */
    --ink: #14251d;
    --canvas: #f3f6f1;
    --forest: #0d5c40;
    --lime: #b9d85b;
    --choice: #286a76;
    --text-metric: #735c9e;
    --mono: 'IBM Plex Mono', Consolas, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--canvas);
    background-image:
        linear-gradient(rgba(13, 92, 64, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(13, 92, 64, 0.035) 1px, transparent 1px);
    background-size: 32px 32px;
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 80px;
    min-height: 100vh;
}

/* ========================================
   TOPBAR MODERNA
   ======================================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-brand h1 {
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ícone Moderno */
.topbar-brand h1::before {
    content: '🚛';
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.topbar-nav {
    display: flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.1);
    padding: 0.4rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.7rem 1.3rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow);
    font-weight: 700;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========================================
   STATUS BADGE MODERNO
   ======================================== */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    letter-spacing: 0.03em;
    margin-left: 1rem;
    backdrop-filter: blur(10px);
    transition: all var(--transition-fast);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.status-CONNECTED .status-dot { 
    background-color: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse-success 2s infinite;
}

.status-DISCONNECTED .status-dot { 
    background-color: var(--danger);
    box-shadow: 0 0 12px var(--danger);
    animation: pulse-danger 2s infinite;
}

.status-CONNECTING .status-dot {
    background-color: var(--warning);
    box-shadow: 0 0 12px var(--warning);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-success {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-danger {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-warning {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* ========================================
   CARDS MODERNOS
   ======================================== */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Q-Item styles corrigidos */
.q-item {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.q-item:hover {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow-sm);
}

.q-text { color: var(--text-main); font-weight: 600; }
.q-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }

/* Queue Stats */
.queue-status-box {
    display: flex;
    gap: 1.5rem;
    background: #f1f5f9;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.q-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.q-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.q-value {
    font-size: 2rem;
    font-weight: 800;
}

/* ========================================
   KPI GRID PREMIUM
   ======================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity var(--transition);
}

.kpi-card:hover { 
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.kpi-card:hover::after {
    opacity: 1;
}

.kpi-card.highlight {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-color: var(--primary-color);
    box-shadow: var(--shadow), 0 0 20px rgba(5, 150, 105, 0.1);
}

.kpi-card.highlight::after {
    opacity: 1;
    background: var(--primary-gradient);
}

.kpi-card.success {
    background: linear-gradient(135deg, var(--success-light) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: var(--success);
}

.kpi-card.success::after {
    opacity: 1;
    background: var(--success);
}

.kpi-card.warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: var(--warning);
}

.kpi-card.warning::after {
    opacity: 1;
    background: var(--warning);
}

.kpi-card.danger {
    background: linear-gradient(135deg, var(--danger-light) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: var(--danger);
}

.kpi-card.danger::after {
    opacity: 1;
    background: var(--danger);
}

.kpi-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.kpi-value.secondary { color: var(--primary-dark); }

.kpi-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.neutral { color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

input, textarea, select {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

/* Results */
.result-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.result-answer-list {
    display: grid;
    gap: 0.45rem;
}

.result-answer-list span {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border-light);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 600;
    text-align: right;
}

.result-answer-list small {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    text-align: left;
}

.rating-pill {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.rating-high { background: var(--primary-light); color: var(--primary-dark); }
.rating-low { background: #fee2e2; color: #dc2626; }

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease-out; }

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 550px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.close-btn {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.chat-messages {
    height: 450px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-size: 0.9rem;
}

.message-bubble.bot {
    align-self: flex-start;
    background: white;
    border: 1px solid var(--border-color);
}

.message-bubble.driver {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
}

/* Tables */
.results-table { width: 100%; border-collapse: collapse; }
.results-table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
}
.results-table td { padding: 1rem; border-bottom: 1px solid var(--border-color); font-size: 0.875rem; }
.results-table tr:hover { background: #f8fafc; }

/* ========================================
   SISTEMA DE NOTIFICAÇÕES (TOAST)
   ======================================== */
.toast-container {
    position: fixed;
    top: 90px;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.4s ease-out;
    border-left: 4px solid;
    font-size: 0.875rem;
    font-weight: 500;
}

.toast.success {
    border-left-color: var(--success);
    background: linear-gradient(90deg, var(--success-light) 0%, white 100%);
}

.toast.error {
    border-left-color: var(--danger);
    background: linear-gradient(90deg, var(--danger-light) 0%, white 100%);
}

.toast.warning {
    border-left-color: var(--warning);
    background: linear-gradient(90deg, var(--warning-light) 0%, white 100%);
}

.toast.info {
    border-left-color: var(--info);
    background: linear-gradient(90deg, var(--info-light) 0%, white 100%);
}

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

.toast-message {
    flex: 1;
    color: var(--text-main);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background: var(--surface-hover);
    color: var(--text-main);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========================================
   COMPONENTES AVANÇADOS
   ======================================== */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    padding-left: 2.75rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    height: 300px;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 999px;
    transition: width var(--transition-slow);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* ========================================
   LOADING STATES
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border-color) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   RESPONSIVE MODERNO
   ======================================== */
@media (max-width: 768px) {
    body {
        padding-top: 126px;
    }

    .topbar {
        height: 116px;
        padding: 0.65rem 0.85rem;
        align-items: stretch;
        flex-direction: column;
        gap: 0.55rem;
    }

    .topbar-brand {
        min-height: 38px;
        justify-content: space-between;
    }

    .topbar-brand h1 {
        font-size: 1.1rem;
    }

    .topbar-brand h1::before {
        font-size: 1.25rem;
    }

    .status-badge {
        gap: 0.4rem;
        margin-left: 0;
        padding: 0.3rem 0.6rem;
        font-size: 0.62rem;
    }

    .status-dot {
        width: 7px;
        height: 7px;
    }

    .topbar-nav {
        width: 100%;
        padding: 0.25rem;
        gap: 0.2rem;
        border-radius: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    .topbar-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-btn {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 0.45rem 0.7rem;
        font-size: 0.72rem;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-row,
    .top-row {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 0.9rem;
    }

    .toast-container {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.75rem;
    }
}

.top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
}

.view-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 0.2rem;
    border-radius: 8px;
}

.view-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.view-btn.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   DASHBOARD SEMÂNTICO
   ======================================== */
.dashboard-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.25rem 0 1.75rem;
    border-bottom: 1px solid rgba(20, 37, 29, 0.14);
    margin-bottom: 1.5rem;
}

.dashboard-intro h2,
.section-heading h2,
.goal-copy h2 {
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.04em;
}

.dashboard-intro h2 {
    max-width: 720px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
}

.dashboard-intro p {
    max-width: 700px;
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.section-kicker,
.summary-label,
.metric-type,
.insight-index,
.last-response-block span {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-kicker {
    display: block;
    color: var(--forest);
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.last-response-block {
    min-width: 180px;
    padding-left: 1.25rem;
    border-left: 3px solid var(--lime);
}

.last-response-block span {
    display: block;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.last-response-block strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--ink);
    font-size: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 2.5rem;
}

.summary-card {
    min-height: 152px;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(20, 37, 29, 0.12);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(20, 37, 29, 0.04);
}

.summary-card-primary {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
}

.summary-card-primary .summary-label,
.summary-card-primary .summary-note {
    color: rgba(255, 255, 255, 0.68);
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1.45;
}

.summary-value {
    color: inherit;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.summary-note {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.question-insights-section {
    margin-bottom: 2.5rem;
}

.dashboard-controls {
    display: grid;
    grid-template-columns: 160px 190px minmax(260px, 1fr) auto;
    gap: 0.8rem;
    align-items: end;
    margin-bottom: 1.1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(20, 37, 29, 0.12);
    border-radius: 6px;
}

.control-field {
    display: grid;
    gap: 0.35rem;
}

.control-field label {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.control-field select {
    width: 100%;
    min-height: 40px;
    padding: 0.55rem 2rem 0.55rem 0.65rem;
    background: #fff;
    border: 1px solid rgba(20, 37, 29, 0.18);
    border-radius: 4px;
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
}

.control-field select:focus-visible,
.btn-filter-reset:focus-visible,
.insight-details summary:focus-visible {
    outline: 3px solid rgba(40, 106, 118, 0.25);
    outline-offset: 2px;
}

.btn-filter-reset {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
    background: var(--ink);
    border: 0;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
}

.filter-summary {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.attention-panel {
    display: grid;
    grid-template-columns: minmax(200px, 0.4fr) minmax(0, 1.6fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding: 1.25rem;
    background: #fdfefa;
    border: 1px solid rgba(20, 37, 29, 0.13);
    border-left: 6px solid var(--lime);
    border-radius: 6px;
}

.attention-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.15rem;
    line-height: 1.25;
}

.attention-list {
    display: grid;
    gap: 0.55rem;
}

.attention-item {
    display: grid;
    grid-template-columns: 8px 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 0.7rem 0.8rem;
    background: #fff;
    border: 1px solid rgba(20, 37, 29, 0.1);
    border-radius: 4px;
}

.attention-signal {
    width: 8px;
    height: 8px;
    margin-top: 0.35rem;
    background: #7a9b34;
    border-radius: 50%;
}

.attention-high .attention-signal { background: #c2413c; }
.attention-medium .attention-signal { background: #c38224; }

.attention-item strong {
    color: var(--ink);
    font-size: 0.78rem;
}

.attention-item p {
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.attention-empty {
    padding: 1rem;
    color: var(--forest);
    font-size: 0.78rem;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.section-heading h2 {
    font-size: clamp(1.45rem, 2.5vw, 2.1rem);
}

.metric-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.metric-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-mark {
    width: 16px;
    height: 4px;
    border-radius: 99px;
}

.legend-mark.rating { background: var(--forest); }
.legend-mark.choice { background: var(--choice); }
.legend-mark.text { background: var(--text-metric); }

.question-insights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.insight-card {
    --metric-color: var(--forest);
    position: relative;
    min-height: 245px;
    padding: 1.25rem 1.25rem 1.2rem 1.6rem;
    background: #fff;
    border: 1px solid rgba(20, 37, 29, 0.13);
    border-radius: 6px;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--metric-color);
}

.insight-card[data-kind="choice"] { --metric-color: var(--choice); }
.insight-card[data-kind="text"] { --metric-color: var(--text-metric); }

.insight-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.insight-index {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.metric-type {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0.25rem 0.5rem;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 600;
}

.metric-type-rating { color: var(--forest); }
.metric-type-choice { color: var(--choice); }
.metric-type-text { color: var(--text-metric); }

.insight-question {
    min-height: 52px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.42;
}

.insight-question-number {
    display: none;
}

.insight-main {
    margin-top: 1.15rem;
}

.insight-value {
    color: var(--ink);
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
}

.insight-value-unit {
    margin-left: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.insight-leading {
    display: block;
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
}

.insight-meta {
    display: block;
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.option-bars {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.option-label {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-percentage {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.68rem;
}

.option-track {
    grid-column: 1 / -1;
    height: 5px;
    background: #e7ece8;
    border-radius: 99px;
    overflow: hidden;
}

.option-fill {
    display: block;
    height: 100%;
    background: var(--metric-color);
    border-radius: inherit;
}

.insight-details {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(20, 37, 29, 0.1);
}

.insight-details summary {
    color: var(--metric-color);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    list-style-position: outside;
}

.insight-details[open] summary {
    margin-bottom: 0.75rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.8fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.analytics-card {
    margin: 0;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(20, 37, 29, 0.04);
}

.analytics-card:hover,
.monthly-goal:hover {
    transform: none;
}

.card-title-group {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.card-title-group h2 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.card-title-group p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.chart-container {
    height: 270px;
    padding: 0.75rem 0 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chart-empty[hidden] {
    display: none;
}

.monthly-goal {
    display: grid;
    grid-template-columns: minmax(220px, 0.5fr) minmax(0, 1.5fr);
    align-items: center;
    gap: 2rem;
    border-radius: 6px;
}

.goal-copy h2 {
    font-size: 1.15rem;
}

.goal-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.progress-bar {
    height: 10px;
    background: #e4e9e5;
}

.progress-bar-fill {
    background: var(--lime);
}

.search-box {
    margin-top: 2rem;
}

.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.results-list.horizontal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.placeholder-text {
    padding: 2rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 1120px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .question-insights-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .dashboard-intro,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .last-response-block {
        min-width: 0;
    }

    .summary-grid,
    .question-insights-grid,
    .analytics-grid,
    .monthly-goal {
        grid-template-columns: 1fr;
    }

    .summary-card {
        min-height: 132px;
    }

    .metric-legend {
        display: grid;
    }
}

@media (max-width: 520px) {
    .dashboard-intro h2 {
        font-size: 2rem;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .summary-card {
        min-height: 124px;
    }

    .summary-value {
        font-size: 2rem;
    }

    .insight-card {
        min-height: 0;
    }

    .header-actions {
        align-items: stretch !important;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
