/* Dashboard Styles */

/* CSS Variables for Custom Colors */
:root {
    --primary-color: #E5A443;
    --primary-dark: #0A0A0A;
    --primary-dark-hover: #1a1a1a;
    --brand-orange: #F99933;
    --brand-orange-hover: #e08423;
    --brand-blue: #3D85C6;
    --brand-black: #000000;
    --brand-white: #FFFFFF;
}

/* Body and Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: #FAFAFA;
    color: #111827;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout Container */
.app-layout {
    min-height: 100vh;
    display: flex;
    background-color: #FAFAFA;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    background-color: #0A0A0A;
    color: white;
    transition: width 0.3s;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: 16rem;
}

.sidebar.no-transition {
    transition: none !important;
}

.sidebar.collapsed {
    width: 4rem;
}

.sidebar-logo {
    height: 4rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.sidebar-logo-text {
    height: 1.25rem;
    width: auto;
    object-fit: contain;
    margin-left: 0.75rem;
}

.sidebar.collapsed .sidebar-logo-text {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.5rem;
    overflow-y: auto;
}

.sidebar-nav-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
}

.sidebar-nav-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-nav-item span {
    display: none;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-nav-item {
    position: relative;
}

.sidebar.collapsed .sidebar-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.75rem;
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    border-radius: 0.375rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sidebar.collapsed .sidebar-nav-item:hover::after {
    opacity: 1;
    visibility: visible;
}

.sidebar-bottom {
    padding: 1rem 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-collapse-btn {
    position: absolute;
    right: -0.75rem;
    top: 5rem;
    width: 1.5rem;
    height: 1.5rem;
    background-color: #0A0A0A;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sidebar-collapse-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-collapse-btn svg {
    width: 0.75rem;
    height: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content Area */
.main-content {
    flex: 1 1 auto;
    transition: margin-left 0.3s;
    margin-left: 16rem;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

.main-content.sidebar-collapsed {
    margin-left: 4rem;
}

/* Top Bar Header */
.top-bar {
    height: 4rem;
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.top-bar h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-new-matter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.top-bar-new-matter:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.top-bar-new-matter svg {
    width: 1rem;
    height: 1rem;
}

/* Top bar action buttons (Edit, Export, Delete, etc.) */
.top-bar-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.top-bar-action-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.top-bar-action-btn svg {
    width: 1rem;
    height: 1rem;
}

.top-bar-action-btn.danger,
.top-bar-action-btn[style*="color: #dc2626"] {
    color: #dc2626;
    border-color: #fecaca;
}

.top-bar-action-btn.danger:hover,
.top-bar-action-btn[style*="color: #dc2626"]:hover {
    background-color: #fef2f2;
    border-color: #fca5a5;
}

.top-bar-notification {
    position: relative;
    padding: 0.5rem;
    color: #6b7280;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.top-bar-notification:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.top-bar-notification svg {
    width: 1.25rem;
    height: 1.25rem;
}

.top-bar-notification-badge {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.top-bar-user:hover {
    background-color: #f3f4f6;
}

.top-bar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: rgba(229, 164, 67, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Page Content Wrapper */
.page-content {
    padding: 1.5rem;
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
    overflow-wrap: break-word;
}

/* Ensure matter cards don't overflow */
.matter-card-link {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.matter-card-link .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Grid gap utilities */
.gap-y-4 {
    row-gap: 1rem;
}

/* Duration transition utility */
.duration-300 {
    transition-duration: 300ms;
}

/* Z-index utilities */
.z-40 {
    z-index: 40;
}

.z-50 {
    z-index: 50;
}

/* Min height utilities */
.min-h-screen {
    min-height: 100vh;
}

/* Object contain utility */
.object-contain {
    object-fit: contain;
}

/* Hover utilities for sidebar */
.hover\:bg-white\/10:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hover\:bg-white\/5:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Text opacity utilities */
.text-white\/60 {
    color: rgba(255, 255, 255, 0.6);
}

/* Border opacity utilities */
.border-white\/10 {
    border-color: rgba(255, 255, 255, 0.1);
}

.border-white\/20 {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Background opacity utilities */
.bg-white\/10 {
    background-color: rgba(255, 255, 255, 0.1);
}

.bg-white\/5 {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Overflow utilities */
.overflow-y-auto {
    overflow-y: auto;
}

/* Position utilities */
.fixed {
    position: fixed;
}

.absolute {
    position: absolute;
}

.relative {
    position: relative;
}

.sticky {
    position: sticky;
}

/* Inset utilities */
.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Top/Right/Bottom/Left utilities */
.top-0 {
    top: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.-right-3 {
    right: -0.75rem;
}

.top-20 {
    top: 5rem;
}

.top-1\.5 {
    top: 0.375rem;
}

.right-1\.5 {
    right: 0.375rem;
}

/* Height utilities */
.h-full {
    height: 100%;
}

.h-5 {
    height: 1.25rem;
}

.h-6 {
    height: 1.5rem;
}

/* Width utilities */
.w-2 {
    width: 0.5rem;
}

.w-3 {
    width: 0.75rem;
}

.w-6 {
    width: 1.5rem;
}

.w-8 {
    width: 2rem;
}

.w-auto {
    width: auto;
}

/* Flex shrink utility */
.flex-shrink-0 {
    flex-shrink: 0;
}

/* Top Header/Navigation */
.dashboard-header {
    position: sticky;
    top: 0;
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dashboard-header-left {
    display: flex;
    align-items: center;
}

.dashboard-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.dashboard-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.new-matter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-matter-btn:hover {
    background-color: var(--primary-dark-hover);
}

.new-matter-btn svg {
    width: 1rem;
    height: 1rem;
}

.notification-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #6b7280;
}

.notification-icon:hover {
    background-color: #f3f4f6;
}

.notification-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
}

/* Base Container */
.dashboard-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 1.5rem;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 1.5rem;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.welcome-section > div {
    flex: 1;
}

.welcome-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.welcome-section p {
    color: #6b7280;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.welcome-section .ai-summary-btn {
    flex-shrink: 0;
    margin-left: auto;
}

/* AI Summary Button */
.ai-summary-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 0.5rem;
}

.ai-summary-btn:hover {
    background-color: var(--primary-dark-hover);
}

.ai-summary-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* Stat Card */
.stat-card {
    background: white;
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.stat-card .p-6 {
    padding: 1rem;
}

.stat-card .text-3xl {
    font-size: 1.5rem;
    line-height: 1.75rem;
}

.stat-card .w-12,
.stat-card .h-12 {
    width: 2.5rem;
    height: 2.5rem;
}

.stat-card .w-6,
.stat-card .h-6 {
    width: 1.25rem;
    height: 1.25rem;
}

/* Ensure stat card icons are perfectly centered */
.stat-card .w-12,
.stat-card .h-12 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

.stat-card .w-12 img,
.stat-card .h-12 img {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Ensure Recent Matters icons are perfectly centered */
.matter-item .w-10,
.matter-item .h-10 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

.matter-item .w-10 img,
.matter-item .h-10 img {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    max-width: 1.5rem !important;
    max-height: 1.5rem !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Ensure matter card metric icons are perfectly centered */
.matter-card-link .flex-1.text-center {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.matter-card-link .flex-1.text-center > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin-bottom: 0.25rem !important;
}

.matter-card-link .w-6,
.matter-card-link .h-6 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    margin: 0 auto !important;
}

.matter-card-link .w-6 img,
.matter-card-link .h-6 img {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 1rem !important;
    height: 1rem !important;
    max-width: 1rem !important;
    max-height: 1rem !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Ensure report card metric icons are perfectly centered */
.report-card-link .flex-1.text-center {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.report-card-link .flex-1.text-center > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin-bottom: 0.25rem !important;
}

.report-card-link .w-6,
.report-card-link .h-6 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    margin: 0 auto !important;
}

.report-card-link .w-6 img,
.report-card-link .h-6 img {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 1rem !important;
    height: 1rem !important;
    max-width: 1rem !important;
    max-height: 1rem !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Card Components */
.card {
    background: white;
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    min-width: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.card-header {
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.card-content {
    padding: 0;
}

/* View All Button */
.view-all-btn {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.view-all-btn:hover {
    color: #374151;
}

.view-all-btn svg {
    display: inline-block;
    vertical-align: middle;
}

/* Matter Items */
.matter-item {
    text-decoration: none;
    color: inherit;
}

/* Prevent underlining of text inside matter cards */
.matter-card-link {
    text-decoration: none;
    color: inherit;
}

.matter-card-link * {
    text-decoration: none;
}

.matter-card-link .badge,
.matter-card-link p,
.matter-card-link span:not(.group-hover\:text-\[#E5A443\]),
.matter-card-link h3 {
    text-decoration: none !important;
}

.matter-item .group:hover h3 {
    color: var(--primary-color);
}

/* Priority Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Override badge display for status badges to use flexbox */
.badge.status-reviewed,
.badge.status-pending,
.badge.status-processing,
.badge.status-saved {
    display: inline-flex !important;
}

.priority-low {
    background-color: #f1f5f9;
    color: #334155;
}

.priority-medium {
    background-color: #dbeafe;
    color: #1e40af;
}

.priority-high {
    background-color: #fed7aa;
    color: #9a3412;
}

.priority-critical {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Status Badges */
.status-active {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-closed {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.status-archived {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    height: 0.375rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.activity-item svg {
    width: 1rem;
    height: 1rem;
}

/* Quick Action Cards */
.quick-action-card {
    background: white;
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.quick-action-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.quick-action-card .group:hover > div:first-child {
    transform: scale(1.1);
}

/* Utility Classes (Tailwind-like) */
.space-y-8 > * + * {
    margin-top: 2rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.space-y-1\.5 > * + * {
    margin-top: 0.375rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid {
    display: grid;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

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

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

/* Ensure grid items don't overflow */
.grid > * {
    min-width: 0;
    max-width: 100%;
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .lg\:col-span-2 {
        grid-column: span 2 / span 2;
    }
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-gray-900 {
    color: #111827;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-white {
    color: white;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-0\.5 {
    margin-top: 0.125rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.pb-4 {
    padding-bottom: 1rem;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.w-8 {
    width: 2rem;
}

.h-8 {
    height: 2rem;
}

.w-10 {
    width: 2.5rem;
}

.h-10 {
    height: 2.5rem;
}

.w-12 {
    width: 3rem;
}

.h-12 {
    height: 3rem;
}

.h-1\.5 {
    height: 0.375rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-full {
    border-radius: 9999px;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-white {
    background-color: white;
}

.bg-black {
    background-color: black;
}

.bg-opacity-50 {
    --tw-bg-opacity: 0.5;
    background-color: rgba(0, 0, 0, var(--tw-bg-opacity));
}

.bg-\[#E5A443\] {
    background-color: #E5A443;
}

.hover\:bg-\[#d4942a\]:hover,
.hover\:bg-\[#d4933c\]:hover {
    background-color: #d4933c;
}

#add-member-btn,
#create-org-btn {
    background-color: #E5A443;
    color: #ffffff;
    font-weight: 500;
    border: 1px solid #E5A443;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

#add-member-btn:hover,
#create-org-btn:hover {
    background-color: #d4933c;
    border-color: #d4933c;
    box-shadow: 0 1px 2px rgba(229, 164, 67, 0.25);
}

#add-member-btn:disabled,
#create-org-btn:disabled {
    background-color: #e5e7eb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.bg-blue-500 {
    background-color: #3b82f6;
}

.bg-purple-500 {
    background-color: #a855f7;
}

.bg-green-500 {
    background-color: #22c55e;
}

.bg-purple-100 {
    background-color: #f3e8ff;
}

.bg-blue-100 {
    background-color: #dbeafe;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.text-\[#E5A443\] {
    color: #E5A443;
}

.text-purple-600 {
    color: #9333ea;
}

.text-blue-600 {
    color: #2563eb;
}

.text-green-600 {
    color: #16a34a;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.border-0 {
    border-width: 0;
}

.transition-shadow {
    transition-property: box-shadow;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.hover\:shadow-md:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.hover\:bg-gray-100:hover {
    background-color: #f3f4f6;
}

.hover\:bg-\[#1a1a1a\]:hover {
    background-color: #1a1a1a;
}

.hover\:text-gray-700:hover {
    color: #374151;
}

.cursor-pointer {
    cursor: pointer;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.flex-1 {
    flex: 1 1 0%;
}

.min-w-0 {
    min-width: 0;
}

.inline {
    display: inline;
}

.block {
    display: block;
}

.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.from-\[#E5A443\]\/10 {
    --tw-gradient-from: rgba(229, 164, 67, 0.1);
    --tw-gradient-to: rgba(229, 164, 67, 0);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.to-\[#E5A443\]\/5 {
    --tw-gradient-to: rgba(229, 164, 67, 0.05);
}

.from-blue-500\/10 {
    --tw-gradient-from: rgba(59, 130, 246, 0.1);
    --tw-gradient-to: rgba(59, 130, 246, 0);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.to-blue-500\/5 {
    --tw-gradient-to: rgba(59, 130, 246, 0.05);
}

.from-purple-500\/10 {
    --tw-gradient-from: rgba(168, 85, 247, 0.1);
    --tw-gradient-to: rgba(168, 85, 247, 0);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.to-purple-500\/5 {
    --tw-gradient-to: rgba(168, 85, 247, 0.05);
}

.ml-1 {
    margin-left: 0.25rem;
}

/* Matters Page Specific Styles */
.new-matter-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-matter-btn-header:hover {
    background-color: var(--primary-dark-hover);
}

.new-matter-btn-header svg {
    width: 1rem;
    height: 1rem;
}

.new-report-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-report-btn-header:hover {
    background-color: var(--primary-dark-hover);
}

.new-report-btn-header svg {
    width: 1rem;
    height: 1rem;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    background-color: #f3f4f6;
}

.view-toggle-btn.active {
    background-color: #f3f4f6;
}

.view-toggle-btn svg {
    width: 1rem;
    height: 1rem;
    color: #6b7280;
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
}

.filter-btn:hover {
    background-color: #f3f4f6;
}

.filter-btn svg {
    width: 1rem;
    height: 1rem;
}

.matter-card-link {
    text-decoration: none;
    color: inherit;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
}

.matter-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive utilities */
@media (min-width: 640px) {
    .sm\:flex-row {
        flex-direction: row;
    }
    
    .sm\:items-center {
        align-items: center;
    }
    
    .sm\:w-auto {
        width: auto;
    }
}

.translate-y-1\/2 {
    transform: translateY(-50%);
}

.-translate-y-1\/2 {
    transform: translateY(-50%);
}

/* Search Input Styling */
input[type="text"] {
    width: 100%;
    padding: 0.5rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.1);
}

/* Select Dropdown Styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.1);
}

/* Grid View Responsive */
@media (min-width: 1280px) {
    .xl\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Matter Card Hover Effects */
.matter-card-link:hover .card {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    transition: all 0.2s;
}

/* Report Card Hover Effects */
.report-card-link:hover .card {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    transition: all 0.2s;
}

/* Prevent underlining of text inside report cards */
.report-card-link {
    text-decoration: none;
    color: inherit;
}

.report-card-link * {
    text-decoration: none;
}

.report-card-link .badge,
.report-card-link p,
.report-card-link span:not(.group-hover\:text-\[#E5A443\]),
.report-card-link h3 {
    text-decoration: none !important;
}

/* Status Badge Refinements */
.status-active {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-closed {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Priority Dot Colors */
.bg-slate-500 {
    background-color: #64748b;
}

.bg-blue-500 {
    background-color: #3b82f6;
}

.bg-orange-500 {
    background-color: #f97316;
}

.bg-red-500 {
    background-color: #ef4444;
}

/* Space utilities for matters page */
.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Absolute positioning for search icon */
.absolute {
    position: absolute;
}

.left-3 {
    left: 0.75rem;
}

.top-1\/2 {
    top: 50%;
}

/* Matter card specific styles */
.mb-4 {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

/* Border utilities */
.border {
    border-width: 1px;
    border-style: solid;
    border-color: #e5e7eb;
}

.border-r {
    border-right-width: 1px;
    border-right-style: solid;
    border-right-color: #e5e7eb;
}

.border-t {
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #e5e7eb;
}

.border-gray-100 {
    border-color: #f3f4f6;
}

.border-gray-50 {
    border-color: #f9fafb;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

/* Overflow utilities */
.overflow-x-auto {
    overflow-x: auto;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-weight: 500;
}

td {
    padding: 1rem;
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* Height utilities */
.h-full {
    height: 100%;
}

/* Opacity utilities */
.opacity-0 {
    opacity: 0;
}

.group:hover .opacity-0 {
    opacity: 1;
}

.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Search Page Header Button (White with Border) */
.new-matter-btn-header-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.new-matter-btn-header-outline:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.new-matter-btn-header-outline svg {
    width: 1rem;
    height: 1rem;
}

/* Search Page Styles */
.max-w-5xl {
    max-width: 64rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

/* Search Input Large */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.pl-12 {
    padding-left: 3rem;
}

/* Recent Searches and Suggested Queries */
.recent-search-item,
.suggested-query-item {
    background: transparent;
    border: none;
    cursor: pointer;
}

.suggested-query-item {
    background: linear-gradient(to right, rgba(229, 164, 67, 0.05), transparent);
}

.suggested-query-item:hover {
    background: linear-gradient(to right, rgba(229, 164, 67, 0.1), transparent);
}

/* Search Results */
.tab-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-trigger:hover {
    background-color: #f9fafb;
    color: #111827;
}

.tab-trigger.active {
    background-color: #f3f4f6;
    color: #111827;
}

/* Result Type Colors */
.bg-blue-100 {
    background-color: #dbeafe;
}

.text-blue-700 {
    color: #1e3a8a;
}

.bg-purple-100 {
    background-color: #f3e8ff;
}

.text-purple-700 {
    color: #6b21a8;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.text-green-700 {
    color: #15803d;
}

.bg-red-100 {
    background-color: #fee2e2;
}

.text-red-700 {
    color: #991b1b;
}

.border-red-200 {
    border-color: #fecaca;
}

/* Leading relaxed */
.leading-relaxed {
    line-height: 1.625;
}

/* Mark/highlight */
mark {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.bg-yellow-200 {
    background-color: #fef08a;
}

/* Flex wrap */
.flex-wrap {
    flex-wrap: wrap;
}

/* Text base */
.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

/* Gap utilities */
.gap-1\.5 {
    gap: 0.375rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Padding utilities */
.p-5 {
    padding: 1.25rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-1\.5 {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

/* Font normal */
.font-normal {
    font-weight: 400;
}

/* Text size utilities */
.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

/* Margin top utilities */
.mt-0\.5 {
    margin-top: 0.125rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* Space utilities */
.space-y-3 > * + * {
    margin-top: 0.75rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

/* Responsive grid for search page */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Smaller icons for matter card metrics (Documents, Entities, Key Facts) */
.matter-card-link .grid.grid-cols-3 svg.w-3\.5,
.matter-card-link .grid.grid-cols-3 svg[class*="w-3.5"],
.matter-card-link .grid.grid-cols-3 svg {
    width: 0.625rem !important;
    height: 0.625rem !important;
}

/* Alternative: target by parent div structure */
.matter-card-link .text-center > div:first-child svg {
    width: 0.625rem !important;
    height: 0.625rem !important;
}

/* Documents Page Styles */
.upload-docs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
}

.upload-docs-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Document Status Badges */
.status-reviewed {
    background-color: #dcfce7;
    color: #15803d;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-pending {
    background-color: #f1f5f9;
    color: #475569;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-processing {
    background-color: #dbeafe;
    color: #1e40af;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-saved {
    background-color: #dcfce7;
    color: #15803d;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.status-collected {
    background-color: #e0e7ff;
    color: #3730a3;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Center status badge icons - ensure badges use flexbox properly */
.badge.status-reviewed,
.badge.status-pending,
.badge.status-processing,
.badge.status-saved,
.status-reviewed,
.status-pending,
.status-processing,
.status-saved {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
    gap: 0.25rem !important;
}

/* Center the SVG icons within the badges */
.badge.status-reviewed svg,
.badge.status-pending svg,
.badge.status-processing svg,
.badge.status-saved svg,
.status-reviewed svg,
.status-pending svg,
.status-processing svg,
.status-saved svg {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    vertical-align: middle !important;
    line-height: 0 !important;
    width: 0.75rem !important;
    height: 0.75rem !important;
    position: relative !important;
    top: 0 !important;
    bottom: 0 !important;
}

/* Center stat card icons in their rounded square containers */
.grid.grid-cols-3 .w-8.h-8 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
}

.grid.grid-cols-3 .w-8.h-8 svg {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    width: 1rem !important;
    height: 1rem !important;
    align-self: center !important;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    accent-color: var(--primary-color);
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:focus {
    outline: 2px solid rgba(229, 164, 67, 0.2);
    outline-offset: 2px;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #E5A443;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.bulk-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.bulk-actions-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.bulk-actions-count #selected-count {
    color: #E5A443;
    font-weight: 600;
}

.bulk-actions-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bulk-actions-banner {
    padding: 0.5rem 0.75rem;
    background: #fff7ed;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #92400e;
    line-height: 1.4;
}

.bulk-actions-banner a {
    color: #E5A443;
    text-decoration: underline;
    font-weight: 600;
}

.bulk-actions-banner a:hover {
    color: #c98a2e;
}

.btn-primary-amber {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4375rem 0.875rem;
    background: #E5A443;
    border: 1px solid #E5A443;
    border-radius: 0.375rem;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-primary-amber:hover {
    background: #d4933c;
    border-color: #d4933c;
    box-shadow: 0 1px 2px rgba(229, 164, 67, 0.25);
}

.btn-secondary-light {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4375rem 0.875rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn-secondary-light:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Add to Collection modal */
.atc-modal-root {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.atc-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
}

.atc-modal-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.atc-modal {
    position: relative;
    background: #ffffff;
    border-radius: 0.875rem;
    box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(15, 23, 42, 0.04);
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
}

.atc-modal-header {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.atc-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.atc-modal-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.375rem 0 0;
}

.atc-modal-subtitle #modal-doc-count {
    font-weight: 600;
    color: #E5A443;
}

.atc-modal-body {
    padding: 1.25rem 1.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.atc-collection-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.atc-empty {
    text-align: center;
    padding: 2rem 0;
    color: #6b7280;
}

.atc-empty-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    color: #d1d5db;
}

.atc-empty-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #E5A443;
    text-decoration: none;
}

.atc-empty-link:hover {
    text-decoration: underline;
}

.atc-modal-footer {
    padding: 1rem 1.5rem;
    background: #fafafa;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

.atc-btn-cancel {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.atc-btn-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.atc-btn-confirm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background: #E5A443;
    border: 1px solid #E5A443;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.atc-btn-confirm:hover:not(:disabled) {
    background: #d4933c;
    border-color: #d4933c;
    box-shadow: 0 1px 2px rgba(229, 164, 67, 0.25);
}

.atc-btn-confirm:disabled {
    background: #e5e7eb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Collection card item (rendered by documents-data.js) */
.collection-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    cursor: pointer;
    background: #ffffff;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.collection-item:hover {
    border-color: #E5A443;
    background: #fffbeb;
}

.collection-item.selected {
    border-color: #E5A443;
    background: #fffbeb;
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.15);
}

.collection-item-name {
    font-weight: 500;
    color: #111827;
    font-size: 0.9375rem;
}

.collection-item-count {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.collection-radio {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.collection-item:hover .collection-radio,
.collection-item.selected .collection-radio {
    border-color: #E5A443;
}

.collection-radio-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: #E5A443;
    display: none;
}

.collection-item.selected .collection-radio-dot {
    display: block;
}

/* Document menu button */
.doc-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Table header styling */
thead tr {
    background-color: transparent;
}

thead tr:hover {
    background-color: transparent;
}

/* W-fit utility */
.w-fit {
    width: fit-content;
}

/* Text slate colors */
.text-slate-600 {
    color: #475569;
}

.text-slate-700 {
    color: #334155;
}

.bg-slate-100 {
    background-color: #f1f5f9;
}

/* Animate spin for processing icon */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Progress bar width utility */
.w-16 {
    width: 4rem;
}

/* Matters page search input and filter widths */
#search-input {
    width: 600px !important;
    max-width: 100%;
}

#status-filter {
    width: 190px !important;
}

/* Documents page search input width */
#search-documents {
    width: 600px !important;
    max-width: 100%;
}

/* Auto-width select dropdowns - size based on content */
.auto-width-select {
    min-width: 140px;
    width: auto;
    max-width: 300px;
    display: inline-block;
}

/* Calculate width based on longest option */
.auto-width-select option {
    padding-right: 2rem;
}

/* Documents table - compact row height */
#documents-tbody tr td {
    padding: 0.75rem 1rem !important;
}

#documents-tbody tr td p {
    margin: 0;
    line-height: 1.5;
}

#documents-tbody tr td p.text-xs {
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* Search results table - match documents page width */
#search-results .card {
    width: 100%;
    max-width: 100%;
}

#search-results table {
    width: 100%;
}

/* Animated searching dots */
.searching-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2rem;
}

.searching-dots .dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: float-dot 1.4s ease-in-out infinite;
}

.searching-dots .dot-1 {
    animation-delay: 0s;
}

.searching-dots .dot-2 {
    animation-delay: 0.2s;
}

.searching-dots .dot-3 {
    animation-delay: 0.4s;
}

@keyframes float-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-1rem);
        opacity: 1;
    }
}

/* Search Page Specific Styles */
#search-query {
    border: 1px solid rgba(229, 164, 67, 0.3) !important;
    background-color: #f9fafb !important;
    font-size: 1.125rem !important;
    padding: 0.625rem !important;
    padding-left: 3rem !important;
    border-radius: 0.5rem !important;
    transition: all 0.2s;
    height: auto;
}

/* Move sparkle icon position */
.relative.flex-1 svg.absolute.left-4 {
    left: 1.125rem !important;
}

#search-query:focus {
    outline: none !important;
    border-color: #E5A443 !important;
    background-color: white !important;
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.1) !important;
}

#search-button {
    background-color: #0A0A0A !important;
    border: none !important;
    border-radius: 0.5rem !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s;
    cursor: pointer;
    min-width: 4.5rem !important;
    width: 4.5rem !important;
    height: auto !important;
    align-self: stretch;
}

#search-button:hover {
    background-color: #1a1a1a !important;
}

#search-button svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    color: white !important;
}

/* Ensure search input and button align properly */
.flex.gap-3 {
    align-items: stretch;
}

.flex.gap-3 > .relative {
    display: flex;
    align-items: stretch;
}

.flex.gap-3 > .relative > input {
    height: auto;
}

/* Center suggested queries under search container */
#pre-search-state {
    width: 100%;
    margin-top: 1.5rem;
}

#pre-search-state > .card {
    width: 100%;
}

/* Documents page stat cards - compact styling */
.grid.grid-cols-3 > .card,
.grid.grid-cols-4 > .card {
    padding: 0.5rem !important;
}

.grid.grid-cols-3 > .card > div,
.grid.grid-cols-4 > .card > div {
    padding: 0 !important;
}

.grid.grid-cols-3 > .card p.text-lg,
.grid.grid-cols-4 > .card p.text-lg {
    line-height: 1.25 !important;
    margin: 0 !important;
}

.grid.grid-cols-3 > .card p.text-xs,
.grid.grid-cols-4 > .card p.text-xs {
    line-height: 1 !important;
    margin-top: 0 !important;
}

/* Reduce icon container size for stat cards */
.grid.grid-cols-3 > .card .w-8,
.grid.grid-cols-3 > .card .h-8 {
    width: 1.75rem !important;
    height: 1.75rem !important;
}

.grid.grid-cols-3 > .card .w-4,
.grid.grid-cols-3 > .card .h-4 {
    width: 0.875rem !important;
    height: 0.875rem !important;
}

/* Document Detail Metadata Styles */
.metadata-details {
    margin: 0;
}

.metadata-summary {
    list-style: none;
    user-select: none;
    padding: 0.5rem 0;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.metadata-summary:hover {
    background-color: #f9fafb;
}

.metadata-summary::-webkit-details-marker {
    display: none;
}

.metadata-details[open] .metadata-summary svg {
    transform: rotate(90deg);
}

.metadata-collapsible-content {
    padding-left: 0.5rem;
}

.metadata-array-item,
.metadata-object-item {
    background-color: #fafafa;
    border-radius: 0.25rem;
    margin: 0.25rem 0;
    padding: 0.5rem;
    transition: background-color 0.2s;
}

.metadata-array-item:hover,
.metadata-object-item:hover {
    background-color: #f3f4f6;
}

.metadata-array-item .border-l-2,
.metadata-object-item .border-l-2 {
    border-color: #e5e7eb;
}

.metadata-collapsible-container {
    width: 100%;
}

.metadata-summary svg {
    transition: transform 0.2s;
    flex-shrink: 0;
}

/* Document Preview Styles */
#text-preview-content {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    line-height: 1.6;
    tab-size: 4;
}

#text-preview-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#text-preview-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#text-preview-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#text-preview-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Document Preview Pane Constraints */
.document-preview-container {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.document-preview-container img {
    max-width: 100%;
    max-height: 750px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.document-preview-container iframe {
    max-width: 100%;
    max-height: 750px;
}

.document-preview-container pre {
    max-height: 750px;
    overflow: auto;
}

/* Status Badge Inline (next to document title) */
.status-badge-inline {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
}

.status-badge-reviewed {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-badge-flagged {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-badge-pending {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-badge-collected {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #a5b4fc;
}

.status-badge-processing {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Status Badge Buttons (for Review/Save buttons) */
.status-badge-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.status-badge-reviewed-button {
    background-color: #dcfce7;
    color: #15803d;
    border: none;
}

.status-badge-reviewed-button:hover {
    background-color: #bbf7d0;
}

.status-badge-pending-button {
    background-color: #fef3c7;
    color: #92400e;
    border: none;
}

.status-badge-pending-button:hover {
    background-color: #fde68a;
}

.status-badge-collection-button {
    background-color: #e0e7ff;
    color: #3730a3;
    border: none;
}

.status-badge-collection-button:hover {
    background-color: #c7d2fe;
}

.status-badge-download-button {
    background-color: #f3f4f6;
    color: #374151;
    border: none;
}

.status-badge-download-button:hover {
    background-color: #e5e7eb;
}

.status-badge-button svg {
    width: 0.75rem;
    height: 0.75rem;
    flex-shrink: 0;
}

/* Document Detail Layout - Two column layout */
.document-detail-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    width: 100% !important;
}

.document-detail-grid > div:first-child {
    width: 100%;
}

.document-detail-grid > div:last-child {
    width: 100%;
}

@media (min-width: 1024px) {
    .document-detail-grid {
        flex-direction: row !important;
    }
    
    .document-detail-grid > div:first-child {
        width: 60%;
        flex-shrink: 0;
    }
    
    .document-detail-grid > div:last-child {
        width: 40%;
        flex-shrink: 0;
    }
}

/* Schema Panel (Right Side) */
.schema-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    background-color: #0A0A0A;
    color: white;
    transition: transform 0.3s ease-in-out;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: 20rem;
    transform: translateX(100%);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.schema-panel.open {
    transform: translateX(0);
}

.schema-panel-header {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.schema-panel-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.schema-panel-close:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.schema-panel-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.schema-panel-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

#schema-fields-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schema-field-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.schema-field-item .field-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    text-transform: capitalize;
}

.schema-field-item input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.schema-field-item input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.schema-field-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.15);
}

.schema-panel-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.schema-search-button {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.schema-search-button:hover {
    background-color: #d4941f;
}

/* Adjust main content when schema panel is open */
.main-content.schema-panel-open {
    margin-right: 20rem;
}

/* Report Detail Document Layout - Grid Alignment */
.document-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.document-row > div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Ensure match cards align with host card */
.document-row .flex.flex-col {
    height: 100%;
}

.document-row .flex.gap-4.overflow-x-auto {
    align-items: flex-start;
    min-height: 0;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Ensure headers align properly and have same height */
.document-row h3.text-lg {
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
    height: auto;
    line-height: 1.75rem;
    font-size: 1.125rem;
}

/* Ensure cards have consistent minimum heights */
.document-row .card {
    min-height: fit-content;
    width: 100%;
}

/* Match cards in horizontal scroll - width set dynamically to match host card */
.document-row .flex.gap-4.overflow-x-auto .card {
    flex-shrink: 0;
}

/* Scrollbars for text document containers (both host and match) */
.document-row .card .bg-gray-50 {
    overflow-y: auto !important;
    overflow-x: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f3f4f6;
}

.document-row .card .bg-gray-50::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.document-row .card .bg-gray-50::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 6px;
}

.document-row .card .bg-gray-50::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid #f3f4f6;
}

.document-row .card .bg-gray-50::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Text content inside scrollable container */
.document-row .card .text-content-scrollable {
    overflow: visible;
    max-width: 100%;
}

/* Delete button for match cards */
.delete-match-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background-color 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.delete-match-btn:hover {
    background-color: #dc2626;
}

.delete-match-btn:active {
    transform: scale(0.95);
}

.delete-match-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.delete-match-btn svg {
    pointer-events: none;
}

/* Export CSV button - matches black button style */
#export-csv-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#export-csv-btn:hover {
    background-color: var(--primary-dark-hover);
}

#export-csv-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Drag-to-scroll functionality for matches container */
.document-row .flex.gap-4.overflow-x-auto {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.document-row .flex.gap-4.overflow-x-auto:active {
    cursor: grabbing;
}

/* Prevent image dragging in matches container */
.document-row .flex.gap-4.overflow-x-auto img,
.document-row .flex.gap-4.overflow-x-auto canvas {
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;
}

/* Document reference highlighting in relevance summary */
#relevance-summary-content .document-reference {
    background-color: rgba(229, 164, 67, 0.2) !important;
    color: #E5A443 !important;
    font-weight: 600 !important;
    padding: 0.125rem 0.375rem !important;
    border-radius: 0.25rem !important;
    transition: all 0.2s !important;
    display: inline !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

#relevance-summary-content .document-reference:hover {
    background-color: rgba(229, 164, 67, 0.3) !important;
    color: #d4941f !important;
    text-decoration: underline !important;
    transform: translateY(-1px);
}

/* Highlight documents in table that are mentioned in summary */
#search-results-tbody tr.mentioned-in-summary {
    background-color: rgba(229, 164, 67, 0.1) !important;
    border-left: 3px solid #E5A443 !important;
}

#search-results-tbody tr.mentioned-in-summary:hover {
    background-color: rgba(229, 164, 67, 0.15) !important;
}

#search-results-tbody tr.mentioned-in-summary td {
    position: relative;
}

/* Active highlight when document is clicked from summary */
#search-results-tbody tr.document-highlighted {
    background-color: rgba(229, 164, 67, 0.2);
    border-left: 4px solid #E5A443;
    animation: highlight-pulse 1s ease-in-out;
}

@keyframes highlight-pulse {
    0%, 100% {
        background-color: rgba(229, 164, 67, 0.2);
    }
    50% {
        background-color: rgba(229, 164, 67, 0.3);
    }
}

/* Demo Mode Styles */
.top-bar-demo-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.top-bar-demo-mode:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.top-bar-demo-mode.demo-mode-active {
    background-color: #0A0A0A;
    color: white;
    border-color: #0A0A0A;
}

.top-bar-demo-mode.demo-mode-active:hover {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
}

.top-bar-demo-mode svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Hide button text when sidebar is collapsed (if needed) */
.sidebar.collapsed ~ .main-content .top-bar-demo-mode span {
    display: none;
}

/* Demo Mode Redaction Effect - Less aggressive, sharpie-like */
.demo-mode-active .demo-redacted {
    position: relative;
    user-select: none;
    pointer-events: none;
}

/* Hide text content but keep structure */
.demo-mode-active .demo-redacted,
.demo-mode-active .demo-redacted * {
    color: transparent !important;
}

/* Create sharpie-like black bars over text lines */
.demo-mode-active .demo-redacted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.2em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
    margin-top: 0.1em;
}

/* For table cells - make redaction more subtle and contained */
.demo-mode-active table td.demo-redacted {
    position: relative;
    padding: 0.75rem 1rem !important;
}

.demo-mode-active table td.demo-redacted::before {
    height: 1.1em;
    top: 0.75rem;
    margin-top: 0;
}

/* For document links and text spans in cells */
.demo-mode-active table .document-link,
.demo-mode-active table td.demo-redacted span,
.demo-mode-active table td.demo-redacted p {
    position: relative;
    display: inline-block;
    width: 100%;
}

.demo-mode-active table .document-link::before,
.demo-mode-active table td.demo-redacted span::before,
.demo-mode-active table td.demo-redacted p::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* For multi-line text, add additional bars */
.demo-mode-active .demo-redacted p + p::before {
    content: '';
    position: absolute;
    top: 1.4em;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* Keep images and media hidden */
.demo-mode-active .demo-redacted img,
.demo-mode-active .demo-redacted svg,
.demo-mode-active .demo-redacted canvas {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Document preview - black out images/canvas/iframes but keep container and heading */
.demo-mode-active .document-preview-container img.demo-redacted,
.demo-mode-active .document-preview-container canvas.demo-redacted,
.demo-mode-active .document-preview-container iframe.demo-redacted,
.demo-mode-active #tiff-canvas.demo-redacted {
    filter: brightness(0);
    opacity: 0.2 !important;
    background-color: #000000;
    min-height: 200px;
    pointer-events: none;
}

.demo-mode-active #text-preview-content.demo-redacted,
.demo-mode-active .document-preview-container pre.demo-redacted {
    background-color: #000000 !important;
    color: transparent !important;
    position: relative;
}

.demo-mode-active #text-preview-content.demo-redacted::before,
.demo-mode-active .document-preview-container pre.demo-redacted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* Keep document preview heading visible */
.demo-mode-active .document-preview-container h3 {
    color: inherit !important;
}

.demo-mode-active .document-preview-container h3::before {
    display: none !important;
}

/* Document Details - redact values but keep labels */
.demo-mode-active .card .py-2 p.text-sm.font-medium.text-gray-900.demo-redacted {
    position: relative;
}

.demo-mode-active .card .py-2 p.text-sm.font-medium.text-gray-900.demo-redacted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* Keep document detail labels visible */
.demo-mode-active .card .py-2 .uppercase {
    color: inherit !important;
}

.demo-mode-active .card .py-2 .uppercase::before {
    display: none !important;
}

/* Attribute values - redact values but keep field names */
.demo-mode-active .card .flex.items-start.gap-4 .demo-redacted {
    position: relative;
}

.demo-mode-active .card .flex.items-start.gap-4 .demo-redacted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* Keep attribute field names visible */
.demo-mode-active .card .flex.items-start.gap-4 .min-w-\\[180px\\],
.demo-mode-active .card .flex.items-start.gap-4 span.text-sm.font-semibold.text-gray-700 {
    color: inherit !important;
}

.demo-mode-active .card .flex.items-start.gap-4 .min-w-\\[180px\\]::before,
.demo-mode-active .card .flex.items-start.gap-4 span.text-sm.font-semibold.text-gray-700::before {
    display: none !important;
}

/* Document title - redact document ID but keep status badge */
.demo-mode-active #documentTitle.demo-redacted {
    position: relative;
}

.demo-mode-active #documentTitle.demo-redacted .flex.items-center.gap-3 > span:first-child {
    position: relative;
}

.demo-mode-active #documentTitle.demo-redacted .flex.items-center.gap-3 > span:first-child::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* Keep status badge visible in document title */
.demo-mode-active #documentTitle .status-badge-inline {
    color: inherit !important;
    position: relative;
    z-index: 11;
}

.demo-mode-active #documentTitle .status-badge-inline::before {
    display: none !important;
}

/* Metadata values in collapsible sections */
.demo-mode-active .metadata-object-item .text-sm.demo-redacted,
.demo-mode-active .metadata-array-item .text-sm.demo-redacted {
    position: relative;
}

.demo-mode-active .metadata-object-item .text-sm.demo-redacted::before,
.demo-mode-active .metadata-array-item .text-sm.demo-redacted::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1em;
    background-color: #000000;
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

/* For images and previews */
.demo-mode-active .demo-redacted img,
.demo-mode-active .demo-redacted canvas,
.demo-mode-active .demo-redacted iframe {
    filter: brightness(0);
    opacity: 0.3;
}

/* Ensure table cells maintain their structure */
.demo-mode-active table td.demo-redacted {
    padding: 0.75rem 1rem !important;
    min-height: auto;
}

/* For document links and matter names in tables - make redaction more subtle */
.demo-mode-active table .document-link::after,
.demo-mode-active table td.demo-redacted .document-link::after {
    height: 1em;
    top: 0;
    transform: none;
}

.demo-mode-active table td.demo-redacted span::after {
    height: 1em;
    top: 0;
    transform: none;
}

/* Don't redact statistics */
.demo-mode-active .stats-grid,
.demo-mode-active [id*="count"],
.demo-mode-active [id*="total"],
.demo-mode-active [id*="stats"],
.demo-mode-active .stat-value,
.demo-mode-active .stat-number,
.demo-mode-active [data-stat],
.demo-mode-active .pagination-info {
    color: inherit !important;
}

.demo-mode-active .stats-grid::before,
.demo-mode-active [id*="count"]::before,
.demo-mode-active [id*="total"]::before,
.demo-mode-active [id*="stats"]::before,
.demo-mode-active .stat-value::before,
.demo-mode-active .stat-number::before,
.demo-mode-active [data-stat]::before,
.demo-mode-active .pagination-info::before {
    display: none !important;
}


/* ========================================
   Landing Page Styles
   ======================================== */

/* Navigation */
/* ========================================
   Landing Page Typography (Cal Sans headers, Figtree body)
   ======================================== */
.landing-nav,
.hero-section,
.landing-section,
.landing-section-fullwidth,
.landing-footer {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
}

.hero-title,
.landing-section-title,
.discover-text h3,
.feature-card h3,
.hiw-label,
.footer-brand h4 {
    font-family: 'Cal Sans', 'Figtree', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
    padding: 1rem 2rem;
}

.landing-nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.landing-nav-logo img {
    height: 32px;
    width: auto;
    display: block;
}

.landing-nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.landing-nav-links a {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.landing-nav-links a:hover {
    color: #111827;
}

.landing-nav-cta {
    background: transparent;
    color: #ffffff;
    padding: 0.5rem 1.5rem;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.landing-nav-cta:hover {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: #ffffff;
    transform: translateY(-1px);
}

.landing-nav.is-scrolled .landing-nav-cta {
    color: #111827;
    border-color: rgba(17, 24, 39, 0.25);
}

.landing-nav.is-scrolled .landing-nav-cta:hover {
    color: #ffffff;
    border-color: var(--brand-orange);
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
    padding: 8rem 2rem 4rem;
    text-align: center;
    background: #0a0a0f;
    color: white;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-tagline {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand-orange);
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #d1d5db;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-cta-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--brand-orange);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    display: inline-block;
}

.btn-primary:hover {
    background: var(--brand-orange-hover);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: white;
    padding: 1rem 2rem;
    border: 2px solid white;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
}

.btn-secondary:hover {
    background: white;
    color: #1a1a2e;
}

/* Section Styles */
.landing-section {
    padding: 5rem 2rem;
    width: 100%;
    box-sizing: border-box;
}

.landing-section-alt {
    background: #f9fafb;
}

.landing-section-content {
    max-width: 1200px;
    margin: 0 auto;
}

.landing-section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: #111827;
}

.landing-section-subtitle {
    text-align: center;
    color: #6b7280;
    font-size: 1.125rem;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    padding: 2rem;
    border-radius: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
    border-color: var(--brand-orange);
}

.feature-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

.feature-card p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 0;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.feature-list li {
    padding: 0.5rem 0;
    color: #6b7280;
    position: relative;
    padding-left: 1.5rem;
}

.feature-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Image Placeholder */
.landing-image-placeholder {
    background: #e5e7eb;
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    color: #9ca3af;
    margin: 3rem 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* How It Works Steps */
.steps-container {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.step-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #111827;
}

.step-description {
    color: #6b7280;
}

/* Compliance Badges */
.compliance-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.badge {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

/* Footer */
.landing-footer {
    background: #0a0a0f;
    color: white;
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-logo {
    height: 28px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

.footer-tagline {
    color: #9ca3af;
    margin: 0;
    font-size: 0.95rem;
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-contact {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-contact:hover {
    color: var(--brand-orange);
}

.footer-socials {
    display: flex;
    gap: 0.75rem;
}

.footer-socials a {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #d1d5db;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.footer-socials a:hover {
    background: var(--brand-orange);
    color: #0a0a0f;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid #1f2937;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .landing-nav-links {
        gap: 1rem;
    }

    .landing-nav {
        padding: 1rem;
    }

    .steps-container {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========================================
   Full-Width Sections
   ======================================== */
.landing-section-fullwidth {
    padding: 5rem 2rem;
    width: 100%;
    box-sizing: border-box;
}

.landing-section-fullwidth .landing-section-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Blue Background (Discover Intelligence) */
.landing-section-blue {
    background: var(--brand-blue);
    position: relative;
    overflow: hidden;
}

.landing-section-blue .landing-section-content {
    position: relative;
    z-index: 1;
}

.section-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.7;
}

/* Orange Background (How It Works) */
.landing-section-orange-bg {
    background: var(--brand-orange);
}

.landing-section-title-white {
    color: white !important;
}

.landing-section-subtitle-white {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* ========================================
   Discover Intelligence Feature Rows
   ======================================== */
.discover-features {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 3rem;
}

.discover-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.discover-row:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.discover-image img {
    transition: transform 0.6s ease;
}

.discover-row:hover .discover-image img {
    transform: scale(1.02);
}

.discover-row-reverse {
    direction: rtl;
}

.discover-row-reverse > * {
    direction: ltr;
}

.discover-image {
    border-radius: 12px;
    overflow: hidden;
}

.discover-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.discover-text h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
}

.discover-text p {
    font-size: 1.05rem;
    color: #4b5563;
    line-height: 1.7;
}

/* ========================================
   How It Works - Circle Steps with Arrows
   ======================================== */
.hiw-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin-top: 3.5rem;
    flex-wrap: nowrap;
}

.hiw-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 120px;
}

.hiw-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    border: 3px solid #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.hiw-step:hover .hiw-circle {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.hiw-arrow {
    transition: transform 0.3s ease, color 0.3s ease;
}

.hiw-steps:hover .hiw-arrow {
    color: #111827;
}

.hiw-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.hiw-desc {
    font-size: 0.875rem;
    color: #374151;
    max-width: 150px;
}

.hiw-arrow {
    font-size: 1.5rem;
    color: #6b7280;
    padding: 0 1rem;
    margin-top: 24px; /* Align with circle center */
    flex-shrink: 0;
}

/* ========================================
   Graph Container
   ======================================== */
#landing-graph-container {
    position: relative;
}

/* ========================================
   Landing Responsive Overrides
   ======================================== */
@media (max-width: 768px) {
    .discover-row {
        grid-template-columns: 1fr;
    }
    
    .discover-row-reverse {
        direction: ltr;
    }
    
    .hiw-steps {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .hiw-arrow {
        display: none;
    }
}

/* ===== Multi-Select Dropdown Components ===== */
.multi-select-wrapper {
    position: relative;
    display: inline-block;
}

.multi-select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: space-between;
}

.multi-select-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.multi-select-btn:focus,
.multi-select-btn.active {
    outline: none;
    ring: 2px;
    border-color: #E5A443;
    box-shadow: 0 0 0 2px rgba(229, 164, 67, 0.2);
}

.multi-select-btn .chevron-icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.multi-select-btn.active .chevron-icon {
    transform: rotate(180deg);
}

.multi-select-btn .selected-count {
    background: #E5A443;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.4;
}

/* Disabled state for multi-select */
.multi-select-wrapper.disabled .multi-select-btn {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f3f4f6;
    pointer-events: none;
}

.multi-select-wrapper.disabled.has-tooltip {
    position: relative;
    pointer-events: auto;
}

.multi-select-wrapper.disabled.has-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Loading state for multi-select */
.multi-select-wrapper.loading .multi-select-btn {
    pointer-events: none;
}

.multi-select-btn .loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e5e7eb;
    border-top-color: #E5A443;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 6px;
}

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

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 240px;
    max-height: 320px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.multi-select-dropdown.open {
    display: flex;
}

.multi-select-search {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.multi-select-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
    background: #f9fafb;
    color: #111827;
}

.multi-select-search input:focus {
    border-color: #E5A443;
    box-shadow: 0 0 0 2px rgba(229, 164, 67, 0.15);
    background: white;
}

.multi-select-search input::placeholder {
    color: #9ca3af;
}

.multi-select-options {
    overflow-y: auto;
    max-height: 260px;
    padding: 4px 0;
}

.multi-select-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85rem;
    color: #374151;
}

.multi-select-option input[type="checkbox"],
.multi-select-option .option-badge {
    margin-top: 2px;
}

.multi-select-option:hover {
    background: #f9fafb;
}

.multi-select-option.selected {
    background: #fef9ee;
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #E5A443;
    cursor: pointer;
    flex-shrink: 0;
}

.multi-select-option .option-label {
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.multi-select-option .option-badge {
    font-size: 0.7rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.multi-select-empty {
    padding: 16px 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
}

/* Search mode dropdown - styled to match multi-select buttons */
.search-mode-select {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-width: 100px;
    height: 38px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.search-mode-select:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

.search-mode-select:focus {
    outline: none;
    border-color: #E5A443;
    box-shadow: 0 0 0 2px rgba(229, 164, 67, 0.2);
}

/* Filters row layout for documents page - single row with all controls */
.documents-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 100;
}

/* Search input wrapper - fixed width to prevent bleeding */
.search-input-wrapper {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    flex-shrink: 0;
    flex-grow: 0;
}

.search-input-wrapper input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.clear-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.clear-filters-btn:hover {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fef2f2;
}

/* =============================================================================
   AI Chat Styles
   ============================================================================= */

.chat-page {
    padding: 0 !important;
    height: calc(100vh - 4rem);
    overflow: hidden;
}

.chat-container {
    display: flex;
    height: 100%;
    background: #f8f9fa;
}

/* Chat Sidebar */
.chat-sidebar {
    width: 280px;
    min-width: 280px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

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

.chat-sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.chat-new-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-new-btn:hover {
    background: #d4932e;
    transform: scale(1.05);
}

.chat-sidebar-filter {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.chat-matter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-matter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.1);
}

.chat-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-conversation-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.chat-conversation-item:hover {
    background: #f3f4f6;
}

.chat-conversation-item.active {
    background: rgba(229, 164, 67, 0.1);
    border: 1px solid rgba(229, 164, 67, 0.3);
}

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

.chat-conv-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conv-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.chat-conv-matter {
    font-size: 0.75rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.chat-conv-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.chat-conv-delete {
    opacity: 0;
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-conversation-item:hover .chat-conv-delete {
    opacity: 1;
}

.chat-conv-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #9ca3af;
}

.chat-empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chat-empty-state p {
    margin: 0;
    font-weight: 500;
    color: #6b7280;
}

.chat-empty-state span {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
}

.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.chat-welcome-content {
    text-align: center;
    max-width: 480px;
}

.chat-welcome-icon {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.chat-welcome-content h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.chat-welcome-content p {
    margin: 0 0 1.5rem 0;
    color: #6b7280;
    line-height: 1.6;
}

.chat-welcome-tips {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-tip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 8px;
    text-align: left;
}

.chat-tip-icon {
    font-size: 1.25rem;
}

.chat-tip span:last-child {
    font-size: 0.875rem;
    color: #4b5563;
}

/* Messages Container */
.chat-messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Message Bubbles */
.chat-message {
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chat-message-user {
    align-self: flex-end;
}

.chat-message-assistant {
    align-self: flex-start;
}

.chat-message-content {
    padding: 0.875rem 1rem;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.9375rem;
}

.chat-message-user .chat-message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.chat-message-refs {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.refs-label {
    color: #6b7280;
    margin-right: 0.5rem;
}

/* Document References */
.chat-doc-ref {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    margin: 0.125rem;
    background: rgba(229, 164, 67, 0.15);
    color: #b8860b;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-doc-ref:hover {
    background: rgba(229, 164, 67, 0.3);
    color: #8b6914;
}

.chat-message-user .chat-doc-ref {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-message-user .chat-doc-ref:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Entity References (people, orgs, etc.) */
.chat-entity-ref {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    margin: 0.125rem;
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-entity-ref:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #1e3a8a;
}

.chat-message-user .chat-entity-ref {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-message-user .chat-entity-ref:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Markdown rendering inside assistant bubbles */
.chat-message-assistant .chat-message-content > :first-child { margin-top: 0; }
.chat-message-assistant .chat-message-content > :last-child  { margin-bottom: 0; }
.chat-message-assistant .chat-message-content h1,
.chat-message-assistant .chat-message-content h2,
.chat-message-assistant .chat-message-content h3,
.chat-message-assistant .chat-message-content h4 {
    margin: 0.75em 0 0.4em;
    font-weight: 600;
    line-height: 1.3;
}
.chat-message-assistant .chat-message-content h1 { font-size: 1.25rem; }
.chat-message-assistant .chat-message-content h2 { font-size: 1.125rem; }
.chat-message-assistant .chat-message-content h3 { font-size: 1.0625rem; }
.chat-message-assistant .chat-message-content h4 { font-size: 1rem; }
.chat-message-assistant .chat-message-content p  { margin: 0.4em 0; }
.chat-message-assistant .chat-message-content ul,
.chat-message-assistant .chat-message-content ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}
.chat-message-assistant .chat-message-content li { margin: 0.15em 0; }
.chat-message-assistant .chat-message-content code {
    background: rgba(0,0,0,0.06);
    padding: 0.05em 0.35em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    font-size: 0.875em;
}
.chat-message-assistant .chat-message-content pre {
    background: rgba(0,0,0,0.06);
    padding: 0.6em 0.8em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
}
.chat-message-assistant .chat-message-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.chat-message-assistant .chat-message-content blockquote {
    margin: 0.5em 0;
    padding: 0.2em 0.9em;
    border-left: 3px solid #d1d5db;
    color: #4b5563;
}
.chat-message-assistant .chat-message-content table {
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 0.875em;
}
.chat-message-assistant .chat-message-content th,
.chat-message-assistant .chat-message-content td {
    border: 1px solid #e5e7eb;
    padding: 0.3em 0.6em;
    text-align: left;
}
.chat-message-assistant .chat-message-content th { background: #f3f4f6; }
.chat-message-assistant .chat-message-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.8em 0;
}
.chat-message-assistant .chat-message-content a {
    color: var(--primary-color, #2563eb);
    text-decoration: underline;
}

/* Mermaid diagrams rendered inside assistant bubbles */
.chat-mermaid {
    margin: 0.6em 0;
    padding: 0.6em;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    text-align: center;
    cursor: zoom-in;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-mermaid[data-rendered="true"]:hover {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}
/* Make the whole rendered diagram a single click target — internal SVG nodes
   inherit the cursor and don't capture clicks. */
.chat-mermaid[data-rendered="true"] svg,
.chat-mermaid[data-rendered="true"] svg * {
    pointer-events: none;
}

/* Fullscreen lightbox with pan + wheel zoom */
.chat-mermaid-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}
.chat-mermaid-lightbox-viewport {
    background: #fff;
    border-radius: 12px;
    width: 95vw;
    height: 95vh;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.chat-mermaid-lightbox-viewport.is-panning {
    cursor: grabbing;
}
.chat-mermaid-lightbox-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    display: inline-block;
}
.chat-mermaid-lightbox-stage svg {
    max-width: none !important;
    width: auto !important;
    height: auto !important;
    display: block;
    pointer-events: none;
}
.chat-mermaid-lightbox-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    padding: 4px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.chat-mermaid-lightbox-toolbar button {
    background: transparent;
    border: none;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-mermaid-lightbox-toolbar button:hover {
    background: rgba(99, 102, 241, 0.12);
}
.chat-mermaid-lightbox-zoomlabel {
    color: #4b5563;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    min-width: 42px;
    text-align: center;
    user-select: none;
}
.chat-mermaid-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}
.chat-mermaid-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
.chat-mermaid svg {
    max-width: 100%;
    width: 100%;       /* override mermaid's hardcoded SVG width attribute */
    height: auto;
    display: block;
}

/* Block-aware streaming view.
   - .chat-stream-rendered holds the stable prefix (paragraph-complete markdown).
   - .chat-stream-text holds the volatile suffix (current paragraph still streaming),
     shown as raw pre-wrap text. Mermaid + final markdown render runs on `done`. */
.chat-stream-rendered { /* inherits the shared markdown styling below */ }
.chat-stream-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}
/* "Thinking" style applied during the Haiku tool-routing phase so the agent's
   in-flight narration reads as scratch work, not a duplicate final answer. */
.chat-stream-text-thinking {
    color: #6b7280;
    font-style: italic;
    font-size: 0.875rem;
    line-height: 1.45;
}
/* Trim spurious spacing around the prefix/suffix boundary so it reads as one bubble. */
.chat-message-assistant .chat-message-content .chat-stream-rendered > :first-child { margin-top: 0; }
.chat-message-assistant .chat-message-content .chat-stream-rendered > :last-child  { margin-bottom: 0.4em; }
.chat-message-assistant .chat-message-content .chat-stream-text { margin-top: 0; }

.chat-mermaid-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.5em 0.75em;
    text-align: left;
}
.chat-mermaid-error-label {
    color: #b91c1c;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.35em;
}
.chat-mermaid-error pre {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
    color: #991b1b;
    white-space: pre-wrap;
}

/* Tool-call breadcrumbs (shown above streaming assistant text) */
.chat-tool-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.chat-tool-crumb {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #e0e7ff;
    max-width: 100%;
    white-space: normal;       /* allow long descriptions like `searching documents for "..."` to wrap */
    word-break: break-word;
    line-height: 1.35;
}

.chat-tool-crumb-running {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.chat-tool-crumb-ok {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.chat-tool-crumb-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Typing Indicator */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 1.5rem;
    background: #f3f4f6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

.typing-text {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Input Area */
.chat-input-area {
    padding: 1rem 1.5rem 1.5rem;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(229, 164, 67, 0.1);
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.9375rem;
    line-height: 1.5;
    max-height: 150px;
    padding: 0.25rem 0;
}

#chat-input:focus {
    outline: none;
}

#chat-input::placeholder {
    color: #9ca3af;
}

#chat-input:disabled {
    cursor: not-allowed;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #d4932e;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.chat-input-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        min-width: 100%;
        position: absolute;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .chat-sidebar.open {
        transform: translateX(0);
    }
    
    .chat-message {
        max-width: 90%;
    }
}

/* Utilization page — customer storage bill hero card */
.hero-bill-card { padding: 24px; }
.hero-bill-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: center;
}
.hero-bill-stat { text-align: left; }
.hero-bill-label {
    font-size: 0.8125rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.hero-bill-value {
    font-size: 2rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.1;
}
.hero-bill-sub {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 4px;
}
.hero-bill-total .hero-bill-value { color: var(--primary-color, #E5A443); }
.hero-bill-notice {
    margin-top: 16px;
    padding: 10px 14px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.875rem;
}
@media (max-width: 768px) {
    .hero-bill-row { grid-template-columns: 1fr; gap: 16px; }
}
