:root {
    --primary-yellow: #D4A017;
    --primary-yellow-light: #F5E6C8;
    --primary-yellow-dark: #B8860B;
    --dark-gray: #2C2C2C;
    --medium-gray: #5A5A5A;
    --light-gray: #F0F0F0;
    --bg-gray: #F5F5F5;
    --white: #FFFFFF;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --info: #2196F3;
    --border: #E0E0E0;
    --shadow: rgba(0,0,0,0.08);
    --shadow-hover: rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    background: var(--bg-gray);
    color: var(--dark-gray);
    line-height: 1.6;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 260px; height: 100vh;
    background: var(--dark-gray);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.sidebar::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera, Edge */
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo {
    display: flex; align-items: center; gap: 12px;
}
.logo-icon {
    width: 42px; height: 42px;
    background: var(--primary-yellow);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--dark-gray);
}
.logo-text {
    font-size: 15px; font-weight: 700;
    color: var(--white); line-height: 1.3;
}
.logo-text span {
    display: block;
    font-size: 11px; font-weight: 400;
    color: var(--primary-yellow); opacity: 0.8;
}

.nav-menu { padding: 16px 0; }
.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}
.nav-item:hover, .nav-item.active {
    color: var(--white);
    background: rgba(212, 160, 23, 0.1);
}
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px;
}

.nav-section-title {
    padding: 16px 20px 8px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: absolute; bottom: 0; width: 100%;
    background: var(--dark-gray);
}
.user-profile {
    display: flex; align-items: center; gap: 12px;
}
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary-yellow);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--dark-gray); font-size: 14px;
}
.user-info { flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--white); }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    background: var(--white);
    padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--dark-gray); }
.breadcrumb {
    font-size: 13px; color: var(--medium-gray);
}
.breadcrumb a { color: var(--primary-yellow); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.search-box {
    position: relative;
}
.search-box input {
    width: 280px;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-gray);
    transition: var(--transition);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary-yellow);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}
.search-box i {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--medium-gray); font-size: 14px;
}
.topbar-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--medium-gray);
    transition: var(--transition); position: relative;
}
.topbar-btn:hover {
    background: var(--primary-yellow-light);
    border-color: var(--primary-yellow);
    color: var(--primary-yellow-dark);
}
.topbar-btn .notif-dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.content-area { padding: 24px 32px; }

.section { display: none; animation: fadeIn 0.4s ease; }
.section.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    border-color: var(--primary-yellow);
}
.kpi-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.kpi-label {
    font-size: 13px; font-weight: 500;
    color: var(--medium-gray);
}
.kpi-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.kpi-icon.yellow { background: var(--primary-yellow-light); color: var(--primary-yellow-dark); }
.kpi-icon.green { background: #E8F5E9; color: var(--success); }
.kpi-icon.red { background: #FFEBEE; color: var(--danger); }
.kpi-icon.blue { background: #E3F2FD; color: var(--info); }
.kpi-value {
    font-size: 32px; font-weight: 700;
    color: var(--dark-gray); margin-bottom: 4px;
}
.kpi-change {
    font-size: 12px; font-weight: 600;
    display: flex; align-items: center; gap: 4px;
}
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-change.neutral { color: var(--medium-gray); }

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
}
.chart-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.chart-title {
    font-size: 16px; font-weight: 700;
    color: var(--dark-gray);
}
.chart-subtitle {
    font-size: 12px; color: var(--medium-gray);
}
.chart-filter {
    display: flex; gap: 8px;
}
.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--white);
    font-size: 12px; font-weight: 500;
    cursor: pointer; transition: var(--transition);
    font-family: inherit;
}
.filter-btn:hover, .filter-btn.active {
    background: var(--primary-yellow);
    color: var(--white); border-color: var(--primary-yellow);
}
.chart-container { position: relative; height: 280px; }
.chart-container-sm { position: relative; height: 240px; }

.ai-banner {
    position: relative;
    overflow: hidden;
    background: var(--dark-gray);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex; align-items: center; gap: 20px;
    border-left: 4px solid var(--primary-yellow);
}
.ai-banner .ai-icon,
.ai-banner .ai-content,
.ai-banner .ai-actions {
    position: relative;
    z-index: 2;
}
.ai-banner-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 1;
}
.ai-icon {
    width: 48px; height: 48px;
    background: var(--primary-yellow);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--dark-gray);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(212, 160, 23, 0); }
}
.ai-content { flex: 1; }
.ai-title {
    font-size: 15px; font-weight: 700;
    color: var(--white); margin-bottom: 4px;
}
.ai-desc {
    font-size: 13px; color: rgba(255,255,255,0.6);
}
.ai-actions { display: flex; gap: 10px; }
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    font-family: inherit; border: none;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
    background: var(--primary-yellow);
    color: var(--dark-gray);
}
.btn-primary:hover {
    background: var(--primary-yellow-dark);
    color: var(--white);
}
.btn-outline {
    background: transparent;
    color: var(--primary-yellow);
    border: 1px solid var(--primary-yellow);
}
.btn-outline:hover {
    background: var(--primary-yellow);
    color: var(--dark-gray);
}
.btn-sm { padding: 6px 14px; font-size: 12px; }

.table-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.table-header {
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.table-title { font-size: 16px; font-weight: 700; color: var(--dark-gray); }
.table-tools { display: flex; gap: 10px; align-items: center; }
.search-input {
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px; font-family: inherit;
    width: 220px;
    background: var(--bg-gray) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235A5A5A' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
    transition: var(--transition);
}
.search-input:focus {
    outline: none; border-color: var(--primary-yellow);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px; font-family: inherit;
    background: var(--bg-gray);
    cursor: pointer;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--medium-gray);
    background: var(--bg-gray);
    border-bottom: 1px solid var(--border);
    cursor: pointer; user-select: none;
    transition: var(--transition);
}
.data-table th:hover { color: var(--primary-yellow-dark); }
.data-table th i { margin-left: 4px; font-size: 10px; }
.data-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-gray); }
.data-table tr { cursor: pointer; transition: var(--transition); }

.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.status-completed { background: #E8F5E9; color: #2E7D32; }
.status-in-progress { background: #FFF3E0; color: #E65100; }
.status-blocked { background: #FFEBEE; color: #C62828; }
.status-pending { background: #E3F2FD; color: #1565C0; }
.status-dropped { background: #F3E5F5; color: #6A1B9A; }
.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
}

.priority-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px; font-weight: 700;
}
.priority-critical { background: var(--danger); color: var(--white); }
.priority-high { background: #FF5722; color: var(--white); }
.priority-medium { background: var(--warning); color: var(--white); }
.priority-low { background: #9E9E9E; color: var(--white); }

.user-cell {
    display: flex; align-items: center; gap: 12px;
}
.user-cell-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-yellow);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--dark-gray); font-size: 13px;
}
.user-cell-name { font-weight: 600; font-size: 14px; }
.user-cell-dept { font-size: 12px; color: var(--medium-gray); }

.progress-bar {
    width: 100%; height: 6px;
    background: var(--light-gray);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary-yellow);
    border-radius: 3px;
    transition: width 0.6s ease;
}
.progress-text {
    font-size: 12px; font-weight: 600;
    color: var(--medium-gray); margin-top: 4px;
}

.table-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}
.pagination-info { font-size: 13px; color: var(--medium-gray); }
.pagination-btns { display: flex; gap: 6px; }
.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    font-size: 13px; cursor: pointer;
    transition: var(--transition);
}
.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-yellow);
    color: var(--primary-yellow-dark);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-btn.active {
    background: var(--primary-yellow);
    border-color: var(--primary-yellow);
    color: var(--dark-gray); font-weight: 600;
}

