/* Compact Theme Settings & Sizing Variables */
:root {
    /* Compact Sizing */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables (Default) */
:root, body.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    /* Accent colors adjusted for light theme to be accessible and vibrant */
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --primary-hover: #3730a3;
    
    --success: #059669;
    --success-glow: rgba(5, 150, 105, 0.15);
    --danger: #dc2626;
    --danger-glow: rgba(220, 38, 38, 0.15);
    --danger-hover: #b91c1c;
    --warning: #d97706;
    --warning-glow: rgba(217, 119, 6, 0.15);
    --info: #0891b2;
    --info-glow: rgba(8, 145, 178, 0.15);
    --teal: #0d9488;
    --teal-glow: rgba(13, 148, 136, 0.15);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Glow effect overlays */
    --radial-glow-1: rgba(79, 70, 229, 0.06);
    --radial-glow-2: rgba(8, 145, 178, 0.05);
    --radial-glow-3: rgba(5, 150, 105, 0.03);
    
    /* Shadow values */
    --card-shadow: 0 4px 12px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --header-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
    
    /* Scrollbar */
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.3);
    
    /* UI Element Backgrounds */
    --table-header-bg: rgba(0, 0, 0, 0.02);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-focus-border: var(--primary);
    --modal-bg: #ffffff;
    --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --toast-bg: #ffffff;
    --toast-color: #0f172a;
    
    --logo-title-gradient: linear-gradient(to right, #0f172a, #334155);
    --btn-secondary-bg: rgba(0, 0, 0, 0.04);
    --btn-secondary-hover-bg: rgba(0, 0, 0, 0.08);
    
    /* Query Builder specific adjustments */
    --qb-group-bg: rgba(0, 0, 0, 0.01);
    --qb-group-border: rgba(0, 0, 0, 0.06);
    --qb-rule-bg: rgba(0, 0, 0, 0.01);
    --qb-rule-border: rgba(0, 0, 0, 0.04);
    --qb-rule-hover-bg: rgba(0, 0, 0, 0.02);
    --qb-rule-hover-border: rgba(0, 0, 0, 0.08);
    
    --qb-formula-bg: rgba(79, 70, 229, 0.015);
    --qb-formula-border: rgba(79, 70, 229, 0.12);
    --qb-formula-hover-bg: rgba(79, 70, 229, 0.03);
    --qb-formula-hover-border: rgba(79, 70, 229, 0.2);
    
    --qb-formula-input-bg: rgba(255, 255, 255, 0.9);
    --qb-formula-input-border: rgba(0, 0, 0, 0.08);
    --qb-rule-var-bg: rgba(0, 0, 0, 0.02);
    --qb-rule-var-border: rgba(0, 0, 0, 0.04);
    --qb-rule-op-bg: rgba(255, 255, 255, 0.9);
    --qb-rule-op-border: rgba(0, 0, 0, 0.08);
    --qb-rule-val-bg: rgba(255, 255, 255, 0.9);
    --qb-rule-val-border: rgba(0, 0, 0, 0.08);
    
    --rule-logic-card-bg: rgba(0, 0, 0, 0.01);
    --rule-logic-card-hover-border: rgba(79, 70, 229, 0.2);
    --rule-logic-card-hover-shadow: rgba(79, 70, 229, 0.02);
    --login-demo-bg: rgba(0, 0, 0, 0.02);
    --demo-account-tag-bg: rgba(0, 0, 0, 0.03);
    
    /* Sandbox specific styling */
    --sandbox-status-bg: rgba(0, 0, 0, 0.03);
    --playground-form-bg: rgba(0, 0, 0, 0.02);
    --explanation-tree-bg: rgba(0, 0, 0, 0.02);
}

