/* ===== BASE STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    min-height: 100vh;
}

/* ===== TOP NAVIGATION ===== */
.top-nav {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-left, .nav-right { display: flex; align-items: center; gap: 5px; }

.logo {
    font-size: 1.2em;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 30px;
}

.logo i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.3em;
}

.nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

.admin-badge {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.logout-btn:hover { color: #e74c3c !important; }

/* ===== DROPDOWN NAVIGATION ===== */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown.active > .nav-dropdown-toggle {
    color: white;
    background: rgba(255,255,255,0.1);
}

.nav-dropdown-toggle { cursor: pointer; white-space: nowrap; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    min-width: 220px;
    padding: 8px 0;
    z-index: 2000;
    margin-top: 4px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dropdown.open > .nav-dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-dropdown-item:hover {
    background: #f0f2f5;
    color: #667eea;
}

.nav-dropdown-item i {
    width: 18px;
    text-align: center;
    color: #667eea;
}

/* ===== CLIENT SWITCHER ===== */
.client-switcher .nav-dropdown-menu {
    right: 0;
    left: auto;
    min-width: 250px;
}

/* ===== MAIN CONTAINER ===== */
.main-container { padding: 20px 25px; }

/* ===== HEADER BAR ===== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.6em;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(102,126,234,0.4); }

.btn-success { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; }
.btn-success:hover { box-shadow: 0 4px 15px rgba(39,174,96,0.4); }

.btn-danger { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }
.btn-danger:hover { box-shadow: 0 4px 15px rgba(231,76,60,0.4); }

.btn-secondary { background: #ecf0f1; color: #2c3e50; }
.btn-secondary:hover { background: #dfe6e9; }

.btn-sm { padding: 6px 12px; font-size: 0.85em; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #ecf0f1;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    color: #2c3e50;
}

.btn-icon:hover { background: #dfe6e9; transform: translateY(-1px); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95em;
    outline: none;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-group input[readonly] { background: #f8f9fa; cursor: not-allowed; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg { max-width: 800px; }
.modal-content.modal-xl { max-width: 1100px; }
.modal-content.modal-xxl { max-width: 1400px; }

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #6c757d;
}

.modal-close:hover { background: #e74c3c; color: white; }

.modal-body { padding: 25px; position: relative; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 25px;
    border-top: 1px solid #e9ecef;
}

/* ===== MODAL TABS ===== */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    padding: 0 25px;
    gap: 0;
    overflow-x: auto;
}

.modal-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    white-space: nowrap;
}

.modal-tab:hover { color: #2c3e50; }
.modal-tab.active { color: #667eea; border-bottom-color: #667eea; }

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.breadcrumb a:hover { color: #764ba2; }

.breadcrumb .separator { color: #95a5a6; }
.breadcrumb .current { color: #2c3e50; font-weight: 600; }

/* ===== FOLDER/REPORT CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card-item {
    background: white;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    border-left: 5px solid #dee2e6;
}

.card-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-item.folder { border-left-color: #f39c12; }
.card-item.report { border-left-color: #667eea; }

.card-icon {
    font-size: 2em;
    margin-bottom: 12px;
    opacity: 0.7;
}

.card-item.folder .card-icon { color: #f39c12; }
.card-item.report .card-icon { color: #667eea; }

.card-title {
    font-weight: 700;
    font-size: 1.05em;
    color: #2c3e50;
    margin-bottom: 6px;
}

.card-description {
    font-size: 0.85em;
    color: #6c757d;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.8em;
    color: #95a5a6;
}

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.card-item:hover .card-actions { opacity: 1; }

.card-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #6c757d;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: relative;
}

.card-action-btn:hover { background: #667eea; color: white; transform: scale(1.1); box-shadow: 0 3px 12px rgba(102,126,234,0.35); }
.card-action-btn.delete:hover { background: #e74c3c; color: white; box-shadow: 0 3px 12px rgba(231,76,60,0.35); }

/* ===== SIDEBAR TREE ===== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    min-height: calc(100vh - 100px);
}

.sidebar {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.sidebar-title {
    font-weight: 700;
    font-size: 0.95em;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-list { list-style: none; padding: 0; }

.tree-list .tree-list { padding-left: 18px; }

.tree-item {
    margin-bottom: 2px;
}

.tree-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.tree-link:hover { background: #f0f2f5; color: #667eea; }
.tree-link.active { background: rgba(102,126,234,0.1); color: #667eea; font-weight: 600; }

.tree-toggle {
    width: 18px;
    font-size: 0.7em;
    color: #95a5a6;
    transition: transform 0.3s;
    cursor: pointer;
}

.tree-toggle.collapsed { transform: rotate(-90deg); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state i { font-size: 3em; margin-bottom: 15px; opacity: 0.5; display: block; }
.empty-state h3 { margin-bottom: 8px; font-size: 1.1em; color: #6c757d; }
.empty-state p { font-size: 0.9em; margin-bottom: 20px; }

/* ===== REPORT BUILDER GRID ===== */
.report-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.report-title-edit {
    font-size: 1.4em;
    font-weight: 700;
    border: none;
    background: none;
    color: #2c3e50;
    font-family: inherit;
    outline: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s;
    min-width: 300px;
}

.report-title-edit:hover { background: #f0f2f5; }
.report-title-edit:focus { background: white; border: 2px solid #667eea; }

.report-description-edit {
    font-size: 0.9em;
    color: #6c757d;
    border: none;
    background: none;
    font-family: inherit;
    outline: none;
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.3s;
    width: 100%;
    margin-top: 4px;
}

.report-description-edit:hover { background: #f0f2f5; }
.report-description-edit:focus { background: white; border: 2px solid #667eea; color: #2c3e50; }

.grid-container {
    min-height: 600px;
}

.grid-stack { min-height: 400px; }

.grid-stack-item-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #e9ecef;
    cursor: grab;
    min-height: 42px;
}

.block-header:active { cursor: grabbing; }

.block-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-actions {
    display: flex;
    gap: 4px;
}

.block-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #6c757d;
    transition: all 0.3s;
}

.block-action-btn:hover { background: #e9ecef; color: #2c3e50; }
.block-action-btn.delete:hover { color: #e74c3c; }
.block-action-btn.toggle-labels-btn.active { background: #667eea; color: white; }
.block-action-btn.toggle-labels-btn.active:hover { background: #5a6fd6; }

/* ===== FULLSCREEN BLOCK ===== */
.block-fullscreen-active { overflow: hidden; }

.block-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white;
    border-radius: 0 !important;
}

.block-fullscreen .grid-stack-item-content {
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.block-fullscreen .block-body {
    min-height: calc(100vh - 50px) !important;
    overflow: auto !important;
    padding: 16px;
}

.block-fullscreen .block-body .ag-theme-alpine {
    height: calc(100vh - 70px) !important;
}

.block-body {
    flex: 1;
    padding: 10px;
    overflow: auto;
    position: relative;
    min-height: 100px;
}

.block-body .ag-theme-alpine {
    height: 100%;
    min-height: 200px;
}

.block-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    color: #667eea;
    font-size: 1.5em;
}

.block-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #e74c3c;
    font-size: 0.9em;
    text-align: center;
    padding: 20px;
}

/* ===== CARD VISUALIZATION ===== */

/* Single card wrapper */
.viz-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
}

/* Card panel (used for both single and paired) */
.viz-card-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 20px;
    border-radius: 12px;
    flex: 1;
    min-width: 0;
    transition: background-color 0.3s, color 0.3s;
}

.viz-card .viz-card-panel {
    width: 100%;
    height: 100%;
}

.viz-card-value {
    font-size: 2.5em;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1.2;
}

.viz-card-label {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 4px;
}

/* ===== PAIRED CARDS (comparison) ===== */
.viz-card-pair {
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 100%;
    gap: 0;
    padding: 10px;
}

.viz-card-pair .viz-card-panel {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.viz-card-pair .viz-card-panel.primary {
    border-radius: 12px 0 0 12px;
    border-right: none;
}

.viz-card-pair .viz-card-panel.secondary {
    border-radius: 0 12px 12px 0;
    border-left: none;
}

.viz-card-pair .viz-card-panel.secondary .viz-card-value {
    font-size: 2em;
    opacity: 0.8;
}

/* Bridge between the two cards */
.viz-card-pair-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    min-width: 2px;
    background: #e9ecef;
    position: relative;
}

/* Trend badge (% difference) */
.viz-card-trend-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75em;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.viz-card-trend-badge.positive { background: #d4edda; color: #155724; }
.viz-card-trend-badge.negative { background: #f8d7da; color: #721c24; }

/* CF icon above value */
.viz-card-cf-icon { font-size: 1.6em; margin-bottom: 4px; }
.viz-card-cf-icon .cf-icon { margin: 0 3px; }

/* ===== REPORT LAYOUT (sidebar + grid) ===== */
.report-layout {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
    position: relative;
}

.report-layout .grid-container {
    flex: 1;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* ===== FILTER SIDEBAR ===== */
.filter-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    display: none; /* hidden when no filters */
}

.filter-sidebar.has-filters {
    display: block;
}

/* Collapsed tab — always visible when filters exist */
.filter-sidebar-tab {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    gap: 6px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
    transition: all 0.25s ease;
    z-index: 2;
}

.filter-sidebar-tab:hover {
    width: 42px;
    box-shadow: 3px 3px 12px rgba(0,0,0,0.2);
}

.filter-sidebar-tab i { font-size: 0.9em; }

.filter-tab-count {
    background: rgba(255,255,255,0.25);
    font-size: 0.7em;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Expandable panel */
.filter-sidebar-panel {
    position: absolute;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 290px;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 16px rgba(0,0,0,0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid #e2e8f0;
}

.filter-sidebar.open .filter-sidebar-tab {
    opacity: 0;
    pointer-events: none;
}

.filter-sidebar.open .filter-sidebar-panel {
    left: 0;
}

.grid-container.with-sidebar {
    margin-left: 290px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar header */
.filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.filter-sidebar-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95em;
}

.filter-sidebar-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85em;
}

.filter-sidebar-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Sidebar body */
.filter-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.filter-sidebar-body::-webkit-scrollbar { width: 5px; }
.filter-sidebar-body::-webkit-scrollbar-track { background: transparent; }
.filter-sidebar-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* Sidebar footer */
.filter-sidebar-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

/* ===== FILTER CARDS ===== */
.filter-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.filter-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.filter-card.active {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 0 1px rgba(102,126,234,0.1);
}

.filter-card:last-child {
    margin-bottom: 0;
}

.filter-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    flex-shrink: 0;
}

.filter-card.active .filter-card-icon {
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
    box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}

.filter-card-info {
    flex: 1;
    min-width: 0;
}

.filter-card-label {
    display: block;
    font-weight: 600;
    font-size: 0.85em;
    color: #1e293b;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-card-type {
    display: block;
    font-size: 0.7em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.filter-card-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.2);
    flex-shrink: 0;
}

/* ===== FILTER INPUT CONTROLS ===== */
.filter-card-control { position: relative; }

.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-input-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    font-size: 0.8em;
    pointer-events: none;
    z-index: 1;
}

.filter-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85em;
    background: #fff;
    color: #334155;
    transition: all 0.2s ease;
}

.filter-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.filter-input::placeholder { color: #cbd5e1; }

/* Select wrapper */
.filter-select-wrap {
    position: relative;
}

.filter-input-select {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85em;
    background: #fff;
    color: #334155;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-input-select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.filter-select-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.7em;
    pointer-events: none;
}

/* Multiselect dropdown */
.filter-ms-wrap {
    position: relative;
}

.filter-ms-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85em;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-ms-summary:hover { border-color: #cbd5e1; }
.filter-ms-summary i { font-size: 0.7em; color: #94a3b8; transition: transform 0.2s; }
.filter-ms-wrap.expanded .filter-ms-summary { border-color: #667eea; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.filter-ms-wrap.expanded .filter-ms-summary i { transform: rotate(180deg); }

.filter-ms-dropdown {
    display: none;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
    padding: 4px 0;
}

.filter-ms-wrap.expanded .filter-ms-dropdown { display: block; }

.filter-ms-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    font-size: 0.83em;
    cursor: pointer;
    transition: background 0.15s;
    color: #334155;
}

.filter-ms-item:hover { background: #f0f4ff; }

.filter-ms-item input[type="checkbox"] {
    accent-color: #667eea;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.filter-ms-dropdown::-webkit-scrollbar { width: 4px; }
.filter-ms-dropdown::-webkit-scrollbar-track { background: transparent; }
.filter-ms-dropdown::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* Date input specific */
.filter-input-date {
    padding-left: 32px;
    color-scheme: light;
}

/* Empty state */
.filter-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.filter-empty i {
    font-size: 2em;
    opacity: 0.4;
}

.filter-empty p {
    margin: 0;
    font-size: 0.9em;
}

/* Filter binding rows (in editor modal) */
.filter-binding-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

/* ===== CONFIG PANEL ===== */
.config-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.config-section-title {
    font-weight: 700;
    font-size: 0.95em;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.config-row select,
.config-row input {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.3s;
}

.config-row select:focus,
.config-row input:focus { border-color: #667eea; }

.config-add-btn {
    padding: 6px 12px;
    background: none;
    border: 2px dashed #667eea;
    border-radius: 8px;
    color: #667eea;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.config-add-btn:hover { background: rgba(102,126,234,0.1); }

.config-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.9em;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-remove-btn:hover { background: rgba(231,76,60,0.1); }

/* ===== VIZ TYPE SELECTOR ===== */
.viz-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.viz-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.viz-type-option:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.05);
}

.viz-type-option.selected {
    border-color: #667eea;
    background: rgba(102,126,234,0.1);
}

.viz-type-option i {
    font-size: 2em;
    color: #667eea;
}

.viz-type-option span {
    font-weight: 600;
    font-size: 0.85em;
    color: #2c3e50;
}

/* ===== DATA SOURCE LIST ===== */
.datasource-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.datasource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.3s;
}

.datasource-item:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.03);
}

.datasource-info { display: flex; align-items: center; gap: 12px; }
.datasource-actions { display: flex; gap: 8px; }

/* ===== PARAMETER TAGS ===== */
.param-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f0f2f5;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
}

.param-tag.required {
    background: rgba(102,126,234,0.1);
    color: #667eea;
}

.param-tag.optional {
    background: rgba(149,165,166,0.15);
    color: #6c757d;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.85);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-size: 1.1em;
    color: #667eea;
    font-weight: 600;
}

.loading-spinner i { font-size: 2.5em; }

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 80px;
    right: 25px;
    padding: 14px 22px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    font-size: 0.9em;
}

.notification-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.notification-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.notification-info { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }
.notification-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.toast.success { background: #27ae60; color: white; }
.toast.error { background: #e74c3c; color: white; }
.toast.warning { background: #f39c12; color: white; }
.toast.pending { background: #3498db; color: white; }

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ===== SELECT2 OVERRIDES ===== */
.select2-container--default .select2-selection--single {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    height: 42px !important;
    padding: 5px 8px !important;
}

.select2-container--default .select2-selection--single:focus-within {
    border-color: #667eea !important;
}

.select2-container--default .select2-selection--multiple {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    min-height: 42px !important;
    padding: 4px 8px !important;
}

.select2-container--default .select2-selection--multiple:focus-within {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 0.85em !important;
}

/* ===== AG GRID OVERRIDES ===== */
.ag-theme-alpine {
    --ag-border-radius: 10px;
    --ag-header-background-color: #1a1a2e;
    --ag-header-foreground-color: #ffffff;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo h1 {
    font-size: 1.5em;
    font-weight: 800;
    color: #2c3e50;
    margin-top: 10px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== STAT CARDS ===== */
.stat-card-uniform {
    background: white;
    border-radius: 14px;
    padding: 22px 24px;
    position: relative;
    display: block;
    overflow: visible;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-left: 5px solid #dee2e6;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 100px;
}

.stat-card-uniform:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card-uniform.purple { border-left-color: #9b59b6; }
.stat-card-uniform.blue { border-left-color: #3498db; }
.stat-card-uniform.green { border-left-color: #27ae60; }
.stat-card-uniform.orange { border-left-color: #f39c12; }
.stat-card-uniform.red { border-left-color: #e74c3c; }

.stat-card-icon-uniform {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 1.8em;
    opacity: 0.1;
    color: #2c3e50;
    pointer-events: none;
}

.stat-card-value-uniform {
    font-size: 1.7em;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 4px;
    padding-right: 40px;
}

.stat-card-label-uniform {
    font-size: 0.82em;
    color: #6c757d;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ===== WIZARD STEPPER ===== */
.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e9ecef;
    gap: 0;
    overflow-x: auto;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 0.88em;
    font-weight: 600;
    color: #95a5a6;
}

.wizard-step:hover { color: #667eea; background: rgba(102,126,234,0.05); }

.wizard-step.active {
    color: #667eea;
    background: rgba(102,126,234,0.1);
}

.wizard-step.completed {
    color: #27ae60;
}

.wizard-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
    background: #e9ecef;
    color: #6c757d;
    transition: all 0.3s;
    flex-shrink: 0;
}

.wizard-step.active .wizard-step-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.wizard-step.completed .wizard-step-number {
    background: #27ae60;
    color: white;
}

.wizard-step-line {
    width: 30px;
    height: 2px;
    background: #e9ecef;
    flex-shrink: 0;
}

.wizard-step-content { display: none; }
.wizard-step-content.active { display: block; }

.wizard-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wizard-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    border-radius: 12px;
    color: #667eea;
    font-weight: 600;
    font-size: 1em;
}

.wizard-loading i { font-size: 2em; }

/* ===== COLUMN PICKER (Drag & Drop) ===== */
.column-picker {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: stretch;
}

.column-picker-zone {
    display: flex;
    flex-direction: column;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.column-picker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.9em;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.column-picker-header.selected {
    color: #667eea;
    background: rgba(102,126,234,0.05);
    border-bottom-color: rgba(102,126,234,0.2);
}

.column-picker-count {
    background: #e9ecef;
    color: #6c757d;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-left: auto;
}

.column-picker-header.selected .column-picker-count {
    background: rgba(102,126,234,0.15);
    color: #667eea;
}

.column-picker-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.column-drop-zone {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.column-drop-zone.drag-over {
    background: rgba(102,126,234,0.06);
    border: 2px dashed #667eea;
    border-radius: 0 0 10px 10px;
}

.column-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s;
    font-size: 0.9em;
    font-weight: 500;
    color: #2c3e50;
    user-select: none;
}

.column-card:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.03);
    transform: translateX(2px);
}

.column-card:active { cursor: grabbing; }

.column-card.dragging {
    opacity: 0.4;
    border-style: dashed;
}

.column-card .drag-handle {
    color: #bdc3c7;
    font-size: 0.9em;
    flex-shrink: 0;
}

.column-card .column-name {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.column-card .column-type {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0f2f5;
    color: #6c757d;
    flex-shrink: 0;
}

.column-card .column-order {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
}

.column-card .column-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #e74c3c;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0;
}

.column-card:hover .column-remove { opacity: 1; }
.column-card .column-remove:hover { background: rgba(231,76,60,0.1); }

.column-alias-input {
    flex: 1;
    min-width: 80px;
    max-width: 140px;
    padding: 2px 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.78em;
    color: #555;
    background: #fafafa;
    transition: border-color 0.2s;
}
.column-alias-input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
}
.column-alias-input::placeholder {
    color: #bbb;
    font-style: italic;
}

#selectedColumns .column-card {
    border-left: 3px solid #667eea;
}

.column-drop-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bdc3c7;
    font-size: 0.85em;
    padding: 30px;
    text-align: center;
}

/* ===== TOOLTIP ICON ===== */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    font-size: 0.7em;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    margin-left: 4px;
    vertical-align: middle;
    transition: all 0.2s;
}

.tooltip-icon:hover {
    background: #667eea;
    color: white;
}

.tooltip-icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tooltip-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 9999;
}

.tooltip-icon:hover::after,
.tooltip-icon:hover::before {
    opacity: 1;
}

/* ===== COLLAPSIBLE SECTIONS ===== */
.collapsible-section {
    margin-bottom: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
    transition: all 0.2s;
    user-select: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.collapsible-header:hover {
    background: #eef0f3;
}

.collapsible-header i.fa-chevron-right {
    transition: transform 0.3s;
    font-size: 0.75em;
    color: #95a5a6;
    margin-left: auto;
}

.collapsible-section.open .collapsible-header i.fa-chevron-right {
    transform: rotate(90deg);
}

.collapsible-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.collapsible-section.open .collapsible-body {
    max-height: 2000px;
}

.collapsible-body-inner {
    padding: 16px;
}

/* ===== FORM ENHANCEMENTS FOR WIZARD CONFIG ===== */
.form-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.form-group-inline label {
    font-weight: 600;
    font-size: 0.88em;
    white-space: nowrap;
    min-width: 130px;
}

.form-group-inline select,
.form-group-inline input[type="text"],
.form-group-inline input[type="number"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.3s;
}

.form-group-inline select:focus,
.form-group-inline input:focus {
    border-color: #667eea;
}

.form-check-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.form-check-custom input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.form-check-custom label {
    font-weight: 500;
    font-size: 0.9em;
    cursor: pointer;
}

.config-hint {
    color: #95a5a6;
    font-size: 0.82em;
    margin-top: 4px;
    font-style: italic;
}

/* ===== FILTER VARIABLE MODE ===== */
.filter-row .filter-variable,
.filter-row .filter-hardcoded {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.3s;
    width: 100%;
}

.filter-row .filter-variable:focus,
.filter-row .filter-hardcoded:focus {
    border-color: #667eea;
}

.filter-row .filter-variable {
    background: #f0f2f5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        max-height: none;
    }
}

/* ===== REPORT DATA SOURCES PANEL ===== */

.report-datasources-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    overflow: hidden;
}

.rds-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    cursor: pointer;
    user-select: none;
}

.rds-panel-header h4 {
    flex: 1;
    font-size: 0.95em;
    margin: 0;
    color: #495057;
}

.rds-badge {
    background: #667eea;
    color: white;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.8em;
    font-weight: 600;
}

.rds-toggle { color: #6c757d; transition: transform 0.2s; }
.rds-panel-body.collapsed { display: none; }
.rds-panel-body.collapsed ~ .rds-panel-header .rds-toggle { transform: rotate(-90deg); }

.rds-panel-body { padding: 15px 18px; }

.rds-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rds-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 220px;
    max-width: 350px;
    flex: 1;
    transition: border-color 0.2s;
}

.rds-card:hover { border-color: #667eea; }

.rds-card-label {
    font-weight: 600;
    font-size: 0.92em;
    color: #2c3e50;
    margin-bottom: 2px;
}

.rds-card-source {
    font-size: 0.82em;
    color: #6c757d;
}

.rds-card-params {
    font-size: 0.78em;
    color: #868e96;
    margin-top: 4px;
    font-style: italic;
}

.rds-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.rds-card-actions button {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 0.8em;
    color: #6c757d;
    transition: all 0.2s;
}

.rds-card-actions button:hover { background: #667eea; color: white; border-color: #667eea; }
.rds-card-actions button.btn-danger:hover { background: #e74c3c; border-color: #e74c3c; }

/* ===== DATA VIEWER TABS ===== */

.data-viewer-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 16px;
}

.dv-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9em;
    color: #6c757d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dv-tab:hover { color: #667eea; }
.dv-tab.active { color: #667eea; border-bottom-color: #667eea; font-weight: 600; }

.dv-tab-content { display: none; }
.dv-tab-content.active { display: block; }

/* ===== RAW DATA PAGINATION ===== */
.raw-data-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 0;
    margin-top: 10px;
    border-top: 1px solid #e9ecef;
}

/* ===== BTN OUTLINE ===== */
.btn-outline-secondary {
    background: transparent;
    border: 2px solid #6c757d;
    color: #6c757d;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-outline-secondary:hover { background: #6c757d; color: white; }

/* ===== CONDITIONAL FORMATTING RULES (Group-based) ===== */
.cf-group {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.cf-group:hover {
    border-color: #667eea;
}

.cf-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cf-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88em;
    color: #667eea;
}

.cf-group-title select.cf-logic {
    padding: 3px 8px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 600;
    color: #667eea;
    background: white;
    outline: none;
    cursor: pointer;
}

.cf-group-conditions {
    margin-bottom: 8px;
}

.cf-condition-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    padding: 6px 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cf-condition-row select,
.cf-condition-row input[type="text"] {
    padding: 5px 8px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82em;
    outline: none;
    transition: border-color 0.2s;
    flex: 1;
    min-width: 80px;
}

.cf-condition-row select.cf-column { max-width: 180px; }
.cf-condition-row select.cf-operator { max-width: 100px; flex: 0 0 auto; }
.cf-condition-row select.cf-compare-type { max-width: 90px; flex: 0 0 auto; }

.cf-condition-row select:focus,
.cf-condition-row input[type="text"]:focus {
    border-color: #667eea;
}

.cf-add-condition-btn {
    font-size: 0.82em !important;
    padding: 4px 10px !important;
    margin-bottom: 10px;
}

.cf-group-style {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px dashed #dee2e6;
}

.cf-style-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cf-style-group label {
    font-size: 0.82em;
    font-weight: 600;
    color: #6c757d;
    white-space: nowrap;
}

.cf-style-group select {
    padding: 5px 8px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82em;
    outline: none;
}

.cf-style-group select:focus {
    border-color: #667eea;
}

.cf-style-group input[type="color"] {
    width: 32px;
    height: 28px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    padding: 1px;
    background: white;
}

.cf-style-group input[type="color"]:hover {
    border-color: #667eea;
}

/* Conditional format icon in table cells */
.cf-icon {
    margin-right: 4px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .header-bar { flex-direction: column; align-items: flex-start; }
    .main-container { padding: 15px; }
    .cards-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .viz-type-grid { grid-template-columns: repeat(2, 1fr); }
    .top-nav { padding: 0 15px; }
}