.detail-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.detail-back {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 600;
    color: var(--primary-yellow-dark);
    cursor: pointer; text-decoration: none;
}
.detail-back:hover { text-decoration: underline; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.detail-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
}
.detail-card-full { grid-column: 1 / -1; }
.detail-card-title {
    font-size: 15px; font-weight: 700;
    color: var(--dark-gray); margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.detail-card-title i { color: var(--primary-yellow); }
.detail-row {
    display: flex; justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    font-size: 13px; color: var(--medium-gray);
}
.detail-value {
    font-size: 13px; font-weight: 600; color: var(--dark-gray);
}
.detail-value.highlight { color: var(--primary-yellow-dark); }

.ai-suggestion-box {
    background: var(--primary-yellow-light);
    border: 1px solid var(--primary-yellow);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 12px;
}
.ai-suggestion-box .suggestion-title {
    font-size: 13px; font-weight: 700;
    color: var(--primary-yellow-dark); margin-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}
.ai-suggestion-box .suggestion-text {
    font-size: 13px; color: var(--dark-gray); line-height: 1.6;
}

.timeline {
    position: relative;
    padding-left: 28px;
}
.timeline::before {
    content: '';
    position: absolute; left: 8px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -28px; top: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--primary-yellow);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary-yellow);
}
.timeline-dot.completed { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.pending { background: var(--border); box-shadow: 0 0 0 2px var(--border); }
.timeline-time {
    font-size: 12px; color: var(--medium-gray); margin-bottom: 4px;
}
.timeline-text {
    font-size: 13px; color: var(--dark-gray); font-weight: 500;
}

.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; color: var(--dark-gray);
}

@media (max-width: 1200px) {
    .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .overlay {
        display: none; position: fixed;
        inset: 0; background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .overlay.show { display: block; }
}
@media (max-width: 768px) {
    .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
    .search-box input { width: 200px; }
    .content-area { padding: 16px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .table-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .data-table { display: block; overflow-x: auto; }
    .data-table th, .data-table td { white-space: nowrap; }
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 90px;
        height: 420px;
    }
    .ai-chat-trigger {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

.fade-in { animation: fadeIn 0.5s ease forwards; }
.slide-up {
    animation: slideUp 0.5s ease forwards;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.skeleton {
    background: linear-gradient(90deg, var(--light-gray) 25%, var(--bg-gray) 50%, var(--light-gray) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tooltip {
    position: relative;
}
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: var(--dark-gray);
    color: var(--white);
    font-size: 11px; padding: 6px 10px;
    border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: var(--transition);
}
.tooltip:hover::after { opacity: 1; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal.open {
    display: flex;
    opacity: 1;
}
.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.modal-title {
    font-size: 18px; font-weight: 700; color: var(--dark-gray);
}
.close-btn {
    background: none; border: none; font-size: 20px;
    cursor: pointer; color: var(--medium-gray);
    transition: var(--transition);
}
.close-btn:hover { color: var(--danger); }
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--medium-gray); margin-bottom: 8px;
}
.form-control {
    width: 100%; padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    background: var(--bg-gray);
    transition: var(--transition);
}
.form-control:focus {
    outline: none; border-color: var(--primary-yellow);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}

/* --- DARK THEME OVERRIDES --- */
body.dark-theme {
    --bg-gray: #121212;
    --dark-gray: #f5f5f5;
    --medium-gray: #aaaaaa;
    --light-gray: #2a2a2a;
    --white: #ffffff;
    --border: #333333;
    --shadow: rgba(0,0,0,0.3);
    --shadow-hover: rgba(0,0,0,0.5);
    background: #121212;
    color: #e0e0e0;
}
body.dark-theme .topbar {
    background: #1e1e1e;
    border-bottom-color: #333333;
}
body.dark-theme .sidebar {
    background: #0f0f0f;
    border-right: 1px solid #222;
}
body.dark-theme .sidebar-footer {
    background: #0f0f0f;
    border-top-color: #222;
}
body.dark-theme .kpi-card, 
body.dark-theme .chart-card, 
body.dark-theme .table-card, 
body.dark-theme .detail-card,
body.dark-theme .modal-content {
    background: #1e1e1e;
    border-color: #2e2e2e;
}
body.dark-theme .data-table tr:hover td {
    background: #252525;
}
body.dark-theme .data-table td {
    border-bottom-color: #2e2e2e;
}
body.dark-theme .data-table th {
    background: #1a1a1a;
    color: #aaa;
    border-bottom-color: #2e2e2e;
}
body.dark-theme .form-control {
    background: #2a2a2a;
    color: #fff;
    border-color: #444;
}
body.dark-theme .form-control:focus {
    background: #1e1e1e;
}
body.dark-theme .search-input {
    background-color: #2a2a2a;
    color: #fff;
    border-color: #444;
}
body.dark-theme .filter-select {
    background: #2a2a2a;
    color: #fff;
    border-color: #444;
}
body.dark-theme .ai-suggestion-box {
    background: rgba(212, 160, 23, 0.15);
    border-color: var(--primary-yellow-dark);
}
body.dark-theme .ai-suggestion-box .suggestion-text {
    color: #e0e0e0;
}
body.dark-theme .timeline::before {
    background: #333;
}
body.dark-theme .timeline-dot {
    border-color: #1e1e1e;
}

/* --- AI CHAT ASSISTANT --- */
.ai-chat-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dark-gray), #1a1a1a);
    border: 2px solid var(--primary-yellow);
    color: var(--primary-yellow);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1900;
    transition: var(--transition);
}
.ai-chat-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px rgba(212, 160, 23, 0.4);
    background: var(--primary-yellow);
    color: var(--dark-gray);
}
.ai-chat-trigger .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 10px;
    border: 2px solid var(--dark-gray);
}
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1900;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}
.ai-chat-header {
    background: linear-gradient(135deg, var(--dark-gray), #1c1c1c);
    color: var(--white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary-yellow);
}
.ai-chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ai-chat-header-title i {
    font-size: 20px;
    color: var(--primary-yellow);
    animation: pulse 2s infinite;
}
.ai-chat-header-title div {
    display: flex;
    flex-direction: column;
}
.ai-chat-header-title strong {
    font-size: 15px;
    letter-spacing: 0.5px;
}
.ai-chat-header-title span {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}
.ai-chat-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}
.ai-chat-close:hover {
    color: var(--danger);
}
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: slideUp 0.3s ease forwards;
}
.chat-message.ai {
    background: rgba(240, 240, 240, 0.9);
    color: var(--dark-gray);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0,0,0,0.05);
}
body.dark-theme .chat-message.ai {
    background: rgba(45, 45, 45, 0.9);
    color: #e0e0e0;
    border-color: rgba(255,255,255,0.05);
}
.chat-message.user {
    background: var(--primary-yellow);
    color: var(--dark-gray);
    font-weight: 500;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(212, 160, 23, 0.2);
}
.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.suggestion-chip {
    background: var(--white);
    color: var(--primary-yellow-dark);
    border: 1px solid var(--primary-yellow);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}