/* Dark Theme Variables */
body.dark-theme {
    --bg-dark: #080b11;
    --bg-card: rgba(17, 22, 37, 0.7);
    --bg-card-hover: rgba(23, 29, 48, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Neon Accent Colors */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --primary-hover: #4f46e5;
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.25);
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);
    --info: #06b6d4;
    --info-glow: rgba(6, 182, 212, 0.25);
    --teal: #14b8a6;
    --teal-glow: rgba(20, 184, 166, 0.25);
    
    /* Text Colors */
    --text-primary: #f3f4f6;
    --text-secondary: #a1a1aa;
    --text-muted: #6b7280;
    
    /* Glow effect overlays */
    --radial-glow-1: rgba(99, 102, 241, 0.1);
    --radial-glow-2: rgba(6, 182, 212, 0.08);
    --radial-glow-3: rgba(16, 185, 129, 0.04);
    
    /* Shadow values */
    --card-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    --header-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    
    /* Scrollbar */
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
    
    /* UI Element Backgrounds */
    --table-header-bg: transparent;
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-focus-border: var(--primary);
    --modal-bg: #0f1322;
    --modal-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
    --toast-bg: rgba(15, 23, 42, 0.92);
    --toast-color: white;
    
    --logo-title-gradient: linear-gradient(to right, #ffffff, #c7d2fe);
    --btn-secondary-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-hover-bg: rgba(255, 255, 255, 0.1);
    
    /* Query Builder specific adjustments */
    --qb-group-bg: rgba(255, 255, 255, 0.01);
    --qb-group-border: rgba(255, 255, 255, 0.05);
    --qb-rule-bg: rgba(255, 255, 255, 0.015);
    --qb-rule-border: rgba(255, 255, 255, 0.04);
    --qb-rule-hover-bg: rgba(255, 255, 255, 0.03);
    --qb-rule-hover-border: rgba(255, 255, 255, 0.08);
    
    --qb-formula-bg: rgba(99, 102, 241, 0.01);
    --qb-formula-border: rgba(99, 102, 241, 0.08);
    --qb-formula-hover-bg: rgba(99, 102, 241, 0.02);
    --qb-formula-hover-border: rgba(99, 102, 241, 0.15);
    
    --qb-formula-input-bg: rgba(0, 0, 0, 0.3);
    --qb-formula-input-border: rgba(255, 255, 255, 0.06);
    --qb-rule-var-bg: rgba(255, 255, 255, 0.03);
    --qb-rule-var-border: rgba(255, 255, 255, 0.04);
    --qb-rule-op-bg: rgba(0, 0, 0, 0.25);
    --qb-rule-op-border: rgba(255, 255, 255, 0.06);
    --qb-rule-val-bg: rgba(0, 0, 0, 0.25);
    --qb-rule-val-border: rgba(255, 255, 255, 0.06);
    
    --rule-logic-card-bg: rgba(255, 255, 255, 0.015);
    --rule-logic-card-hover-border: rgba(99, 102, 241, 0.15);
    --rule-logic-card-hover-shadow: rgba(99, 102, 241, 0.03);
    --login-demo-bg: rgba(0, 0, 0, 0.25);
    --demo-account-tag-bg: rgba(255, 255, 255, 0.03);
    
    /* Sandbox specific styling */
    --sandbox-status-bg: rgba(0, 0, 0, 0.2);
    --playground-form-bg: rgba(0, 0, 0, 0.12);
    --explanation-tree-bg: rgba(0, 0, 0, 0.15);
}

/* Reset & Scrollbar */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 10% 10%, var(--radial-glow-1) 0px, transparent 40%),
        radial-gradient(at 90% 90%, var(--radial-glow-2) 0px, transparent 40%),
        radial-gradient(at 50% 50%, var(--radial-glow-3) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px; /* Reduced from 14px */
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* App Containers & View switcher */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 12px; /* Reduced from 24px */
    max-width: 1750px;
    margin: 0 auto;
}

.app-view {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Reduced from 20px */
    width: 100%;
    animation: fadeSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md); /* Reduced from var(--radius-lg) */
    padding: 8px 16px; /* Reduced from 16px 24px */
    box-shadow: var(--header-shadow);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; /* Reduced from 48px */
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--radius-sm);
    box-shadow: 0 0 10px var(--primary-glow);
    color: white;
}

.logo-icon i {
    width: 18px;
    height: 18px;
}

.logo-area h1 {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.25rem; /* Reduced from 1.5rem */
    letter-spacing: -0.02em;
    background: var(--logo-title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area .subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

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

/* General Buttons styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 6px 12px; /* Reduced from 10px 18px */
    border-radius: var(--radius-sm); /* Reduced from var(--radius-md) */
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 3px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 3px 8px var(--danger-glow);
}

.btn-icon-plus {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary);
    width: 26px; /* Reduced from 32px */
    height: 26px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}
