/* ===================================
   REPORTS HOME & FILTER BUILDER
   =================================== */

/* Reports Home Container */
.reports-home-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    background: transparent;
}

.reports-home-header {
    margin-bottom: 3rem;
}

.reports-home-header h1 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.reports-home-header p {
    color: #6b7280;
    font-size: 1rem;
}

/* Quick Templates Section */
.quick-templates-section {
    margin-bottom: 2rem;
}

.quick-templates-section h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.template-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.template-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.template-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

/* Template icon wrapper - Policy Hub style */
.template-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.template-icon-wrapper i {
    width: 24px;
    height: 24px;
    color: #0284c7;
    stroke-width: 1.75;
}

/* Icon color variants - matching Policy Hub KPI cards (deeper/more vibrant) */
.template-icon-wrapper.icon-blue {
    background: linear-gradient(135deg, #93c5fd 0%, #bfdbfe 100%);
}
.template-icon-wrapper.icon-blue i {
    color: #1e40af;
}

.template-icon-wrapper.icon-teal {
    background: linear-gradient(135deg, #5eead4 0%, #99f6e4 100%);
}
.template-icon-wrapper.icon-teal i {
    color: #0f766e;
}

.template-icon-wrapper.icon-amber {
    background: linear-gradient(135deg, #fcd34d 0%, #fde68a 100%);
}
.template-icon-wrapper.icon-amber i {
    color: #92400e;
}

.template-icon-wrapper.icon-red {
    background: linear-gradient(135deg, #fca5a5 0%, #fecaca 100%);
}
.template-icon-wrapper.icon-red i {
    color: #991b1b;
}

.template-icon-wrapper.icon-green {
    background: linear-gradient(135deg, #86efac 0%, #bbf7d0 100%);
}
.template-icon-wrapper.icon-green i {
    color: #166534;
}

.template-icon-wrapper.icon-purple {
    background: linear-gradient(135deg, #c4b5fd 0%, #ddd6fe 100%);
}
.template-icon-wrapper.icon-purple i {
    color: #5b21b6;
}

.template-icon-wrapper.icon-orange {
    background: linear-gradient(135deg, #fdba74 0%, #fed7aa 100%);
}
.template-icon-wrapper.icon-orange i {
    color: #9a3412;
}

.template-content h3 {
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.template-timeframe {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.template-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.template-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #f59e0b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
}

/* Categories Section */
.categories-section {
    margin-bottom: 2rem;
}

.categories-section h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ===================================
   HYBRID CATEGORY CARDS (Corporate Blues)
   =================================== */

.category-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.2s;
}

.category-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Disabled entire card */
.category-card.card-disabled {
    opacity: 0.5;
    filter: grayscale(60%);
    cursor: not-allowed;
}

.category-card.card-disabled:hover {
    box-shadow: none;
    transform: none;
}

.category-card.card-disabled .category-item {
    cursor: not-allowed;
}

.category-card.card-disabled .category-item:hover {
    background: #f8fafc;
    border-color: transparent;
}

/* Color variants for left border */
.category-card.blue { border-left-color: #3b82f6; }
.category-card.sky { border-left-color: #0ea5e9; }
.category-card.indigo { border-left-color: #6366f1; }
.category-card.cyan { border-left-color: #06b6d4; }
.category-card.slate { border-left-color: #64748b; }
.category-card.violet { border-left-color: #8b5cf6; }

/* Header with gradient */
.category-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Gradient backgrounds per color */
.category-card.blue .category-header {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border-bottom-color: #dbeafe;
}
.category-card.sky .category-header {
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
    border-bottom-color: #e0f2fe;
}
.category-card.indigo .category-header {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border-bottom-color: #e0e7ff;
}
.category-card.cyan .category-header {
    background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%);
    border-bottom-color: #cffafe;
}
.category-card.slate .category-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom-color: #e2e8f0;
}
.category-card.violet .category-header {
    background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
    border-bottom-color: #ede9fe;
}

/* Colored icon box */
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-icon i {
    width: 24px;
    height: 24px;
}

/* Icon box colors */
.category-card.blue .category-icon {
    background: linear-gradient(135deg, #93c5fd 0%, #bfdbfe 100%);
}
.category-card.blue .category-icon i { color: #1e40af; }

.category-card.sky .category-icon {
    background: linear-gradient(135deg, #7dd3fc 0%, #bae6fd 100%);
}
.category-card.sky .category-icon i { color: #0369a1; }

.category-card.indigo .category-icon {
    background: linear-gradient(135deg, #a5b4fc 0%, #c7d2fe 100%);
}
.category-card.indigo .category-icon i { color: #3730a3; }

.category-card.cyan .category-icon {
    background: linear-gradient(135deg, #67e8f9 0%, #a5f3fc 100%);
}
.category-card.cyan .category-icon i { color: #0e7490; }

.category-card.slate .category-icon {
    background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
}
.category-card.slate .category-icon i { color: #334155; }

.category-card.violet .category-icon {
    background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
}
.category-card.violet .category-icon i { color: #5b21b6; }

.category-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

/* Card body */
.category-body {
    padding: 1rem 1.5rem 1.25rem;
}

.category-description {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* List items */
.category-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.875rem;
    background: #f8fafc;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    text-decoration: none;
}

.category-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.category-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

.category-item.disabled:hover {
    background: #f1f5f9;
    border-color: transparent;
}

.category-item.disabled .item-icon {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.category-item.disabled .item-icon i {
    color: #94a3b8;
}

.category-item.disabled .item-name {
    color: #94a3b8;
}

.item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-icon i {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.item-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

/* Badges */
.item-badge {
    background: #3b82f6;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 26px;
    text-align: center;
}

.item-badge.zero {
    background: #e2e8f0;
    color: #64748b;
}

.phase-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.item-arrow {
    color: #94a3b8;
    width: 18px;
    height: 18px;
    transition: transform 0.15s;
}

.category-item:hover .item-arrow {
    transform: translateX(3px);
    color: #64748b;
}

/* Future card footer */
.category-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

.future-badge {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* Legacy styles - keep for backward compatibility */
.category-card.category-active {
    border-color: #3b82f6;
}

.category-card.category-future {
    opacity: 0.5;
    filter: grayscale(60%);
}

/* Filter Builder Container */
.filter-builder-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 1.5rem;
}

.btn-back:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #cbd5e1;
}

.btn-back i {
    width: 16px;
    height: 16px;
}

/* Page Header */
.filter-builder-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.filter-builder-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.filter-builder-header h1 i {
    width: 24px;
    height: 24px;
    color: #64748b;
}

.filter-builder-header p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

/* Quick Templates Row */
.quick-templates-row {
    margin-bottom: 2rem;
}

.quick-templates-row .section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-templates-row .section-title i {
    width: 16px;
    height: 16px;
}

.templates-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.template-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 200px;
    flex: 0 0 auto;
}

.template-chip:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.template-chip .chip-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.template-chip .chip-icon i {
    width: 20px;
    height: 20px;
}

.template-chip .chip-icon.blue {
    background: linear-gradient(135deg, #93c5fd 0%, #bfdbfe 100%);
}
.template-chip .chip-icon.blue i { color: #1e40af; }

.template-chip .chip-icon.teal {
    background: linear-gradient(135deg, #5eead4 0%, #99f6e4 100%);
}
.template-chip .chip-icon.teal i { color: #0f766e; }

.template-chip .chip-icon.amber {
    background: linear-gradient(135deg, #fcd34d 0%, #fde68a 100%);
}
.template-chip .chip-icon.amber i { color: #92400e; }

.template-chip .chip-icon.red {
    background: linear-gradient(135deg, #fca5a5 0%, #fecaca 100%);
}
.template-chip .chip-icon.red i { color: #991b1b; }

.template-chip .chip-icon.green {
    background: linear-gradient(135deg, #86efac 0%, #bbf7d0 100%);
}
.template-chip .chip-icon.green i { color: #166534; }

.template-chip .chip-icon.purple {
    background: linear-gradient(135deg, #c4b5fd 0%, #ddd6fe 100%);
}
.template-chip .chip-icon.purple i { color: #6b21a8; }

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

.chip-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.chip-content span {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
}

/* Filter Builder Card */
.filter-builder-main {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.filter-builder-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.filter-builder-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.filter-builder-card-header h2 i {
    width: 18px;
    height: 18px;
    color: #64748b;
}

.filter-builder-controls {
    display: flex;
    gap: 8px;
}

.btn-text {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-text:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-text i {
    width: 14px;
    height: 14px;
}

.filter-builder-card-body {
    padding: 1.5rem 2rem;
}

/* Filters List */
.filters-list {
    min-height: 100px;
}

/* Empty State */
.filters-empty-state {
    text-align: center;
    padding: 2rem 1.5rem;
}

.filters-empty-state .empty-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.filters-empty-state .empty-icon i {
    width: 26px;
    height: 26px;
    color: #94a3b8;
}

.filters-empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.375rem;
}

.filters-empty-state p {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.empty-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.empty-actions .btn-primary,
.empty-actions .btn-secondary {
    padding: 10px 20px;
    font-size: 0.85rem;
}

.empty-actions .btn-primary i,
.empty-actions .btn-secondary i {
    width: 16px;
    height: 16px;
}

/* Card Footer */
.filter-builder-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.result-limit-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #64748b;
}

.result-limit-select {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
    color: #1e293b;
    cursor: pointer;
    min-width: 70px;
}

.result-limit-select:hover {
    border-color: #cbd5e1;
}

.result-limit-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-count {
    font-size: 0.8rem;
    color: #3b82f6;
    background: #eff6ff;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.footer-hint {
    font-size: 0.8rem;
    color: #94a3b8;
}

.btn-apply {
    padding: 12px 28px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-apply:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-apply:disabled:hover {
    transform: none;
}

.btn-apply i {
    width: 18px;
    height: 18px;
}

/* Filter Row */
.filter-row {
    display: grid;
    grid-template-columns: 250px 1fr auto;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    align-items: start;
}

.filter-type-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.filter-type-label strong {
    color: #1f2937;
    font-size: 0.875rem;
}

.filter-criteria-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-text-input,
.filter-criteria-column input[type="text"],
.filter-criteria-column input[type="date"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-actions-column {
    display: flex;
    align-items: center;
}

.btn-remove-filter {
    width: 32px;
    height: 32px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-filter:hover {
    background: #dc2626;
}

/* Checkbox Group */
.checkbox-group,
.dropdown-multi {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.375rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Date Range Input */
.date-range-input {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.date-inputs {
    display: flex;
    gap: 1rem;
}

.date-inputs label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #374151;
}

.date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.date-presets span {
    font-size: 0.875rem;
    color: #6b7280;
}

.btn-preset {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preset:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.btn-preset.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

/* Add Filter Section */
.add-filter-section {
    margin: 2rem 0;
    text-align: center;
}

.btn-add-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-filter:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* Add Filter Menu */
.add-filter-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 0;
    z-index: 1000;
    max-width: 420px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.add-filter-menu-content {
    overflow-y: auto;
    padding: 16px;
}

.add-filter-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    position: sticky;
    top: 0;
}

.add-filter-menu-header svg {
    width: 20px;
    height: 20px;
    color: #3b82f6;
}

.add-filter-menu-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.add-filter-menu-content h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: #1f2937;
}

.filter-category-group {
    margin-bottom: 1.5rem;
}

/* RPT-D3: Enhanced Category Headers */
.filter-category-group h4,
.filter-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0.75rem;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f9fafb;
    border-radius: 6px;
}

.filter-category-header svg {
    width: 14px;
    height: 14px;
    color: #9ca3af;
}

.filter-category-count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 6px;
    background: #e5e7eb;
    border-radius: 10px;
    color: #6b7280;
}

/* RPT-D3: Enhanced Filter Option Buttons */
.filter-option-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.filter-option-btn:hover {
    background: #f0f9ff;
    border-color: #3b82f6;
    transform: translateX(4px);
}

.filter-option-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    flex-shrink: 0;
}

.filter-option-icon svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
}

.filter-option-btn:hover .filter-option-icon {
    background: #dbeafe;
}

.filter-option-btn:hover .filter-option-icon svg {
    color: #2563eb;
}

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

.filter-option-label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1f2937;
    margin-bottom: 2px;
}

.filter-option-desc {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
}

.filter-option-arrow {
    flex-shrink: 0;
    color: #d1d5db;
    transition: color 0.2s;
}

.filter-option-arrow svg {
    width: 16px;
    height: 16px;
}

.filter-option-btn:hover .filter-option-arrow {
    color: #3b82f6;
}

/* Results Preview */
.results-preview {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 1rem;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e40af;
}

/* Apply Actions */
.filter-apply-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Autocomplete */
.autocomplete-input {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-result {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.autocomplete-result:hover {
    background: #f3f4f6;
}

.autocomplete-result:last-child {
    border-bottom: none;
}

.autocomplete-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
}

.autocomplete-no-results {
    padding: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .reports-home-container,
    .filter-builder-container {
        padding: 1rem;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .date-inputs {
        flex-direction: column;
    }
    
    .filter-apply-actions {
        flex-direction: column;
    }
}


/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-input {
    resize: vertical;
    font-family: inherit;
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.icon-option {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.1);
}

.icon-option.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.template-filter-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

/* ============================================
   TEMPLATE CARD UPDATES
   ============================================ */

.template-card {
    position: relative;
    cursor: pointer;
}

.template-delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
    color: #ef4444;
}

.template-card:hover .template-delete-btn {
    opacity: 1;
}

.template-delete-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

.template-meta {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.section-header-with-action {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Update existing template card hover */
.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Remove "Coming Soon" badge styles if they exist */
.template-badge {
    display: none;
}


/* ============================================
   FILTER SUMMARY BAR
   ============================================ */

.filter-summary-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}

.filter-info {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-info i {
    margin-top: 0.125rem;
}

.filter-info strong {
    font-weight: 600;
}

.active-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.filter-tag button {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.filter-tag button:hover {
    opacity: 1;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.filter-actions .btn-sm {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    backdrop-filter: blur(10px);
}

.filter-actions .btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   NO RESULTS STATE
   ============================================ */

.no-results-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.no-results-state i {
    width: 64px;
    height: 64px;
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.no-results-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.no-results-state p {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.no-results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ============================================
   RESPONSIVE UPDATES
   ============================================ */

@media (max-width: 768px) {
    .filter-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-actions {
        width: 100%;
    }
    
    .filter-actions .btn-sm {
        flex: 1;
    }
    
    .active-filter-tags {
        margin-top: 0.75rem;
    }
}


/* ============================================
   VALIDATION & ERROR STATES
   ============================================ */

.filter-error {
    animation: shake 0.3s ease;
    border: 2px solid #ef4444 !important;
    border-radius: 8px;
    background: #fef2f2 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.filter-error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    grid-column: 1 / -1;
}

.filter-error-message i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Loading states */
.btn-primary[disabled],
.btn-secondary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary[disabled] i,
.btn-secondary[disabled] i {
    animation: spin 1s linear infinite;
}

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

/* Keyboard shortcut hints */
.keyboard-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: 0.5rem;
}

.keyboard-hint kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-family: monospace;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Focus states for accessibility */
.form-input:focus,
.filter-text-input:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Better checkbox/radio focus */
input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Improved button focus */
button:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Autocomplete improvements */
.autocomplete-input input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Filter row improvements */
.filter-row {
    transition: all 0.2s ease;
}

.filter-row:hover {
    background: #f9fafb;
}

/* Add filter button hover effect */
.btn-add-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-add-filter:active {
    transform: translateY(0);
}

/* Apply button loading state */
.btn-large {
    min-width: 200px;
    transition: all 0.2s ease;
}

.btn-large:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.btn-large:active:not([disabled]) {
    transform: translateY(0);
}

/* Toast notification improvements */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    min-width: 300px;
    margin-bottom: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease;
}

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

.toast.toast-success {
    border-left: 4px solid #10b981;
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast.toast-info {
    border-left: 4px solid #3b82f6;
}

/* Improved empty state */
.filter-empty-state {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.filter-empty-state i {
    width: 48px;
    height: 48px;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.filter-empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.filter-empty-state p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Results preview improvements */
.results-preview {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e40af;
    font-weight: 500;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.results-preview i {
    width: 16px;
    height: 16px;
}

/* Mobile improvements */
@media (max-width: 768px) {
    .filter-error-message {
        font-size: 0.8125rem;
        padding: 0.625rem;
    }
    
    .keyboard-hint {
        display: none; /* Hide keyboard hints on mobile */
    }
    
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}


/* ============================================
   SKELETON LOADERS & LOADING STATES
   Phase 3: RPT-P0-3 Loading State UI
   ============================================ */

/* Skeleton pulse animation */
@keyframes skeleton-pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        opacity: 1;
    }
}

.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite, skeleton-shimmer 1.5s ease-in-out infinite;
}

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

/* Skeleton card for categories */
.skeleton-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    pointer-events: none;
}

.skeleton-card .category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #e2e8f0;
}

.skeleton-title {
    height: 20px;
    width: 140px;
    border-radius: 4px;
    background: #e2e8f0;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    border-radius: 4px;
    background: #e2e8f0;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.skeleton-item {
    height: 44px;
    border-radius: 8px;
    background: #e2e8f0;
}

/* Skeleton template buttons */
.skeleton-template {
    height: 36px;
    width: 120px;
    border-radius: 6px;
    background: #e2e8f0;
}

/* Loading spinner */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 1rem;
}

.loading-spinner-container p {
    color: #64748b;
    font-size: 0.875rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Inline loading indicator */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
}

.loading-inline::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Quick templates loading */
.quick-templates-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .skeleton-pulse {
        background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    }
    
    .skeleton-card {
        background: #1e293b !important;
        border-color: #334155 !important;
    }
    
    .skeleton-icon,
    .skeleton-title,
    .skeleton-text,
    .skeleton-item,
    .skeleton-template {
        background: #334155;
    }
    
    .loading-spinner {
        border-color: #334155;
        border-top-color: #60a5fa;
    }
    
    .loading-spinner-container p,
    .loading-inline {
        color: #94a3b8;
    }
}


/* ============================================
   ERROR STATE UI
   Phase 4: RPT-P0-2 Error State UI
   ============================================ */

.error-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 400px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin: 2rem auto;
    max-width: 500px;
}

.error-state-icon {
    width: 64px;
    height: 64px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.error-state-icon i {
    width: 32px;
    height: 32px;
    color: #dc2626;
}

.error-state-container h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.75rem 0;
}

.error-state-container .error-message {
    color: #64748b;
    font-size: 0.9375rem;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.error-details {
    width: 100%;
    margin-bottom: 1.5rem;
    text-align: left;
}

.error-details summary {
    cursor: pointer;
    color: #64748b;
    font-size: 0.8125rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.15s;
}

.error-details summary:hover {
    background: #f8fafc;
}

.error-details pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    overflow-x: auto;
    color: #475569;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.error-actions .btn-primary,
.error-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.error-actions .btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
}

.error-actions .btn-primary:hover {
    background: #2563eb;
}

.error-actions .btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.error-actions .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.error-actions i {
    width: 16px;
    height: 16px;
}

.error-help {
    color: #94a3b8;
    font-size: 0.8125rem;
    margin: 0;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .error-state-container {
        background: #1e293b;
        border-color: #334155;
    }
    
    .error-state-icon {
        background: rgba(220, 38, 38, 0.15);
    }
    
    .error-state-container h2 {
        color: #f1f5f9;
    }
    
    .error-state-container .error-message {
        color: #94a3b8;
    }
    
    .error-details summary:hover {
        background: #334155;
    }
    
    .error-details pre {
        background: #0f172a;
        border-color: #334155;
        color: #94a3b8;
    }
    
    .error-actions .btn-secondary {
        background: #334155;
        color: #e2e8f0;
        border-color: #475569;
    }
    
    .error-actions .btn-secondary:hover {
        background: #475569;
    }
}


/* ============================================
   RPT-P2-3: Category Cards Below Fold Fix
   Collapsible sections & anchor links
   ============================================ */

/* Collapsible section toggle */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.section-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.section-toggle-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.section-toggle-btn i {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.section-toggle-btn.collapsed i {
    transform: rotate(-90deg);
}

/* Collapsible content */
.section-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    max-height: 1000px;
    opacity: 1;
}

.section-collapsible.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Anchor jump links */
.section-anchor-links {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.anchor-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.anchor-link:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.anchor-link i {
    width: 14px;
    height: 14px;
}

/* Scroll margin for anchored sections */
.quick-templates-section,
.categories-section {
    scroll-margin-top: 1rem;
}

/* ============================================
   RPT-P2-5: Active/Selected Template State
   ============================================ */

/* Active template card state */
.template-card.template-active,
.template-card.template-selected {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.1);
}

.template-card.template-active::before,
.template-card.template-selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 8px 8px 0 0;
}

/* Currently Applied badge */
.template-active-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.template-active-badge i {
    width: 10px;
    height: 10px;
}

/* Template chip active state (in Filter Builder) */
.template-chip.template-active,
.template-chip.template-selected {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.template-chip.template-active .chip-content h4,
.template-chip.template-selected .chip-content h4 {
    color: #1e40af;
}

/* Checkmark indicator for selected template */
.template-card.template-active .template-icon-wrapper::after,
.template-chip.template-active .chip-icon::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-icon-wrapper {
    position: relative;
}

.chip-icon {
    position: relative;
}

/* Pulse animation for active template */
@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.1);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.15);
    }
}

.template-card.template-active {
    animation: activePulse 2s ease-in-out infinite;
}

/* Remove animation on hover to prevent jank */
.template-card.template-active:hover {
    animation: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 8px 16px rgba(59, 130, 246, 0.15);
}


/* ============================================
   RPT-P2-1: Filter Summary Badge
   Shows what filters are applied, not just count
   ============================================ */

.filter-summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #1e40af;
    cursor: default;
    position: relative;
    max-width: 400px;
}

.filter-summary-count {
    font-weight: 600;
    white-space: nowrap;
}

.filter-summary-divider {
    color: #93c5fd;
}

.filter-summary-text {
    color: #3b82f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tooltip for full filter details */
.filter-summary-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 220px;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
}

.filter-summary-badge:hover .filter-summary-tooltip {
    opacity: 1;
    visibility: visible;
}

.filter-summary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: white;
}

.filter-summary-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #e2e8f0;
}

.filter-tooltip-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid #e2e8f0;
}

.filter-tooltip-item {
    font-size: 0.8125rem;
    color: #334155;
    padding: 0.25rem 0;
    line-height: 1.4;
}

.filter-tooltip-item strong {
    color: #1e293b;
    font-weight: 500;
}

/* ============================================
   RPT-D1: Visual Hierarchy - Quick Filter Cards
   Urgency indicators with color-coded badges
   ============================================ */

/* Urgency badge on template cards */
.template-urgency-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.template-urgency-badge i {
    width: 10px;
    height: 10px;
}

/* Urgency levels */
.template-urgency-badge.urgency-critical {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
    animation: urgencyPulse 2s ease-in-out infinite;
}

.template-urgency-badge.urgency-high {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.template-urgency-badge.urgency-normal {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

@keyframes urgencyPulse {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5);
    }
}

/* Count badge inside template card */
.template-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
}

.template-count-badge.count-zero {
    background: #f1f5f9;
    color: #94a3b8;
}

.template-count-badge.count-low {
    background: #dcfce7;
    color: #166534;
}

.template-count-badge.count-medium {
    background: #fef3c7;
    color: #92400e;
}

.template-count-badge.count-high {
    background: #fee2e2;
    color: #991b1b;
}

/* Visual hierarchy - overdue items stand out */
.template-card.has-overdue {
    border-color: #fca5a5;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.template-card.has-overdue:hover {
    border-color: #f87171;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.template-card.has-overdue .template-icon-wrapper {
    background: linear-gradient(135deg, #fca5a5 0%, #fecaca 100%);
}

.template-card.has-overdue .template-icon-wrapper i {
    color: #991b1b;
}

/* High priority styling */
.template-card.high-priority {
    border-color: #fcd34d;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.template-card.high-priority:hover {
    border-color: #fbbf24;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}


/* ============================================
   RPT-P2-2: Filter URL Persistence
   Copy shareable link button
   ============================================ */

.btn-copy-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 0.75rem;
}

.btn-copy-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.btn-copy-link:active {
    background: #e2e8f0;
}

.btn-copy-link i {
    width: 14px;
    height: 14px;
}

/* Success state after copying */
.btn-copy-link.copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.btn-copy-link.copied i {
    color: #16a34a;
}


/* ============================================
   RPT-D4: Enhanced Results Preview
   Shows sample campaign names
   ============================================ */

.preview-sample {
    color: #64748b;
    font-weight: 400;
    font-size: 0.8125rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-count.has-results .preview-sample {
    color: #059669;
}

.preview-count.no-results .preview-sample {
    display: none;
}

/* Enhanced preview count styling */
.preview-count {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #166534;
}

.preview-count i {
    width: 16px;
    height: 16px;
    color: #22c55e;
}

.preview-count.no-results {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.preview-count.no-results i {
    color: #ef4444;
}

.preview-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #64748b;
}

.preview-loading i {
    width: 14px;
    height: 14px;
    animation: spin 1s linear infinite;
}

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


/* ============================================
   RPT-P2-8: Mobile Responsiveness
   Comprehensive mobile-first responsive design
   ============================================ */

/* Small phones (< 480px) */
@media (max-width: 480px) {
    .reports-home-container,
    .filter-builder-container {
        padding: 0.75rem;
    }
    
    .reports-home-header h1 {
        font-size: 1.5rem;
    }
    
    .quick-templates-section h2,
    .categories-section h2 {
        font-size: 1.25rem;
    }
    
    /* Template cards - full width, compact */
    .template-card {
        padding: 1rem;
    }
    
    .template-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .template-icon-wrapper i {
        width: 20px;
        height: 20px;
    }
    
    .template-content h3 {
        font-size: 0.9rem;
    }
    
    .template-content p {
        font-size: 0.8rem;
    }
    
    /* Category cards - compact */
    .category-header {
        padding: 1rem;
    }
    
    .category-icon {
        width: 40px;
        height: 40px;
    }
    
    .category-body {
        padding: 0.75rem 1rem;
    }
    
    .category-item {
        padding: 0.625rem;
    }
    
    /* Filter builder - stack everything */
    .filter-builder-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filter-builder-controls {
        width: 100%;
        justify-content: flex-end;
    }
    
    .filter-builder-card-footer {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .footer-left {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }
    
    .filter-summary-badge {
        max-width: 100%;
    }
    
    .btn-copy-link {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .results-preview {
        width: 100%;
        justify-content: center;
    }
    
    .btn-apply {
        width: 100%;
        justify-content: center;
    }
    
    /* Filter rows - single column */
    .filter-row {
        padding: 1rem;
    }
    
    .filter-type-column,
    .filter-criteria-column {
        width: 100%;
    }
    
    /* Quick templates row in filter builder */
    .templates-row {
        flex-direction: column;
    }
    
    .template-chip {
        width: 100%;
        min-width: unset;
    }
    
    /* Date presets - wrap */
    .date-presets {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-preset {
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
        text-align: center;
    }
    
    /* Hide sample text on small screens */
    .preview-sample {
        display: none;
    }
}

/* Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .template-chip {
        min-width: calc(50% - 0.5rem);
    }
    
    .filter-summary-badge {
        max-width: 280px;
    }
    
    .preview-sample {
        max-width: 150px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .template-card,
    .category-item,
    .btn-preset,
    .checkbox-label {
        min-height: 44px;
    }
    
    .btn-apply,
    .btn-back,
    .btn-copy-link {
        min-height: 48px;
    }
    
    /* Remove hover-only effects */
    .template-card:hover,
    .category-card:hover,
    .category-item:hover {
        transform: none;
    }
    
    /* Add active state instead */
    .template-card:active,
    .category-item:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .reports-home-container {
        padding: 0.5rem 1rem;
    }
    
    .quick-templates-section,
    .categories-section {
        margin-bottom: 1rem;
    }
    
    .section-description {
        margin-bottom: 0.5rem;
    }
}

/* Print styles */
@media print {
    .filter-builder-container {
        padding: 0;
    }
    
    .btn-back,
    .btn-copy-link,
    .btn-apply,
    .filter-builder-controls {
        display: none !important;
    }
    
    .filter-row {
        break-inside: avoid;
    }
}