.suggestion-chip:hover {
    background: var(--primary-yellow-light);
    transform: translateY(-2px);
}
body.dark-theme .suggestion-chip {
    background: #2a2a2a;
    color: var(--primary-yellow);
}
.ai-chat-input-area {
    padding: 12px 16px;
    background: rgba(255,255,255,0.95);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}
body.dark-theme .ai-chat-input-area {
    background: rgba(30, 30, 30, 0.95);
    border-top-color: #333;
}
.ai-chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-gray);
    transition: var(--transition);
}
body.dark-theme .ai-chat-input-area input {
    background: #2a2a2a;
    color: #fff;
    border-color: #444;
}
.ai-chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-yellow);
    background: var(--white);
}
body.dark-theme .ai-chat-input-area input:focus {
    background: #1e1e1e;
}
.ai-chat-input-area button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-yellow);
    color: var(--dark-gray);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.ai-chat-input-area button:hover {
    background: var(--primary-yellow-dark);
    color: var(--white);
    transform: scale(1.05);
}
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--medium-gray);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    opacity: 0.6;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--dark-gray);
    color: var(--white);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-yellow);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 280px;
    max-width: 360px;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
.toast.success { border-left-color: var(--success); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }
.toast i { font-size: 16px; }
.toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
}
.toast-close:hover { opacity: 1; }
body.dark-theme .toast {
    background: #1e1e1e;
    color: #fff;
    border-color: #333;
}

/* ==========================================================================
   PHASE 2 PREMIUM FEATURES CUSTOM STYLES
   ========================================================================== */

/* --- TOGGLE SWITCH (Simulation Settings) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--white);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
input:checked + .slider {
    background-color: var(--primary-yellow);
}
input:checked + .slider:before {
    transform: translateX(22px);
}
body.dark-theme .slider {
    background-color: #444;
}

/* --- SETTINGS CUSTOM STYLES --- */
.settings-status-box {
    border: 1px solid var(--border);
    transition: var(--transition);
}
body.dark-theme .settings-status-box {
    background: #222 !important;
    border-color: #333;
    color: #eee;
}

/* --- REPORTS CUSTOM STYLES --- */
.report-paper {
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    color: #1a1a1a;
    background: var(--white);
}
body.dark-theme .report-paper {
    background: #1e1e1e;
    color: #eee;
    border-color: #333;
}
body.dark-theme .report-paper h2,
body.dark-theme .report-paper h3,
body.dark-theme .report-paper h4 {
    color: #fff !important;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.report-table th {
    background-color: #f7f7f7;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
    text-align: left;
    padding: 10px 12px;
}
body.dark-theme .report-table th {
    background-color: #2b2b2b;
    color: #eee;
    border-bottom-color: #444;
}
.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}
body.dark-theme .report-table td {
    border-bottom-color: #333;
}
.report-table tbody tr:hover {
    background-color: rgba(0,0,0,0.01);
}
body.dark-theme .report-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

.report-kpi-card {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
body.dark-theme .report-kpi-card {
    background: #252525;
    border-color: #333;
}
.report-kpi-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-yellow-dark);
    margin-top: 4px;
}

.report-bulletin {
    background: #fffdf6;
    border-left: 4px solid var(--primary-yellow);
    padding: 14px 16px;
    border-radius: 4px;
    font-size: 13.5px;
    margin-bottom: 12px;
    line-height: 1.6;
}
body.dark-theme .report-bulletin {
    background: #2b281f;
    color: #eee;
}

/* Markdown formatting in AI dynamic output */
.markdown-body ul, .markdown-body ol {
    margin-left: 24px;
    margin-bottom: 12px;
}
.markdown-body li {
    margin-bottom: 6px;
}
.markdown-body h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 700;
}
.markdown-body p {
    margin-bottom: 12px;
}

/* --- PRINT MEDIA QUERY --- */
@media print {
    /* Hide navigation sidebar, topbar, overlay, modal, chatbot button, actions bar and prompts */
    .sidebar,
    .topbar,
    .overlay,
    .modal,
    .ai-chat-trigger,
    .ai-chat-window,
    .toast-container,
    .report-actions-bar,
    .table-card,
    #reportPromptBox,
    .detail-header,
    nav {
        display: none !important;
    }
    
    /* Reset main layout margins */
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        min-height: auto !important;
    }
    .content-area {
        padding: 0 !important;
    }
    
    /* Show reports section exclusively and force print style */
    body * {
        visibility: hidden;
    }
    #reports, #reports * {
        visibility: visible;
    }
    #reports {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        display: block !important;
    }
    .report-paper {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        background: white !important;
        color: black !important;
    }
    
    /* Ensure background graphics are printed */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* --- AI AGENT PREMIUM STYLES --- */
.agent-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    transition: var(--transition);
}
.agent-step.pending {
    opacity: 0.45;
}
.agent-step.active {
    border-color: var(--primary-yellow);
    background: rgba(212, 160, 23, 0.04);
    box-shadow: 0 0 12px rgba(212, 160, 23, 0.1);
    transform: translateX(4px);
}
.agent-step.completed {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.03);
}

.step-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
}
.agent-step.pending .step-icon {
    background: var(--light-gray);
    color: var(--medium-gray);
}
.agent-step.active .step-icon {
    background: var(--primary-yellow);
    color: var(--dark-gray);
    box-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}
.agent-step.completed .step-icon {
    background: var(--success);
    color: var(--white);
}

.step-details {
    flex: 1;
}
.step-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--dark-gray);
    margin-bottom: 2px;
}
.step-desc {
    font-size: 11.5px;
    color: var(--medium-gray);
}
body.dark-theme .agent-step {
    background: #1e1e1e;
    border-color: #333;
}
body.dark-theme .agent-step.active {
    background: rgba(212, 160, 23, 0.06);
    border-color: var(--primary-yellow);
}
body.dark-theme .agent-step.completed {
    background: rgba(76, 175, 80, 0.05);
    border-color: var(--success);
}
body.dark-theme .step-title {
    color: #fff;
}
body.dark-theme .agent-step.pending .step-icon {
    background: #333;
    color: #888;
}