.btn-icon-plus:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Grids for Listing & Editor */
.workspace-grid {
    display: grid;
    grid-template-columns: 240px 1fr; /* Reduced from 280px */
    gap: 12px; /* Reduced from 20px */
    height: calc(100vh - 85px); /* Adjusted for compact header */
}

.editor-grid {
    display: grid;
    grid-template-columns: 240px 1fr 300px; /* Reduced width */
    gap: 12px; /* Reduced from 20px */
    align-items: start;
    height: calc(100vh - 85px); /* Adjusted for compact header */
}

@media (max-width: 1400px) {
    .editor-grid {
        grid-template-columns: 200px 1fr 260px;
    }
}

@media (max-width: 1100px) {
    .workspace-grid,
    .editor-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Panels */
.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md); /* Reduced from var(--radius-lg) */
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, var(--transition-normal);
}
.panel-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px; /* Reduced from 16px 20px */
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}
.panel-title i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}
.panel-title h2 {
    font-family: var(--font-header);
    font-size: 0.95rem; /* Reduced from 1.1rem */
    font-weight: 600;
}

.panel-body {
    padding: 12px; /* Reduced from 20px */
    overflow-y: auto;
    flex: 1;
}

/* Summary Dashboard Widgets styling */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px; /* Reduced from 16px */
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: var(--transition-fast);
}
.stat-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
}

.stat-value {
    font-family: var(--font-header);
    font-size: 1.5rem; /* Reduced from 2rem */
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 6px rgba(99, 102, 241, 0.2);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.quick-guide {
    margin-top: 16px;
}

.quick-guide h3 {
    font-family: var(--font-header);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.quick-guide ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-guide li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.quick-guide li i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 2px;
}

/* Drag Hint Box */
.drag-hint {
    background: rgba(6, 182, 212, 0.04);
    border: 1px dashed rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.78rem;
    color: #a5f3fc;
    line-height: 1.3;
}
.drag-hint i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--info);
}

/* Variables UI Cards */
.variables-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.variable-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px; /* Reduced from 12px */
    cursor: grab;
    transition: var(--transition-fast);
    position: relative;
    user-select: none;
}
.variable-item:active {
    cursor: grabbing;
}
.variable-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.variable-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.variable-label {
    font-weight: 600;
    color: var(--text-primary);
}

.variable-name {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.variable-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.variable-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition-fast);
}
.variable-item:hover .variable-actions {
    opacity: 1;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-number { background: rgba(6, 182, 212, 0.12); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.15); }
.badge-boolean { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.15); }
.badge-text { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.15); }
.badge-date { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.15); }
.badge-reporting-standard { background: rgba(168, 85, 247, 0.12); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.15); }
.badge-reporting-verification { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.15); }

.badge-live {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
    border: 1px solid var(--success-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; box-shadow: 0 0 6px var(--success-glow); }
    100% { opacity: 0.7; }
}

/* Milestone Form Control elements */
.form-control {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    padding: 6px 10px; /* Reduced from 8px 12px */
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 6px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
}

.select-control {
    padding-right: 24px;
    cursor: pointer;
    width: auto;
}

.milestone-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Premium Listing Table */
.table-container {
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    padding: 10px 12px; /* Reduced from 14px 18px */
    font-family: var(--font-header);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.premium-table td {
    padding: 8px 12px; /* Reduced from 16px 18px */
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.premium-table tr {
    transition: var(--transition-fast);
}

.premium-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

.table-milestone-name {
    font-weight: 700;
    font-family: var(--font-header);
    font-size: 0.88rem; /* Reduced from 0.95rem */
    color: var(--text-primary);
}

.table-category-tag {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

.table-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Glowing Progress Bar components */
.progress-bar-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 14px; /* Reduced from 18px */
    width: 100px; /* Reduced from 120px */
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.progress-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--primary), var(--info));
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
    transition: width 0.3s ease;
}
.progress-bar-fill.success {
    background: linear-gradient(90deg, var(--teal), var(--success));
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
    line-height: 1;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

/* ==================== EDITOR PANELS ==================== */

/* Metadata Settings Form inside Editor */
.editor-metadata-form {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 12px 16px; /* Reduced from 16px 20px */
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
}
.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

.editor-qb-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-subtitle {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}

/* Query Builder Layout inside Editor */
.query-builder-root {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.qb-group {
    border: 1px solid var(--qb-group-border);
    border-radius: var(--radius-md);
    padding: 10px; /* Reduced from 16px */
    background: var(--qb-group-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 12px */
    transition: var(--transition-fast);
    cursor: grab;
}
.qb-group:active {
    cursor: grabbing;
}

.qb-group.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.qb-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 6px;
    margin-bottom: 0px;
}

.qb-logical-op {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: default;
}

.qb-op-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.qb-op-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
}

.qb-group-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    cursor: default;
}