/* --- IDEA CARDS --- */
.agent-idea-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    background: #fafafa;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.agent-idea-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-yellow);
    box-shadow: var(--shadow-hover);
    background: var(--white);
}
.idea-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.idea-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--dark-gray);
}
.idea-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 12.5px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
body.dark-theme .agent-idea-card {
    background: #252525;
    border-color: #333;
}
body.dark-theme .agent-idea-card:hover {
    background: #2a2a2a;
    border-color: var(--primary-yellow);
}
body.dark-theme .idea-title {
    color: #fff;
}
body.dark-theme .idea-details-grid {
    border-top-color: #333;
}
.idea-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--medium-gray);
}
body.dark-theme .idea-meta-item {
    color: #aaa;
}
.idea-meta-item strong {
    color: var(--dark-gray);
}
body.dark-theme .idea-meta-item strong {
    color: #fff;
}

/* ==========================================================================
   DASHBOARD PREMIUM INTERACTIONS (PHASE 3)
   ========================================================================== */

/* 1. 3D Tilt Card & Glare styling */
.kpi-card {
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
    overflow: hidden;
}
.kpi-card-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 80%);
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s ease;
}
body.dark-theme .kpi-card-glare {
    background: radial-gradient(circle at 50% 50%, rgba(212, 160, 23, 0.15) 0%, rgba(255,255,255,0) 80%);
}

/* 2. SVG Progress Ring */
.kpi-icon-wrapper {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kpi-icon-wrapper .kpi-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    font-size: 15px !important;
}
.kpi-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 46px;
    height: 46px;
    transform: rotate(-90deg);
    pointer-events: none;
}
.kpi-ring circle {
    fill: none;
    stroke-width: 3;
}
.kpi-ring-bg {
    stroke: rgba(0, 0, 0, 0.05);
}
body.dark-theme .kpi-ring-bg {
    stroke: rgba(255, 255, 255, 0.08);
}
.kpi-ring-bar {
    stroke: var(--primary-yellow);
    stroke-linecap: round;
    stroke-dasharray: 125.6; /* 2 * PI * 20 */
    stroke-dashoffset: 125.6;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi-ring-bar.green { stroke: var(--success); }
.kpi-ring-bar.red { stroke: var(--danger); }
.kpi-ring-bar.yellow { stroke: var(--primary-yellow); }
.kpi-ring-bar.blue { stroke: var(--info); }

/* 3. Sparkle particles trailing mouse */
.sparkle-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #ffd700 0%, rgba(212, 160, 23, 0.2) 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 0 8px #ffd700, 0 0 16px var(--primary-yellow);
    animation: sparkleFade 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes sparkleFade {
    0% {
        transform: translate(-50%, -50%) scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.1) translate(var(--tx), var(--ty)) rotate(180deg);
        opacity: 0;
    }
}

/* 4. Live Activity Ticker styling */
.activity-ticker-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
    box-shadow: 0 2px 6px var(--shadow);
    height: 40px;
}
body.dark-theme .activity-ticker-container {
    background: var(--dark-gray);
    border-color: #333;
}
.ticker-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
    padding-right: 16px;
    height: 100%;
}
body.dark-theme .ticker-title {
    color: #fff;
    border-right-color: #333;
}
.ticker-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.ticker-items {
    display: flex;
    align-items: center;
    gap: 50px;
    position: absolute;
    white-space: nowrap;
    animation: tickerScroll 360s linear infinite;
    padding-left: 100%;
}
.ticker-items:hover {
    animation-play-state: paused;
}
.ticker-item {
    font-size: 12.5px;
    color: var(--medium-gray);
    display: flex;
    align-items: center;
    gap: 8px;
}
body.dark-theme .ticker-item {
    color: #ccc;
}
.ticker-item i {
    font-size: 10px;
}

@keyframes tickerScroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* ==========================================================================
   LIQUID GLASS FULL-PAGE THEME
   Transforms entire UI into frosted glass panels over WebGL beam background
   ========================================================================== */

/* Full-page shader canvas */
#glass-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ── Force dark glass base ── */
body {
    background: #000 !important;
    color: #e0e0e0 !important;
}

/* ── Sidebar: deep frosted glass ── */
.sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)), rgba(15, 15, 22, 0.45) !important;
    backdrop-filter: blur(40px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(40px) saturate(1.8) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3) !important;
}
.sidebar-footer {
    background: rgba(10, 10, 15, 0.25) !important;
    backdrop-filter: blur(40px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(40px) saturate(1.8) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.sidebar-header {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ── Desktop Floating Rounded Auto-Hide Sidebar ── */
@media (min-width: 769px) {
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 15px !important;
        height: calc(100vh - 30px) !important;
        width: 40px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        overflow: hidden !important;
        z-index: 1000 !important;
        transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    .sidebar:hover {
        width: 275px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    .sidebar::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 260px;
        height: 100%;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)), rgba(15, 15, 22, 0.45);
        backdrop-filter: blur(40px) saturate(1.8);
        -webkit-backdrop-filter: blur(40px) saturate(1.8);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        z-index: -1;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s;
        transform: translateX(-235px);
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    }
    .sidebar:hover::after {
        transform: translateX(15px) !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
    }
    .sidebar > * {
        width: 260px !important;
        min-width: 260px !important;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
        transform: translateX(-235px);
        opacity: 0;
        pointer-events: none;
    }
    .sidebar:hover > * {
        transform: translateX(15px) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .sidebar-header {
        border-radius: 20px 20px 0 0 !important;
    }
    .sidebar-footer {
        border-radius: 0 0 20px 20px !important;
    }
    .main-content {
        margin-left: 55px !important;
    }
}

/* ── Main content: transparent to show beams ── */
.main-content {
    background: transparent !important;
    position: relative;
    z-index: 1;
}
.content-area {
    background: transparent !important;
}

/* ── Topbar: glass navigation bar ── */
.topbar {
    background: rgba(10, 10, 15, 0.55) !important;
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.page-title { color: #fff !important; }
.breadcrumb { color: rgba(255,255,255,0.45) !important; }
.breadcrumb a { color: var(--primary-yellow) !important; }

/* Search box glass */
.search-box input {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.search-box input::placeholder { color: rgba(255,255,255,0.35) !important; }
.search-box input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-yellow) !important;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15) !important;
}
.search-box i { color: rgba(255,255,255,0.35) !important; }

/* Topbar buttons */
.topbar-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.6) !important;
}
.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(212, 160, 23, 0.4) !important;
    color: var(--primary-yellow) !important;
}
.topbar-btn .notif-dot {
    border-color: rgba(10, 10, 15, 0.8) !important;
}