/* Explicit Trash Buttons (Red border + Background tint) */
.btn-qb-danger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-qb-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    box-shadow: 0 0 8px var(--danger-glow);
}

.qb-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 14px; /* Reduced from 20px */
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    min-height: 20px;
    cursor: default;
}

.qb-children::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, var(--primary), var(--info));
    opacity: 0.25;
}

/* Rule Card (Individual Conditions) */
.qb-rule {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced from 12px */
    background: var(--qb-rule-bg);
    border: 1px solid var(--qb-rule-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px; /* Reduced from 10px 14px */
    transition: var(--transition-fast);
    flex-wrap: wrap;
    position: relative;
    cursor: grab;
}
.qb-rule:hover {
    background: var(--qb-rule-hover-bg);
    border-color: var(--qb-rule-hover-border);
}

/* Weight Percentage Input field styling */
.qb-rule-pct-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(20, 184, 166, 0.03);
    border: 1px dashed rgba(20, 184, 166, 0.2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.qb-rule-pct-wrapper label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--teal);
    text-transform: uppercase;
}

.qb-rule-pct-input {
    background: transparent;
    border: none;
    color: #2dd4bf;
    font-weight: 800;
    font-size: 0.78rem;
    width: 40px;
    outline: none;
    text-align: center;
}

/* Formula Rule Layout updates */
.qb-formula {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--qb-formula-bg);
    border: 1px solid var(--qb-formula-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px; /* Reduced from 12px 14px */
    transition: var(--transition-fast);
    flex-wrap: wrap;
    position: relative;
    width: 100%;
    cursor: grab;
}
.qb-formula:hover {
    background: var(--qb-formula-hover-bg);
    border-color: var(--qb-formula-hover-border);
}

.qb-formula-inputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    min-width: 250px;
    cursor: default;
}

.qb-formula-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.qb-formula-input-box {
    flex-grow: 1;
    background: var(--qb-formula-input-bg);
    border: 1px solid var(--qb-formula-input-border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 0.8rem;
    outline: none;
    font-family: monospace;
}
.qb-formula-input-box:focus {
    border-color: var(--primary);
}

.formula-helpers {
    font-size: 0.68rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.formula-var-badge {
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    font-family: monospace;
    transition: var(--transition-fast);
    user-select: none;
}
.formula-var-badge:hover {
    background: var(--info);
    color: white;
}

.qb-rule-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: flex;
    align-items: center;
}
.qb-rule-drag-handle:active {
    cursor: grabbing;
}

.qb-rule-var-label {
    font-weight: 600;
    font-size: 0.8rem;
    background: var(--qb-rule-var-bg);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--qb-rule-var-border);
    width: auto;
}

.qb-rule-op {
    background: var(--qb-rule-op-bg);
    border: 1px solid var(--qb-rule-op-border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
}

.qb-rule-val-input {
    background: var(--qb-rule-val-bg);
    border: 1px solid var(--qb-rule-val-border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 0.8rem;
    min-width: 100px;
    outline: none;
    transition: var(--transition-fast);
}
.qb-rule-val-input:focus {
    border-color: var(--primary);
}

/* Explicit Action buttons (Delete & Duplicate) */
.btn-rule-delete {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.btn-rule-delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    box-shadow: 0 0 6px var(--danger-glow);
}

.btn-rule-copy {
    background: rgba(20, 184, 166, 0.06);
    border: 1px solid rgba(20, 184, 166, 0.15);
    color: #81e6d9;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.btn-rule-copy:hover {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
    box-shadow: 0 0 6px var(--teal-glow);
}

.btn-mini {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    width: 24px; /* Reduced from 28px */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}
.btn-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.btn-mini.danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}
.btn-text:hover {
    background: rgba(255, 255, 255, 0.04);
    color: white;
}
.btn-text.primary {
    color: var(--primary);
}
.btn-text.primary:hover {
    background: rgba(99, 102, 241, 0.06);
}

/* Sandbox Playground Layout */
.sandbox-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sandbox-status-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px; /* Reduced from 14px 18px */
    background: var(--sandbox-status-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.sandbox-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.status-lbl {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sandbox-status-card .result-badge {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.sandbox-status-card .result-badge.true {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 8px var(--success-glow);
}

.sandbox-status-card .result-badge.false {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.sandbox-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sandbox-section h4 {
    font-family: var(--font-header);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}

.playground-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--playground-form-bg);
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 200px; /* Reduced from 250px */
    overflow-y: auto;
}

.playground-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 0;
}

.playground-form label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.playground-form label code {
    font-family: monospace;
    color: var(--info);
    font-size: 0.72rem;
    margin-left: 2px;
}

/* Trace debugger hierarchy tree */
.explanation-tree {
    background: var(--explanation-tree-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px; /* Reduced from 16px */
    max-height: 280px; /* Reduced from 350px */
    overflow-y: auto;
}

.exp-node {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 10px;
    border-left: 1px dashed rgba(255, 255, 255, 0.08);
    padding-left: 8px;
}
.exp-node:first-child {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
}

.exp-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1.2;
}

.exp-header.group {
    background: rgba(255, 255, 255, 0.01);
}

.exp-header.rule {
    font-family: monospace;
}

.exp-header.true {
    color: #34d399;
    background: rgba(16, 185, 129, 0.03);
}

.exp-header.false {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.03);
}

/* Modals general */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 6, 10, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--modal-shadow);
    animation: scaleUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-container.modal-wide {
    max-width: 1100px;
    width: 95%;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    column-gap: 20px;
    row-gap: 12px;
}

.metadata-form-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.metadata-form-group.span-3 {
    grid-column: span 3;
}

.metadata-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 140px;
    text-align: right;
    flex-shrink: 0;
    margin-bottom: 0;
}

.metadata-form-group .form-control {
    flex-grow: 1;
}