/* Mobile toggle */
.mobile-toggle {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

/* ── KPI Cards: glass panels ── */
.kpi-card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.kpi-card:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(212, 160, 23, 0.35) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 0 20px rgba(212, 160, 23, 0.08) !important;
}
.kpi-value { color: #fff !important; }
.kpi-label { color: rgba(255,255,255,0.5) !important; }
.kpi-icon.yellow { background: rgba(212, 160, 23, 0.15) !important; color: var(--primary-yellow) !important; }
.kpi-icon.green  { background: rgba(76, 175, 80, 0.15) !important; color: #66BB6A !important; }
.kpi-icon.red    { background: rgba(244, 67, 54, 0.15) !important; color: #EF5350 !important; }
.kpi-icon.blue   { background: rgba(33, 150, 243, 0.15) !important; color: #42A5F5 !important; }

/* KPI card glare for glass theme */
.kpi-card-glare {
    background: radial-gradient(circle at 50% 50%, rgba(212, 160, 23, 0.12) 0%, rgba(255,255,255,0) 80%) !important;
}

/* KPI ring background */
.kpi-ring-bg {
    stroke: rgba(255, 255, 255, 0.06) !important;
}

/* ── Chart cards: glass ── */
.chart-card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.chart-title { color: #fff !important; }
.chart-subtitle { color: rgba(255,255,255,0.45) !important; }

/* Filter buttons glass */
.filter-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255,255,255,0.6) !important;
}
.filter-btn:hover, .filter-btn.active {
    background: var(--primary-yellow) !important;
    color: #000 !important;
    border-color: var(--primary-yellow) !important;
}

/* ── Table cards: glass ── */
.table-card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.table-title { color: #fff !important; }
.table-header {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}

/* Data table glass */
.data-table th {
    background: rgba(255, 255, 255, 0.03) !important;
    color: rgba(255,255,255,0.55) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.data-table th:hover { color: var(--primary-yellow) !important; }
.data-table td {
    color: rgba(255,255,255,0.75) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}
.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Table tools glass */
.search-input {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.search-input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
}
.filter-select {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.filter-select option {
    background: #1a1a1a;
    color: #fff;
}

/* Pagination glass */
.table-pagination {
    border-top-color: rgba(255, 255, 255, 0.06) !important;
}
.pagination-info { color: rgba(255,255,255,0.45) !important; }
.pagination-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255,255,255,0.6) !important;
}
.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-yellow) !important;
    color: var(--primary-yellow) !important;
    background: rgba(212, 160, 23, 0.1) !important;
}
.pagination-btn.active {
    background: var(--primary-yellow) !important;
    border-color: var(--primary-yellow) !important;
    color: #000 !important;
}

/* ── Status badges: glass tinted ── */
.status-completed { background: rgba(76, 175, 80, 0.15) !important; color: #66BB6A !important; }
.status-in-progress { background: rgba(255, 152, 0, 0.15) !important; color: #FFA726 !important; }
.status-blocked { background: rgba(244, 67, 54, 0.15) !important; color: #EF5350 !important; }
.status-pending { background: rgba(33, 150, 243, 0.15) !important; color: #42A5F5 !important; }
.status-dropped { background: rgba(156, 39, 176, 0.15) !important; color: #BA68C8 !important; }

/* ── AI Banner: glass panel ── */
.ai-banner {
    background: rgba(12, 12, 18, 0.6) !important;
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-left: 4px solid var(--primary-yellow) !important;
}
/* Hide per-banner canvases since we have full-page glass background */
.ai-banner-canvas {
    display: none !important;
}

/* ── Detail cards: glass ── */
.detail-card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}
.detail-card-title { color: #fff !important; }
.detail-label { color: rgba(255,255,255,0.45) !important; }
.detail-value { color: rgba(255,255,255,0.85) !important; }
.detail-value.highlight { color: var(--primary-yellow) !important; }
.detail-row { border-bottom-color: rgba(255,255,255,0.06) !important; }
.detail-back { color: var(--primary-yellow) !important; }

/* AI Suggestion box glass */
.ai-suggestion-box {
    background: rgba(212, 160, 23, 0.08) !important;
    border: 1px solid rgba(212, 160, 23, 0.25) !important;
}
.ai-suggestion-box .suggestion-text {
    color: rgba(255,255,255,0.8) !important;
}

/* Timeline glass */
.timeline::before {
    background: rgba(255, 255, 255, 0.08) !important;
}
.timeline-dot {
    border-color: rgba(8, 8, 12, 0.8) !important;
}
.timeline-time { color: rgba(255,255,255,0.4) !important; }
.timeline-text { color: rgba(255,255,255,0.75) !important; }

/* ── Modal: deep glass ── */
.modal-content {
    background: rgba(15, 15, 22, 0.88) !important;
    backdrop-filter: blur(36px) saturate(1.4);
    -webkit-backdrop-filter: blur(36px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
.modal-title { color: #fff !important; }
.close-btn { color: rgba(255,255,255,0.5) !important; }
.close-btn:hover { color: #EF5350 !important; }
.form-group label { color: rgba(255,255,255,0.6) !important; }
.form-control {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
}
.form-control:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-yellow) !important;
}

/* ── AI Chat: glass window ── */
.ai-chat-window {
    background: rgba(10, 10, 16, 0.92) !important;
    backdrop-filter: blur(36px) saturate(1.4);
    -webkit-backdrop-filter: blur(36px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}
.ai-chat-header {
    background: rgba(255, 255, 255, 0.04) !important;
    border-bottom: 1px solid rgba(212, 160, 23, 0.3) !important;
}
.chat-message.ai {
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255,255,255,0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.ai-chat-input-area {
    background: rgba(255, 255, 255, 0.03) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.ai-chat-input-area input {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.ai-chat-input-area input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-yellow) !important;
}
.suggestion-chip {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(212, 160, 23, 0.25) !important;
    color: var(--primary-yellow) !important;
}
.suggestion-chip:hover {
    background: rgba(212, 160, 23, 0.15) !important;
    border-color: var(--primary-yellow) !important;
}

/* ── Toast: glass ── */
.toast {
    background: rgba(15, 15, 22, 0.9) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ── Skeleton: glass shimmer ── */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%) !important;
    background-size: 200% 100%;
}

/* ── Tooltip: glass ── */
.tooltip::after {
    background: rgba(15, 15, 22, 0.92) !important;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff !important;
}

/* ── Activity ticker: glass ── */
.activity-ticker-container {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}
.ticker-title {
    color: #fff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.ticker-item { color: rgba(255,255,255,0.6) !important; }

/* ── Agent steps: glass ── */
.agent-step {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.agent-step.active {
    border-color: rgba(212, 160, 23, 0.4) !important;
    background: rgba(212, 160, 23, 0.06) !important;
    box-shadow: 0 0 16px rgba(212, 160, 23, 0.1) !important;
}
.agent-step.completed {
    border-color: rgba(76, 175, 80, 0.3) !important;
    background: rgba(76, 175, 80, 0.05) !important;
}
.agent-step.pending .step-icon {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.3) !important;
}
.step-title { color: #fff !important; }
.step-desc { color: rgba(255,255,255,0.45) !important; }

/* ── Agent idea cards: glass ── */
.agent-idea-card {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.agent-idea-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(212, 160, 23, 0.35) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}
.idea-title { color: #fff !important; }
.idea-details-grid { border-top-color: rgba(255, 255, 255, 0.06) !important; }
.idea-meta-item { color: rgba(255,255,255,0.5) !important; }
.idea-meta-item strong { color: #fff !important; }

/* ── Reports: glass ── */
.report-paper {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.85) !important;
}
.report-paper h2, .report-paper h3, .report-paper h4 {
    color: #fff !important;
}
.report-kpi-card {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.report-table th {
    background: rgba(255, 255, 255, 0.04) !important;
    color: rgba(255,255,255,0.6) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.report-table td {
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
    color: rgba(255,255,255,0.75) !important;
}
.report-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}
.report-bulletin {
    background: rgba(212, 160, 23, 0.08) !important;
    color: rgba(255,255,255,0.8) !important;
}

/* ── Settings: glass ── */
.settings-status-box {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.8) !important;
}
.slider {
    background-color: rgba(255, 255, 255, 0.12) !important;
}
.slider:before {
    background-color: #fff !important;
}

/* ── User cells and profile ── */
.user-cell-name { color: #fff !important; }
.user-cell-dept { color: rgba(255,255,255,0.45) !important; }

/* ── Progress bars: glass ── */
.progress-bar {
    background: rgba(255, 255, 255, 0.06) !important;
}
.progress-bar-fill {
    box-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}
.progress-text { color: rgba(255,255,255,0.5) !important; }

/* ── Buttons enhanced ── */
.btn-outline {
    border: 1px solid rgba(212, 160, 23, 0.5) !important;
    color: var(--primary-yellow) !important;
}
.btn-outline:hover {
    background: var(--primary-yellow) !important;
    color: #000 !important;
}

/* ── Overlay for mobile ── */
.overlay {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px);
}

/* ── Nav items: ensure visibility ── */
.nav-section-title {
    color: rgba(255, 255, 255, 0.2) !important;
}

/* ── Markdown body in glass ── */
.markdown-body h3 { color: #fff !important; }
.markdown-body p, .markdown-body li { color: rgba(255,255,255,0.8) !important; }

/* ── Sparkle particles: brighter on glass ── */
.sparkle-particle {
    box-shadow: 0 0 10px #ffd700, 0 0 20px rgba(212, 160, 23, 0.6) !important;
}

/* ── Override dark-theme class (glass IS the theme now) ── */
body.dark-theme {
    background: #000 !important;
    --white: #ffffff !important;
}
body.dark-theme .topbar {
    background: rgba(10, 10, 15, 0.55) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)), rgba(15, 15, 22, 0.45) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.dark-theme .sidebar-footer {
    background: rgba(10, 10, 15, 0.25) !important;
}
@media (min-width: 769px) {
    body.dark-theme .sidebar,
    body.dark-theme .sidebar:hover {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        left: 0 !important;
    }
}
body.dark-theme .kpi-card,
body.dark-theme .chart-card,
body.dark-theme .table-card,
body.dark-theme .detail-card {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark-theme .modal-content {
    background: rgba(15, 15, 22, 0.88) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
body.dark-theme .data-table th {
    background: rgba(255, 255, 255, 0.03) !important;
    color: rgba(255,255,255,0.55) !important;
}
body.dark-theme .data-table td {
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}
body.dark-theme .form-control {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
body.dark-theme .form-control option {
    background: #15151f !important;
    color: #ffffff !important;
}
body.dark-theme .toast {
    background: rgba(15, 15, 22, 0.9) !important;
    color: #fff !important;
}
body.dark-theme .activity-ticker-container {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .suggestion-chip {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--primary-yellow) !important;
}
body.dark-theme .chat-message.ai {
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255,255,255,0.85) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .ai-chat-input-area {
    background: rgba(255, 255, 255, 0.03) !important;
    border-top-color: rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .ai-chat-input-area input {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
body.dark-theme .agent-step {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .agent-idea-card {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
body.dark-theme .idea-title { color: #fff !important; }
body.dark-theme .step-title { color: #fff !important; }
body.dark-theme .agent-step.pending .step-icon {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.3) !important;
}
body.dark-theme .slider {
    background-color: rgba(255, 255, 255, 0.12) !important;
}
body.dark-theme .settings-status-box {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255,255,255,0.8) !important;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS ENHANCEMENTS
   Optimizes dashboard layout on mobile screens without affecting desktop view
   ========================================================================== */

@media (max-width: 768px) {
    .breadcrumb {
        display: none !important; /* Hide breadcrumb on tablets and mobile to save height */
    }
}

@media (max-width: 600px) {
    /* 2-column KPI grid for clean compact dashboard layout */
    .kpi-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
    }
    .kpi-card {
        padding: 12px 14px !important;
    }
    .kpi-value {
        font-size: 20px !important;
        margin-bottom: 2px !important;
    }
    .kpi-label {
        font-size: 11px !important;
    }
    .kpi-header {
        margin-bottom: 6px !important;
    }
    .kpi-icon-wrapper svg {
        width: 38px !important;
        height: 38px !important;
    }
    .kpi-icon-wrapper svg circle {
        cx: 19 !important;
        cy: 19 !important;
        r: 16 !important;
    }
    .kpi-icon {
        width: 26px !important;
        height: 26px !important;
        font-size: 11px !important;
        border-radius: 50% !important;
    }
}

@media (max-width: 576px) {
    /* Topbar Layout stacking in 2 rows */
    .topbar {
        padding: 10px 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .topbar-left {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }
    .topbar-right {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }
    .topbar-right .search-box {
        flex: 1 !important;
    }
    .topbar-right .search-box input {
        width: 100% !important;
    }
    .topbar-btn {
        width: 36px !important;
        height: 36px !important;
        flex-shrink: 0 !important;
    }
    
    /* AI Banner vertical layout */
    .ai-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    .ai-actions {
        width: 100% !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .ai-actions .btn {
        padding: 8px 16px !important;
        font-size: 12px !important;
        flex: 1 !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .ai-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    
    /* Table controls stacking */
    .table-header {
        width: 100% !important;
        align-items: stretch !important;
    }
    .table-tools {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 8px !important;
    }
    .table-tools .search-input {
        width: 100% !important;
        flex: none !important;
    }
    .table-tools .filter-select {
        width: 100% !important;
    }
    
    /* Modals sizing */
    .modal-content {
        padding: 20px !important;
        width: 95% !important;
        max-width: 95% !important;
    }
}

@media (max-width: 480px) {
    /* Compact content padding */
    .content-area {
        padding: 10px !important;
    }
    
    /* Stack detail cards lists */
    .detail-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 8px 0 !important;
    }
    
    /* Chart padding reduction */
    .chart-card {
        padding: 16px !important;
    }
}

/* ==========================================================================
   LIGHT THEME OVERRIDES (White Background Theme)
   Triggers when body:not(.dark-theme) is active.
   ========================================================================== */

body:not(.dark-theme) {
    background: #f5f6fa !important; /* Premium light gray backdrop behind WebGL canvas */
    color: var(--dark-gray) !important;
}

/* Sidebar in light theme (white frosted glass sidebar) */
body:not(.dark-theme) .sidebar {
    background: rgba(255, 255, 255, 0.45) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03) !important;
    backdrop-filter: blur(30px) saturate(1.6) !important;
    -webkit-backdrop-filter: blur(30px) saturate(1.6) !important;
}
body:not(.dark-theme) .nav-item {
    color: rgba(0, 0, 0, 0.6) !important;
}
body:not(.dark-theme) .nav-item:hover, 
body:not(.dark-theme) .nav-item.active {
    color: #000000 !important;
    background: rgba(212, 160, 23, 0.15) !important;
}
body:not(.dark-theme) .nav-item i {
    color: rgba(0, 0, 0, 0.6) !important;
}
body:not(.dark-theme) .nav-item:hover i, 
body:not(.dark-theme) .nav-item.active i {
    color: var(--primary-yellow-dark) !important;
}
body:not(.dark-theme) .nav-section-title {
    color: rgba(0, 0, 0, 0.35) !important;
}
body:not(.dark-theme) .logo-text {
    color: #000000 !important;
}
body:not(.dark-theme) .logo-icon {
    background: var(--primary-yellow) !important;
    color: #000000 !important;
}
body:not(.dark-theme) .sidebar-footer {
    background: rgba(255, 255, 255, 0.6) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    backdrop-filter: blur(30px) saturate(1.6) !important;
    -webkit-backdrop-filter: blur(30px) saturate(1.6) !important;
}
body:not(.dark-theme) .sidebar-footer .user-profile span {
    color: rgba(0, 0, 0, 0.6) !important;
}
body:not(.dark-theme) .sidebar-footer .user-profile strong {
    color: #000000 !important;
}
body:not(.dark-theme) .sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}
@media (min-width: 769px) {
    body:not(.dark-theme) .sidebar::after {
        background: rgba(255, 255, 255, 0.45) !important;
        backdrop-filter: blur(30px) saturate(1.6) !important;
        -webkit-backdrop-filter: blur(30px) saturate(1.6) !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
    }
}

/* Topbar in light theme */
body:not(.dark-theme) .topbar {
    background: rgba(255, 255, 255, 0.45) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(24px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
}
body:not(.dark-theme) .page-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .breadcrumb {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .search-box input {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #000000 !important;
}
body:not(.dark-theme) .search-box input::placeholder {
    color: var(--medium-gray) !important;
    opacity: 0.7;
}
body:not(.dark-theme) .search-box i {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .topbar-btn {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: rgba(0, 0, 0, 0.6) !important;
}
body:not(.dark-theme) .topbar-btn:hover {
    background: rgba(212, 160, 23, 0.15) !important;
    color: var(--primary-yellow-dark) !important;
    border-color: var(--primary-yellow) !important;
}

/* Cards in light theme */
body:not(.dark-theme) .kpi-card,
body:not(.dark-theme) .chart-card,
body:not(.dark-theme) .table-card,
body:not(.dark-theme) .detail-card {
    background: rgba(255, 255, 255, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.04) !important;
    backdrop-filter: blur(24px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
}
body:not(.dark-theme) .kpi-value {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .kpi-label {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .chart-title,
body:not(.dark-theme) .table-title,
body:not(.dark-theme) .detail-card-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .chart-subtitle {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .kpi-card-glare {
    display: none !important;
}
body:not(.dark-theme) .kpi-ring-bg {
    stroke: var(--light-gray) !important;
}
body:not(.dark-theme) .filter-btn {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .filter-btn.active {
    background: var(--primary-yellow) !important;
    color: var(--dark-gray) !important;
    border-color: var(--primary-yellow) !important;
}

/* Tables in light theme */
body:not(.dark-theme) .data-table th {
    background: var(--bg-gray) !important;
    color: var(--medium-gray) !important;
    border-bottom: 1px solid var(--border) !important;
}
body:not(.dark-theme) .data-table td {
    color: var(--dark-gray) !important;
    border-bottom: 1px solid var(--border) !important;
}
body:not(.dark-theme) .data-table tr:hover td {
    background: var(--bg-gray) !important;
}
body:not(.dark-theme) .search-input,
body:not(.dark-theme) .filter-select {
    background-color: var(--bg-gray) !important;
    border: 1px solid var(--border) !important;
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .filter-select option {
    background: #ffffff;
    color: var(--dark-gray);
}
body:not(.dark-theme) .pagination-info {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .pagination-btn {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-yellow) !important;
    color: var(--primary-yellow-dark) !important;
}

/* AI Suggestion & Banner in light theme */
body:not(.dark-theme) .ai-banner {
    background: #FAF8F2 !important;
    border: 1px solid #E8DFD0 !important;
    border-left: 4px solid var(--primary-yellow) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    backdrop-filter: none !important;
}
body:not(.dark-theme) .ai-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .ai-desc {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .ai-suggestion-box {
    background: #FFFDEE !important;
    border: 1px solid #F3EBBC !important;
}
body:not(.dark-theme) .ai-suggestion-box .suggestion-text {
    color: var(--dark-gray) !important;
}

/* Reports in light theme */
body:not(.dark-theme) .report-paper {
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(24px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .report-paper h2,
body:not(.dark-theme) .report-paper h3,
body:not(.dark-theme) .report-paper h4 {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .report-kpi-card {
    background: rgba(255, 255, 255, 0.45) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}
body:not(.dark-theme) .report-table th {
    background: rgba(0, 0, 0, 0.03) !important;
    color: var(--medium-gray) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-theme) .report-table td {
    border-bottom-color: rgba(0, 0, 0, 0.05) !important;
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .report-bulletin {
    background: rgba(212, 160, 23, 0.08) !important;
    color: var(--primary-yellow-dark) !important;
}

/* Detail view in light theme */
body:not(.dark-theme) .detail-row {
    border-bottom-color: var(--border) !important;
}
body:not(.dark-theme) .detail-label {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .detail-value {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .timeline::before {
    background: var(--border) !important;
}
body:not(.dark-theme) .timeline-dot {
    border-color: #ffffff !important;
    background: var(--primary-yellow) !important;
}
body:not(.dark-theme) .timeline-time {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .timeline-text {
    color: var(--dark-gray) !important;
}

/* Chat window in light theme */
body:not(.dark-theme) .ai-chat-window {
    background: rgba(255, 255, 255, 0.75) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: blur(36px) saturate(1.6) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.6) !important;
}
body:not(.dark-theme) .ai-chat-header {
    background: rgba(0, 0, 0, 0.02) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-theme) .ai-chat-header h3 {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .chat-message.ai {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--dark-gray) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}
body:not(.dark-theme) .ai-chat-input-area {
    background: rgba(255, 255, 255, 0.5) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-theme) .ai-chat-input-area input {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--dark-gray) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-theme) .suggestion-chip {
    background: #ffffff !important;
    border: 1px solid var(--primary-yellow) !important;
    color: var(--primary-yellow-dark) !important;
}
body:not(.dark-theme) .suggestion-chip:hover {
    background: var(--primary-yellow-light) !important;
}

/* Modals in light theme */
body:not(.dark-theme) .modal-content {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: blur(36px) saturate(1.6) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.6) !important;
}
body:not(.dark-theme) .modal-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .form-control {
    background: #ffffff !important;
    color: var(--dark-gray) !important;
    border: 1px solid var(--border) !important;
}
body:not(.dark-theme) .form-control option {
    background: #ffffff !important;
    color: #333333 !important;
}
body:not(.dark-theme) .form-control:focus {
    border-color: var(--primary-yellow) !important;
}

/* Ticker in light theme */
body:not(.dark-theme) .activity-ticker-container {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
    backdrop-filter: blur(20px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.4) !important;
}
body:not(.dark-theme) .ticker-title {
    color: var(--dark-gray) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-theme) .ticker-item {
    color: var(--medium-gray) !important;
}

/* Agent steps in light theme */
body:not(.dark-theme) .agent-step {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}
body:not(.dark-theme) .agent-step.active {
    border-color: rgba(212, 160, 23, 0.4) !important;
    background: rgba(212, 160, 23, 0.06) !important;
}
body:not(.dark-theme) .agent-step.completed {
    border-color: rgba(76, 175, 80, 0.3) !important;
    background: rgba(76, 175, 80, 0.05) !important;
}
body:not(.dark-theme) .step-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .step-desc {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .agent-step.pending .step-icon {
    background: var(--light-gray) !important;
    color: var(--medium-gray) !important;
}

/* Agent idea cards in light theme */
body:not(.dark-theme) .agent-idea-card {
    background: rgba(255, 255, 255, 0.45) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}
body:not(.dark-theme) .agent-idea-card:hover {
    background: rgba(255, 255, 255, 0.65) !important;
    border-color: rgba(212, 160, 23, 0.35) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05) !important;
}
body:not(.dark-theme) .idea-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .idea-meta-item {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .idea-meta-item strong {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .idea-details-grid {
    border-top-color: rgba(0, 0, 0, 0.06) !important;
}

/* Settings elements in light theme */
body:not(.dark-theme) .settings-status-box {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .slider {
    background-color: var(--border) !important;
}
body:not(.dark-theme) .slider:before {
    background-color: #ffffff !important;
}

/* User cells in light theme */
body:not(.dark-theme) .user-cell-name {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .user-cell-dept {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .progress-bar {
    background: var(--light-gray) !important;
}
body:not(.dark-theme) .progress-text {
    color: var(--medium-gray) !important;
}

/* Markdown in light theme */
body:not(.dark-theme) .markdown-body h3 {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .markdown-body p,
body:not(.dark-theme) .markdown-body li {
    color: var(--dark-gray) !important;
}

/* ==========================================================================
   TOPBAR DROPDOWN SYSTEM
   ========================================================================== */

.topbar-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px var(--shadow-hover);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes dropdownSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.topbar-dropdown.show {
    display: flex;
}
.dropdown-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    color: var(--dark-gray);
}
.dropdown-items {
    max-height: 280px;
    overflow-y: auto;
}
.dropdown-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    align-items: flex-start;
}
.dropdown-item:last-child {
    border-bottom: none;
}
.dropdown-item:hover {
    background: var(--bg-gray);
}
.item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.item-icon.warning { background: #FFF3E0; color: var(--warning); }
.item-icon.success { background: #E8F5E9; color: var(--success); }
.item-icon.info { background: #E3F2FD; color: var(--info); }

.item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    color: #ffffff;
}
.item-avatar.yellow-avatar { background: var(--primary-yellow); color: var(--dark-gray); }
.item-avatar.green-avatar { background: var(--success); }

.item-content {
    flex: 1;
    text-align: left;
}
.item-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 2px;
}
.item-desc {
    font-size: 11px;
    color: var(--medium-gray);
    line-height: 1.4;
    margin-bottom: 4px;
}
.item-time {
    font-size: 10px;
    color: var(--medium-gray);
    opacity: 0.8;
}

/* ── Dark Theme Dropdown Overrides ── */
body.dark-theme .topbar-dropdown {
    background: rgba(15, 15, 22, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(28px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.4) !important;
}
body.dark-theme .dropdown-header {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}
body.dark-theme .dropdown-item {
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}
body.dark-theme .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}
body.dark-theme .item-title {
    color: #ffffff !important;
}
body.dark-theme .item-desc {
    color: rgba(255, 255, 255, 0.7) !important;
}
body.dark-theme .item-time {
    color: rgba(255, 255, 255, 0.5) !important;
}
body.dark-theme .item-icon.warning { background: rgba(255, 152, 0, 0.15) !important; }
body.dark-theme .item-icon.success { background: rgba(76, 175, 80, 0.15) !important; }
body.dark-theme .item-icon.info { background: rgba(33, 150, 243, 0.15) !important; }

/* ── Light Theme Dropdown Overrides ── */
body:not(.dark-theme) .topbar-dropdown {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: blur(28px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.4) !important;
}
body:not(.dark-theme) .dropdown-header {
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .dropdown-item {
    border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}
body:not(.dark-theme) .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}
body:not(.dark-theme) .item-title {
    color: var(--dark-gray) !important;
}
body:not(.dark-theme) .item-desc {
    color: var(--medium-gray) !important;
}
body:not(.dark-theme) .item-time {
    color: var(--medium-gray) !important;
}

/* ==========================================================================
   CHROME OPTION DROPDOWN BUG FIX
   Forces native selects to use solid background to prevent transparent/white-on-white text in Chrome
   ========================================================================== */
body.dark-theme select.form-control,
body.dark-theme select.filter-select {
    background-color: #151522 !important;
    color: #ffffff !important;
}
body.dark-theme select.form-control option,
body.dark-theme select.filter-select option {
    background-color: #151522 !important;
    color: #ffffff !important;
}

body:not(.dark-theme) select.form-control,
body:not(.dark-theme) select.filter-select {
    background-color: #ffffff !important;
    color: #333333 !important;
}
body:not(.dark-theme) select.form-control option,
body:not(.dark-theme) select.filter-select option {
    background-color: #ffffff !important;
    color: #333333 !important;
}

/* ==========================================================================
   PWA INSTALL BUTTON PULSE GLOW ANIMATION
   ========================================================================== */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(212, 160, 23, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 160, 23, 0);
    }
}
.pulse-glow {
    animation: pulseGlow 2s infinite !important;
}