@keyframes scaleUp {
    from { transform: scale(0.97); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-header h3 {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.btn-close-modal:hover {
    color: white;
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--toast-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--toast-color);
    box-shadow: var(--card-shadow);
    min-width: 220px;
    max-width: 360px;
    animation: slideIn 0.25s ease;
    backdrop-filter: blur(10px);
}

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

.toast.success { border-left: 3px solid var(--success); }
.toast.danger { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.toast-message {
    font-size: 0.8rem;
    flex-grow: 1;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}
.toast-close:hover {
    color: white;
}

.muted-text {
    color: var(--text-muted);
}
.empty-form-text {
    text-align: center;
    padding: 8px 0;
}

/* Rule Logic Card styles */
.rule-logic-card {
    background: var(--rule-logic-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px; /* Reduced from 20px */
    margin-bottom: 12px; /* Reduced from 24px */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 16px */
    box-shadow: var(--card-shadow);
    transition: var(--transition-fast);
}

.rule-logic-card:hover {
    border-color: var(--rule-logic-card-hover-border);
    box-shadow: var(--card-shadow), 0 2px 12px var(--rule-logic-card-hover-shadow);
}

.rule-logic-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px; /* Reduced from 12px */
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rule-logic-card-title {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.88rem; /* Reduced from 0.95rem */
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rule-logic-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Add Rule Logic Button styling */
#btn-add-rule-logic {
    background: linear-gradient(135deg, var(--teal), var(--primary));
    color: white;
    box-shadow: 0 3px 8px var(--teal-glow);
    border: none;
}

#btn-add-rule-logic:hover {
    background: linear-gradient(135deg, var(--teal), var(--primary-hover));
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
    transform: translateY(-1px);
}

/* Evaluation Trace styling updates */
.rule-logic-trace-header {
    margin-top: 10px; /* Reduced from 18px */
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 5px;
}

.exp-header.error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.25);
}

/* ==================== LOGIN VIEW ==================== */
.login-view-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-card-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.login-card-header h2 {
    font-family: var(--font-header);
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-demo-accounts {
    background: var(--login-demo-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.login-demo-accounts h4 {
    margin-bottom: 6px;
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 700;
}

.demo-account-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.demo-account-tag {
    background: var(--demo-account-tag-bg);
    border: 1px solid var(--border-color);
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.demo-account-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* User profile header panel */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.user-profile-badge .username {
    font-weight: 700;
    color: var(--text-primary);
}

.user-profile-badge .user-role {
    font-size: 0.68rem;
    color: var(--teal);
    text-transform: uppercase;
    font-weight: 700;
}

/* Read-only UI indicator */
.readonly-indicator {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fde68a;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Readonly overlay/restrictions on fields */
.readonly-view-disable {
    pointer-events: none;
    opacity: 0.65;
}

/* Reporting & Verification UI styling */
.btn-nav {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 8px 12px;
}
.btn-nav:hover {
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--text-primary);
}
.btn-nav.active {
    background: transparent;
    color: var(--primary);
    border-top: 1px solid transparent;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
    border-bottom: 2px solid var(--primary);
    border-radius: 0;
    font-weight: 600;
}

/* Dropzone hover states */
.dropzone.dragover {
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.08) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

/* Attachment item card */
.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
.attachment-item a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}
.attachment-item a:hover {
    text-decoration: underline;
}

/* Print Styling */
@media print {
    body * {
        visibility: hidden;
    }
    #print-area, #print-area * {
        visibility: visible;
    }
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .print-header-only {
        display: block !important;
    }
    /* Hide scrollbars, filters and action buttons when printing */
    #btn-rep-print, #btn-rep-export-csv, #rep-filter-category, .app-header, aside {
        display: none !important;
    }
}

/* Responsive Reporting workspace container styling */
.reporting-workspace {
    display: flex;
    gap: 16px;
    height: calc(100vh - 80px);
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
}

.reporting-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.reporting-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.reporting-sidebar-aside {
    width: 95px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.reporting-sidebar-aside .panel-body {
    padding: 8px !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.reporting-sidebar-aside .btn-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 2px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    width: 100%;
    height: auto;
}

.reporting-sidebar-aside .btn-nav i,
.reporting-sidebar-aside .btn-nav svg {
    width: 20px !important;
    height: 20px !important;
    margin: 0 auto 2px auto !important;
    display: block;
}

@media (max-width: 900px) {
    .reporting-workspace {
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding: 8px;
    }
    .reporting-sidebar-aside {
        width: 100% !important;
        flex-direction: row;
        flex-wrap: wrap;
        height: auto !important;
    }
    .reporting-sidebar-aside .panel-body {
        flex-direction: row !important;
        flex-wrap: wrap;
        width: 100%;
    }
    .reporting-sidebar-aside .btn-nav {
        width: auto !important;
        flex: 1;
        flex-direction: row !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-width: 120px;
        padding: 8px 12px;
    }
    .reporting-period-tree-aside {
        width: 100% !important;
        height: auto !important;
        border-left: 1px solid var(--border-color) !important;
        border-top: none !important;
    }
    .reporting-content-container {
        height: auto !important;
        overflow: visible !important;
        width: 100%;
    }
}

/* Milestone Editor Tabs System styles */
.editor-tabs-nav {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.tab-nav-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.78rem;
}

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

.tab-nav-btn.active {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.editor-tab-pane {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.editor-tab-pane.active {
    display: flex;
}

/* Compact padding adjustments to make UI less congested */
.panel-card {
    padding: 10px !important;
}
.panel-body {
    padding: 8px 0 0 0 !important;
}
.premium-table th, .premium-table td {
    padding: 6px 8px !important;
    font-size: 0.8rem !important;
}
.form-group label {
    margin-bottom: 3px !important;
}
.form-control {
    padding: 4px 8px !important;
    height: 30px !important;
    font-size: 0.8rem !important;
}
textarea.form-control {
    height: auto !important;
    padding: 6px 8px !important;
}
.rule-logic-card {
    padding: 8px !important;
    margin-bottom: 8px !important;
}
.variables-list .var-badge {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
}

/* Accordion Header Hover style */
.accordion-header-hover:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}
