/* ============================================
   IrishLaw.ai Design Tokens
   ============================================
   Single source of truth for all design tokens.
   Import this file in all pages to ensure consistency.

   Usage: <link rel="stylesheet" href="tokens.css">
   ============================================ */

:root {
    /* ============================================
       COLOR PALETTE
       ============================================ */

    /* Primary Legal Blue */
    --primary-900: #0A1E33;
    --primary-800: #1E3A5F;
    --primary-700: #264A78;
    --primary-600: #2563EB;
    --primary-500: #3B82F6;
    --primary-400: #60A5FA;
    --primary-300: #93C5FD;
    --primary-200: #BFDBFE;
    --primary-100: #DBEAFE;
    --primary-50: #EFF6FF;

    /* Neutral */
    --gray-900: #111827;
    --gray-800: #1F2937;
    --gray-700: #374151;
    --gray-600: #4B5563;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --gray-50: #F9FAFB;

    /* Success */
    --success-700: #047857;  /* WCAG AA on success-100 */
    --success-600: #059669;
    --success-500: #10B981;
    --success-100: #D1FAE5;
    --success-50: #ECFDF5;

    /* Warning */
    --warning-700: #B45309;  /* WCAG AA on warning-100 */
    --warning-600: #D97706;
    --warning-500: #F59E0B;
    --warning-100: #FEF3C7;
    --warning-50: #FFFBEB;

    /* Error */
    --error-700: #B91C1C;    /* WCAG AA on error-100 */
    --error-600: #DC2626;
    --error-500: #EF4444;
    --error-100: #FEE2E2;
    --error-50: #FEF2F2;

    /* Workflow Accent Colors */
    --purple-700: #6D28D9;   /* WCAG AA on purple-100 */
    --purple-600: #7C3AED;
    --purple-100: #EDE9FE;
    --teal-700: #0F766E;     /* WCAG AA on teal-100 */
    --teal-600: #0D9488;
    --teal-100: #CCFBF1;

    /* Irish Accent (used sparingly) */
    --irish-green: #166534;
    --irish-gold: #CA8A04;

    /* ============================================
       SURFACES & BACKGROUNDS
       ============================================ */
    --bg-app: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;

    /* ============================================
       TEXT
       ============================================ */
    --text-primary: var(--gray-800);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-600);    /* Was gray-500; changed to meet WCAG AA 4.5:1 on gray-50/100 backgrounds */
    --text-inverse: #FFFFFF;

    /* ============================================
       BORDERS
       ============================================ */
    --border-subtle: #E2E8F0;
    --border-default: #CBD5E1;

    /* ============================================
       SHADOWS (Refined, lower opacity)
       ============================================ */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    /* ============================================
       TYPOGRAPHY
       ============================================ */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-legal: 'Source Serif 4', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.7;

    /* ============================================
       SPACING
       ============================================ */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* ============================================
       LAYOUT
       ============================================ */
    --sidebar-width: 280px;
    --header-height: 64px;

    /* ============================================
       BORDER RADIUS
       ============================================ */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* ============================================
       TRANSITIONS
       ============================================ */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;

    /* ============================================
       Z-INDEX SCALE
       ============================================ */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-tooltip: 400;

    /* ============================================
       DIFF HIGHLIGHTING (COMPARE)
       ============================================ */
    --diff-add-bg: #DCFCE7;
    --diff-add-border: #86EFAC;
    --diff-add-text: #166534;
    --diff-remove-bg: #FEE2E2;
    --diff-remove-border: #FCA5A5;
    --diff-remove-text: #991B1B;
    --diff-change-bg: #FEF9C3;
    --diff-change-border: #FDE047;
    --diff-change-text: #854D0E;
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bg-app: #0F172A;
    --bg-card: #1E293B;
    --bg-elevated: #334155;

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;

    --border-subtle: #334155;
    --border-default: #475569;

    --primary-100: #1E3A5F;
    --primary-50: #0F2942;
}

/* ============================================
   BASE RESET
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
}

/* ============================================
   APP LAYOUT (Accessible Scrolling Model)
   ============================================
   - Body is NOT overflow:hidden (allows zoom)
   - .app uses flex with min-height (not fixed height)
   - .content scrolls naturally
   - Sidebar stays fixed via sticky positioning
   ============================================ */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8);
}

/* ============================================
   ACCESSIBILITY: FOCUS STATES
   ============================================ */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   BADGE COMPONENTS (WCAG AA Compliant)
   ============================================
   All badge text colors meet 4.5:1 contrast ratio
   on their respective background colors.
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-compact {
    padding: 3px 8px;
    font-size: 10px;
}

/* Status Badges - Using -700 for WCAG AA compliance */
.badge-success,
.badge-in-force {
    background: var(--success-100);
    color: var(--success-700);  /* 5.4:1 contrast */
}

.badge-warning,
.badge-amended {
    background: var(--warning-100);
    color: var(--warning-700);  /* 4.9:1 contrast */
}

.badge-error,
.badge-repealed {
    background: var(--error-100);
    color: var(--error-700);    /* 5.6:1 contrast */
}

.badge-neutral,
.badge-pending {
    background: var(--gray-100);
    color: var(--gray-700);     /* 6.5:1 contrast */
}

.badge-primary,
.badge-definition {
    background: var(--primary-100);
    color: var(--primary-800);  /* 7.2:1 contrast */
}

.badge-purple,
.badge-confidence {
    background: var(--purple-100);
    color: var(--purple-700);   /* 5.8:1 contrast */
}

.badge-teal {
    background: var(--teal-100);
    color: var(--teal-700);     /* 5.2:1 contrast */
}

/* Status dot inside badge */
.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   ACCESSIBLE TOOLTIPS
   ============================================
   Keyboard-friendly tooltips with:
   - Hover AND focus support
   - Click-to-pin behavior
   - ESC to close
   - Proper ARIA attributes

   Usage:
   <span class="tooltip-trigger" tabindex="0" aria-describedby="tip1">
       term
       <span class="tooltip" id="tip1" role="tooltip">
           Definition text here
       </span>
   </span>
   ============================================ */

.tooltip-trigger {
    position: relative;
    cursor: help;
    /* Visual indicator for interactive element */
    border-bottom: 1px dotted currentColor;
}

/* Viewport-aware tooltip positioning (ID-gpt-wf_2) */
.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: var(--font-ui);
    max-width: min(320px, calc(100vw - 32px));
    width: max-content;
    z-index: var(--z-tooltip);
    line-height: var(--leading-normal);
    box-shadow: var(--shadow-xl);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast) var(--ease-out),
                visibility var(--duration-fast) var(--ease-out);

    /* Prevent text selection while appearing */
    pointer-events: none;
}

/* Viewport overflow prevention - position adjustments */
.tooltip.tooltip-left {
    left: 0;
    transform: translateX(0);
}
.tooltip.tooltip-left::after {
    left: 16px;
    transform: translateX(0);
}
.tooltip.tooltip-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}
.tooltip.tooltip-right::after {
    left: auto;
    right: 16px;
    transform: translateX(0);
}
/* Bottom position when no space above */
.tooltip.tooltip-bottom {
    bottom: auto;
    top: calc(100% + 8px);
}
.tooltip.tooltip-bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--gray-900);
}

/* Tooltip arrow */
.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-900);
}

/* Show on hover */
.tooltip-trigger:hover .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Show on keyboard focus */
.tooltip-trigger:focus .tooltip,
.tooltip-trigger:focus-within .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Pinned state (toggled via JS on click) */
.tooltip-trigger.tooltip-pinned .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Visual indicator when pinned */
.tooltip-trigger.tooltip-pinned {
    background: var(--primary-100);
    border-radius: var(--radius-sm);
}

/* Close button for pinned tooltips */
.tooltip-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

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

/* Show close button when pinned */
.tooltip-pinned .tooltip-close {
    opacity: 1;
}

/* Tooltip content styling */
.tooltip-title {
    font-weight: 600;
    color: var(--primary-300);
    margin-bottom: 4px;
}

.tooltip-source {
    display: block;
    margin-top: 8px;
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-style: italic;
}

/* Definition term variant (inline in legal text) */
.definition-term {
    position: relative;
    cursor: pointer;
    color: var(--purple-700);
    background: var(--purple-100);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    font-style: inherit;
    border-bottom: none;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.definition-term:hover {
    background: var(--purple-200);
}

.definition-term:focus {
    background: var(--purple-600);
    color: white;
}

/* Keyboard focus ring for definition terms */
.definition-term:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ============================================
   DEFINITION TOOLTIP (Click-to-Pin Popover)
   ============================================
   Accessible popover for statutory definitions.
   - Click/tap to open and pin
   - ESC or click outside to close
   - Keyboard: Enter/Space to toggle

   NOTE: This is NOT a hover tooltip. It's a
   click-to-open popover for accessibility.
   ============================================ */

.definition-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: var(--font-ui);
    font-style: normal;
    max-width: 360px;
    min-width: 280px;
    width: max-content;
    z-index: var(--z-tooltip);
    line-height: var(--leading-relaxed);
    box-shadow: var(--shadow-xl);
    text-align: left;

    /* Hidden by default - CLICK to show, not hover */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--duration-fast) var(--ease-out),
                visibility var(--duration-fast) var(--ease-out);
}

/* Tooltip arrow */
.definition-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--gray-900);
}

/* Definition tooltip content */
.definition-tooltip strong {
    display: block;
    color: var(--purple-300);
    font-size: var(--text-base);
    margin-bottom: 8px;
}

.definition-tooltip em {
    display: block;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-700);
    font-size: var(--text-xs);
    font-style: normal;
    color: var(--gray-400);
}

/* Close hint */
.definition-tooltip::before {
    content: 'Press ESC or click outside to close';
    display: block;
    font-size: 10px;
    color: var(--gray-500);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-700);
}

/* ============================================
   PINNED STATE (Click-to-open popover)
   ============================================ */

/* Show ONLY when pinned (clicked) - NOT on hover */
.definition-term.tooltip-pinned .definition-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Visual indicator when pinned/open */
.definition-term.tooltip-pinned {
    background: var(--purple-700);
    color: white;
    box-shadow: 0 0 0 2px var(--purple-300);
}

/* Show on keyboard focus for accessibility */
.definition-term:focus .definition-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   TABLES
   ============================================
   Accessible, responsive tables for legal data.

   Usage:
   <table class="table">
       <thead><tr><th>Header</th></tr></thead>
       <tbody><tr><td>Data</td></tr></tbody>
   </table>

   Modifiers:
   - .table-striped: Alternating row colors
   - .table-hover: Row hover effect
   - .table-compact: Reduced padding
   - .table-bordered: Cell borders
   ============================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    color: var(--text-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Striped rows */
.table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}

/* Hover effect */
.table-hover tbody tr:hover {
    background: var(--primary-50);
}

/* Compact variant */
.table-compact th,
.table-compact td {
    padding: var(--space-2) var(--space-3);
}

/* Bordered variant */
.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-subtle);
}

/* Responsive wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Status cells */
.table .cell-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Numeric cells */
.table .cell-number {
    font-family: var(--font-mono);
    text-align: right;
}

/* Date cells */
.table .cell-date {
    white-space: nowrap;
    color: var(--text-muted);
}

/* Action cells */
.table .cell-actions {
    text-align: right;
    white-space: nowrap;
}

/* ============================================
   LOADING STATES
   ============================================
   Skeleton loaders, spinners, and progress bars.
   ============================================ */

/* Skeleton loader - animated placeholder */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 25%,
        var(--gray-100) 50%,
        var(--gray-200) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

/* Skeleton variants */
.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-heading {
    height: 1.5em;
    width: 40%;
    margin-bottom: var(--space-3);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton-badge {
    width: 80px;
    height: 24px;
    border-radius: var(--radius-full);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

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

/* Spinner sizes */
.spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* Spinner in button */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    opacity: 0.7;
}

/* Progress bar */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-600);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}

/* Progress variants */
.progress-success .progress-bar {
    background: var(--success-600);
}

.progress-warning .progress-bar {
    background: var(--warning-600);
}

.progress-error .progress-bar {
    background: var(--error-600);
}

/* Indeterminate progress */
.progress-indeterminate .progress-bar {
    width: 30%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(2px);
}

/* ============================================
   ERROR STATES
   ============================================
   Alerts, inline errors, and empty states.
   ============================================ */

/* Alert component */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

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

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.alert-message {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.alert-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--duration-fast);
}

.alert-dismiss:hover {
    opacity: 1;
}

/* Alert variants */
.alert-error {
    background: var(--error-50);
    border: 1px solid var(--error-100);
    color: var(--error-700);
}

.alert-error .alert-icon {
    color: var(--error-600);
}

.alert-warning {
    background: var(--warning-50);
    border: 1px solid var(--warning-100);
    color: var(--warning-700);
}

.alert-warning .alert-icon {
    color: var(--warning-600);
}

.alert-success {
    background: var(--success-50);
    border: 1px solid var(--success-100);
    color: var(--success-700);
}

.alert-success .alert-icon {
    color: var(--success-600);
}

.alert-info {
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    color: var(--primary-800);
}

.alert-info .alert-icon {
    color: var(--primary-600);
}

/* Inline error (for form fields) */
.inline-error {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--error-700);
}

.inline-error-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Input error state */
.input-error {
    border-color: var(--error-500) !important;
    background: var(--error-50);
}

.input-error:focus {
    outline-color: var(--error-500);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--gray-300);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-message {
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Connection error state */
.connection-error {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    text-align: center;
}

.connection-error-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--gray-400);
}

.connection-error-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.connection-error-message {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* ============================================
   COPY WITH CITATION
   ============================================
   Legal-specific copy component that includes
   proper citation formatting.

   Usage:
   <div class="citation-block">
       <div class="citation-content">Legal text here</div>
       <button class="citation-copy">Copy with Citation</button>
   </div>
   ============================================ */

.citation-block {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.citation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-subtle);
}

.citation-source {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.citation-content {
    padding: var(--space-4);
    font-family: var(--font-legal);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.citation-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.citation-ref {
    font-family: var(--font-mono);
}

/* Copy button */
.citation-copy {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--primary-700);
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.citation-copy:hover {
    background: var(--primary-100);
    border-color: var(--primary-300);
}

.citation-copy:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.citation-copy-icon {
    width: 14px;
    height: 14px;
}

/* Copy success state */
.citation-copy.copied {
    color: var(--success-700);
    background: var(--success-50);
    border-color: var(--success-200);
}

.citation-copy.copied .citation-copy-icon {
    color: var(--success-600);
}

/* Copy options dropdown */
.citation-options {
    position: relative;
}

.citation-options-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--duration-fast) var(--ease-out);
}

.citation-options.open .citation-options-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.citation-option {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.citation-option:hover {
    background: var(--gray-50);
}

.citation-option:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.citation-option:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.citation-option-label {
    display: block;
    font-weight: 500;
}

.citation-option-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Inline copy button (for smaller contexts) */
.copy-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.copy-inline:hover {
    background: var(--gray-50);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.copy-inline:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.copy-inline.copied {
    color: var(--success-600);
    background: var(--success-50);
    border-color: var(--success-200);
}

.copy-inline-icon {
    width: 14px;
    height: 14px;
}

/* Toast notification for copy feedback */
.copy-toast {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: var(--gray-900);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-out);
}

.copy-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.copy-toast-icon {
    display: inline-flex;
    margin-right: var(--space-2);
    color: var(--success-400);
}

/* ============================================
   ELI CHIP COMPONENT
   ============================================
   Reusable component for European Legislation
   Identifiers. Provides copy, share, and link
   functionality.

   Usage:
   <div class="eli-chip">
       <span class="eli-chip-label">ELI</span>
       <span class="eli-chip-value">/eli/2018/act/7/section/30/eng</span>
       <button class="eli-chip-copy">Copy</button>
   </div>
   ============================================ */

.eli-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--gray-100);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
}

.eli-chip-label {
    padding: 2px 6px;
    background: var(--primary-100);
    color: var(--primary-700);
    font-weight: 700;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    letter-spacing: 0.05em;
}

.eli-chip-value {
    color: var(--text-secondary);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eli-chip-copy {
    padding: 2px 8px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.eli-chip-copy:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

.eli-chip-copy.copied {
    background: var(--success-50);
    border-color: var(--success-300);
    color: var(--success-700);
}

/* ELI chip with link */
.eli-chip-link {
    color: var(--primary-600);
    text-decoration: none;
    cursor: pointer;
}

.eli-chip-link:hover {
    text-decoration: underline;
}

/* Compact variant */
.eli-chip-compact {
    padding: 2px var(--space-2);
}

.eli-chip-compact .eli-chip-value {
    max-width: 180px;
}

/* ============================================
   TRUST MODEL: CONTENT PROVENANCE
   ============================================
   Visual distinction between different types
   of content to maintain professional trust.

   Types:
   (a) Quoted Law - verbatim statutory text
   (b) AI Summary - assistant-generated summary
   (c) Interpretation - AI analysis/implications
   (d) Uncertainty - open questions/assumptions

   Usage:
   <div class="content-quoted-law">...</div>
   <div class="content-ai-summary">...</div>
   <div class="content-interpretation">...</div>
   <div class="content-uncertainty">...</div>
   ============================================ */

/* (a) Quoted Law - Verbatim statutory text */
.content-quoted-law {
    font-family: var(--font-legal);
    background: var(--bg-card);
    border-left: 4px solid var(--primary-600);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    position: relative;
}

.content-quoted-law::before {
    content: 'Statutory Text';
    position: absolute;
    top: -10px;
    left: var(--space-3);
    padding: 2px 8px;
    background: var(--primary-600);
    color: white;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.content-quoted-law blockquote {
    margin: 0;
    font-style: normal;
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.content-quoted-law .quote-marks {
    color: var(--primary-400);
    font-size: 1.5em;
    line-height: 0;
    vertical-align: middle;
}

/* (b) AI Summary - Assistant-generated summary */
.content-ai-summary {
    background: var(--gray-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    position: relative;
}

.content-ai-summary::before {
    content: 'AI Summary';
    position: absolute;
    top: -10px;
    left: var(--space-3);
    padding: 2px 8px;
    background: var(--gray-600);
    color: white;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
}

.content-ai-summary-text {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
}

/* (c) Interpretation - AI analysis/implications */
.content-interpretation {
    background: var(--purple-100);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-left: 4px solid var(--purple-600);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: var(--space-4);
    margin: var(--space-4) 0;
    position: relative;
}

.content-interpretation::before {
    content: 'Analysis';
    position: absolute;
    top: -10px;
    left: var(--space-3);
    padding: 2px 8px;
    background: var(--purple-600);
    color: white;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.content-interpretation-text {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--purple-800);
}

.content-interpretation-note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(124, 58, 237, 0.2);
    font-size: var(--text-xs);
    color: var(--purple-700);
}

/* (d) Uncertainty - Open questions/assumptions */
.content-uncertainty {
    background: var(--warning-50);
    border: 1px dashed var(--warning-500);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    position: relative;
}

.content-uncertainty::before {
    content: 'Requires Verification';
    position: absolute;
    top: -10px;
    left: var(--space-3);
    padding: 2px 8px;
    background: var(--warning-500);
    color: white;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
}

.content-uncertainty-text {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--warning-800);
}

.content-uncertainty-reasons {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-md);
}

.content-uncertainty-reasons-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--warning-700);
    margin-bottom: var(--space-2);
}

.content-uncertainty-reasons-list {
    list-style: none;
    font-size: var(--text-xs);
    color: var(--warning-700);
}

.content-uncertainty-reasons-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.content-uncertainty-reasons-list li::before {
    content: '•';
    color: var(--warning-500);
}

/* ============================================
   LEGAL-SPECIFIC ERROR & EMPTY STATES
   ============================================
   Contextual error handling for legal research.
   ============================================ */

/* No definition found */
.empty-state-no-definition {
    text-align: center;
    padding: var(--space-8);
    background: var(--purple-100);
    border: 1px dashed var(--purple-300);
    border-radius: var(--radius-xl);
}

.empty-state-no-definition .empty-state-icon {
    color: var(--purple-400);
}

.empty-state-suggestions {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    text-align: left;
}

.empty-state-suggestions-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.empty-state-suggestion-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    font-size: var(--text-sm);
    color: var(--primary-700);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--duration-fast);
}

.empty-state-suggestion-item:hover {
    background: var(--primary-50);
}

/* Section not in corpus */
.empty-state-not-in-corpus {
    text-align: center;
    padding: var(--space-8);
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-xl);
}

.empty-state-external-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--primary-600);
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    text-decoration: none;
    margin-top: var(--space-4);
    transition: background var(--duration-fast);
}

.empty-state-external-link:hover {
    background: var(--primary-700);
}

/* Repealed section warning */
.warning-repealed {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--error-50);
    border: 1px solid var(--error-200);
    border-left: 4px solid var(--error-500);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    margin-bottom: var(--space-4);
}

.warning-repealed-icon {
    width: 24px;
    height: 24px;
    color: var(--error-600);
    flex-shrink: 0;
}

.warning-repealed-content {
    flex: 1;
}

.warning-repealed-title {
    font-weight: 600;
    color: var(--error-700);
    margin-bottom: var(--space-1);
}

.warning-repealed-text {
    font-size: var(--text-sm);
    color: var(--error-600);
}

.warning-repealed-link {
    color: var(--error-700);
    text-decoration: underline;
}

/* Commencement unknown */
.warning-commencement {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--warning-50);
    border: 1px solid var(--warning-200);
    border-left: 4px solid var(--warning-500);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    margin-bottom: var(--space-4);
}

.warning-commencement-icon {
    width: 24px;
    height: 24px;
    color: var(--warning-600);
    flex-shrink: 0;
}

.warning-commencement-content {
    flex: 1;
}

.warning-commencement-title {
    font-weight: 600;
    color: var(--warning-700);
    margin-bottom: var(--space-1);
}

.warning-commencement-text {
    font-size: var(--text-sm);
    color: var(--warning-600);
}

/* RAG timeout / service error */
.error-service {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-8);
    background: var(--gray-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    text-align: center;
}

.error-service-icon {
    width: 48px;
    height: 48px;
    color: var(--gray-400);
    margin-bottom: var(--space-4);
}

.error-service-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.error-service-message {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: var(--space-4);
}

.error-service-actions {
    display: flex;
    gap: var(--space-3);
}

.error-service-retry {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--primary-600);
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.error-service-retry:hover {
    background: var(--primary-700);
}

/* ============================================
   MATTER/PROJECT ORGANIZATION
   ============================================
   Sidebar components for organizing legal
   research by client matter.
   ============================================ */

/* Project selector in sidebar */
.project-selector {
    position: relative;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-subtle);
}

.project-selector-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.project-selector-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
    width: 100%;
}

.project-selector-dropdown:hover {
    border-color: var(--primary-400);
}

.project-selector-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.project-selector-name {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-selector-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Project dropdown menu */
.project-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--duration-fast);
}

.project-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.project-menu-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.project-menu-search {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.project-menu-list {
    padding: var(--space-2);
}

.project-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.project-menu-item:hover {
    background: var(--gray-50);
}

.project-menu-item.active {
    background: var(--primary-50);
}

.project-menu-item-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.project-menu-item-info {
    flex: 1;
    min-width: 0;
}

.project-menu-item-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.project-menu-item-client {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.project-menu-item-count {
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

.project-menu-footer {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.project-menu-new {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.project-menu-new:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
    background: var(--primary-50);
}

/* Project menu sections */
.project-menu-section {
    padding: var(--space-2) 0;
}

.project-menu-section:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.project-menu-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    margin: 0;
}

.project-menu-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.project-menu-item-meta span {
    display: inline-flex;
    align-items: center;
}

.project-menu-item-meta span::before {
    content: '•';
    margin: 0 6px;
    color: var(--gray-300);
}

.project-menu-item-meta span:first-child::before {
    display: none;
}

.project-menu-manage {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
    margin-top: var(--space-1);
}

.project-menu-manage:hover {
    color: var(--primary-600);
    background: var(--primary-50);
    border-radius: var(--radius-md);
}

.project-menu-manage svg {
    width: 14px;
    height: 14px;
}

/* Project color options */
.project-color-blue { background: var(--primary-500); }
.project-color-green { background: var(--success-500); }
.project-color-purple { background: var(--purple-600); }
.project-color-orange { background: var(--warning-500); }
.project-color-red { background: var(--error-500); }
.project-color-teal { background: var(--teal-600); }
.project-color-gray { background: var(--gray-500); }

/* Project items in sidebar */
.project-items {
    padding: var(--space-2) var(--space-3);
}

.project-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-items-count {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.project-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast);
    margin-bottom: var(--space-1);
}

.project-item:hover {
    background: var(--gray-50);
}

.project-item-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.project-item-icon.query { background: var(--primary-100); color: var(--primary-600); }
.project-item-icon.definition { background: var(--purple-100); color: var(--purple-600); }
.project-item-icon.section { background: var(--teal-100); color: var(--teal-600); }
.project-item-icon.comparison { background: var(--warning-100); color: var(--warning-600); }

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

.project-item-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-item-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--primary-800);
    color: white;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 9999;
    transition: top var(--duration-fast);
}

.skip-link:focus {
    top: var(--space-4);
}

/* Landmark roles - visual indicators in dev mode */
[data-show-landmarks] main::before,
[data-show-landmarks] nav::before,
[data-show-landmarks] aside::before,
[data-show-landmarks] header::before,
[data-show-landmarks] footer::before {
    content: attr(aria-label);
    position: absolute;
    top: 0;
    left: 0;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 600;
    z-index: 9999;
}

/* Legal text readable line length */
.legal-text {
    font-family: var(--font-legal);
    font-size: var(--text-base);
    line-height: 1.85;
    color: var(--text-primary);
    max-width: 70ch; /* Optimal reading width */
}

.legal-text p {
    margin-bottom: var(--space-4);
}

.legal-text p:last-child {
    margin-bottom: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: var(--gray-400);
        --border-default: var(--gray-600);
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch target sizing (WCAG 2.5.5 - 44x44px minimum for hybrid devices) */
.touch-target {
    position: relative;
    min-height: 44px;
    min-width: 44px;
}

/* For small visual elements that need larger touch areas */
.touch-target-expanded::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    width: 100%;
    height: 100%;
}

/* Icon buttons - ensure adequate touch area */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Small chips with expanded touch targets */
.chip-touch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.chip-touch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
}

/* Focus visible polyfill fallback */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

.js-focus-visible .focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Keyboard focus indicators for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Visible when focused (for skip links, etc.) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hide {
    display: none !important;
}

.block {
    display: block !important;
}

.inline-flex {
    display: inline-flex !important;
}

.relative {
    position: relative !important;
}

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

.text-2xs {
    font-size: 10px !important;
}

.text-xs {
    font-size: var(--text-xs) !important;
}

.text-sm {
    font-size: var(--text-sm) !important;
}

.text-inverse {
    color: var(--text-inverse) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-gray-500 {
    color: var(--gray-500) !important;
}

.font-ui {
    font-family: var(--font-ui) !important;
}

.font-mono {
    font-family: var(--font-mono) !important;
}

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

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

.mt-1 {
    margin-top: var(--space-1) !important;
}

.mt-2 {
    margin-top: var(--space-2) !important;
}

.mt-3 {
    margin-top: var(--space-3) !important;
}

.mb-2 {
    margin-bottom: var(--space-2) !important;
}

.mb-4 {
    margin-bottom: var(--space-4) !important;
}

.ml-1 {
    margin-left: var(--space-1) !important;
}

.px-3 {
    padding-left: var(--space-3) !important;
    padding-right: var(--space-3) !important;
}

.px-5 {
    padding-left: var(--space-5) !important;
    padding-right: var(--space-5) !important;
}

.py-2 {
    padding-top: var(--space-2) !important;
    padding-bottom: var(--space-2) !important;
}

.py-4 {
    padding-top: var(--space-4) !important;
    padding-bottom: var(--space-4) !important;
}

.p-5 {
    padding: var(--space-5) !important;
}

.p-6 {
    padding: var(--space-6) !important;
}

.rounded-md {
    border-radius: var(--radius-md) !important;
}

.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg) !important;
}

.inline-icon {
    display: inline !important;
    vertical-align: -2px !important;
    margin-right: 4px !important;
}

/* ============================================
   ONBOARDING MODAL
   ============================================
   First-use modal to set expectations about
   corpus coverage, limitations, and usage.
   ============================================ */

.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.onboarding-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.onboarding-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
}

.onboarding-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 24px;
    margin: 0 auto var(--space-4);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.onboarding-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.onboarding-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.onboarding-body {
    padding: var(--space-6);
}

.onboarding-section {
    margin-bottom: var(--space-5);
}

.onboarding-section:last-child {
    margin-bottom: 0;
}

.onboarding-section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.onboarding-section-icon.corpus { background: var(--primary-100); color: var(--primary-600); }
.onboarding-section-icon.advice { background: var(--warning-100); color: var(--warning-600); }
.onboarding-section-icon.currency { background: var(--teal-100); color: var(--teal-600); }

.onboarding-section-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.onboarding-section-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

.onboarding-section-list {
    list-style: none;
    padding: 0;
    margin: var(--space-2) 0 0 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.onboarding-section-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.onboarding-section-list li::before {
    content: '•';
    color: var(--text-muted);
    flex-shrink: 0;
}

.onboarding-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.onboarding-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    cursor: pointer;
}

.onboarding-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary-600);
    cursor: pointer;
}

.onboarding-checkbox-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: var(--leading-normal);
}

.onboarding-continue {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--primary-600);
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.onboarding-continue:hover:not(:disabled) {
    background: var(--primary-700);
}

.onboarding-continue:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* ============================================
   CORPUS STATUS INDICATOR
   ============================================
   Sidebar footer showing corpus coverage info.
   ============================================ */

.corpus-status {
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
}

.corpus-status-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.corpus-status-icon {
    width: 14px;
    height: 14px;
}

.corpus-status-stats {
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.corpus-status-updated {
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.corpus-status-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.corpus-status-link:hover {
    text-decoration: underline;
}

/* ============================================
   AS-OF-DATE GLOBAL SELECTOR
   ============================================
   Header component for point-in-time viewing.
   ============================================ */

.as-of-date {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--teal-50);
    border: 1px solid var(--teal-200);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
}

.as-of-date-icon {
    width: 14px;
    height: 14px;
    color: var(--teal-600);
}

.as-of-date-label {
    color: var(--teal-700);
    font-weight: 500;
}

.as-of-date-value {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--teal-300);
    border-radius: var(--radius-sm);
    color: var(--teal-800);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.as-of-date-value:hover {
    border-color: var(--teal-400);
    background: var(--teal-50);
}

.as-of-date-chevron {
    width: 12px;
    height: 12px;
    color: var(--teal-500);
}

/* As-of-date dropdown */
.as-of-date-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--duration-fast);
}

.as-of-date-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.as-of-date-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast);
}

.as-of-date-option:last-child {
    border-bottom: none;
}

.as-of-date-option:hover {
    background: var(--gray-50);
}

.as-of-date-option.active {
    background: var(--teal-50);
    color: var(--teal-700);
}

.as-of-date-option-check {
    width: 16px;
    height: 16px;
    color: var(--teal-600);
    opacity: 0;
}

.as-of-date-option.active .as-of-date-option-check {
    opacity: 1;
}

.as-of-date-option-custom {
    border-top: 1px solid var(--border-subtle);
    color: var(--primary-600);
    font-weight: 500;
}

/* ============================================
   CITATION FORMAT PREFERENCE
   ============================================
   User/matter-level citation format selector.
   ============================================ */

.citation-pref {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
}

.citation-pref-label {
    color: var(--text-muted);
}

.citation-pref-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 2px;
}

.citation-pref-btn {
    padding: var(--space-1) var(--space-2);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.citation-pref-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.citation-pref-btn:hover:not(.active) {
    color: var(--text-secondary);
}

/* Citation display variants */
.citation-human-primary .eli-chip {
    order: 2;
}

.citation-human-primary .citation-readable {
    order: 1;
    font-weight: 600;
}

.citation-eli-primary .eli-chip {
    order: 1;
}

.citation-eli-primary .citation-readable {
    order: 2;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ============================================
   RESPONSE FOOTER DISCLAIMER
   ============================================
   Ambient indicator on every AI response.
   ============================================ */

.response-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    margin-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.response-footer-sources {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.response-footer-sources-icon {
    width: 12px;
    height: 12px;
}

.response-footer-disclaimer {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--warning-600);
}

.response-footer-disclaimer-icon {
    width: 12px;
    height: 12px;
}

/* Expandable disclaimer */
.response-footer-more {
    color: var(--primary-600);
    cursor: pointer;
    text-decoration: underline;
}

/* ============================================
   SETTINGS PANEL
   ============================================
   User preferences modal/panel.
   ============================================ */

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
}

.settings-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Settings Panel - Slide-out from right */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border-default);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transform: translateX(100%);
    transition: transform var(--duration-normal) var(--ease-out);
    display: flex;
    flex-direction: column;
}

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

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.settings-panel-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.settings-panel-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.settings-panel-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.settings-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

/* Legacy class names (for backwards compatibility) */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.settings-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.settings-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.settings-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.settings-body {
    padding: var(--space-5);
}

.settings-section {
    margin-bottom: var(--space-6);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.settings-section-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0 0 var(--space-3) 0;
}

.settings-about {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

.settings-about p {
    margin: 0 0 var(--space-2) 0;
}

.settings-about p:last-child {
    margin-bottom: 0;
}

.settings-about a {
    color: var(--primary-600);
    text-decoration: none;
}

.settings-about a:hover {
    text-decoration: underline;
}

.settings-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2) 0;
}

.settings-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-600);
}

.settings-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--gray-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.settings-option:hover {
    border-color: var(--primary-300);
}

.settings-option.selected {
    background: var(--primary-50);
    border-color: var(--primary-400);
}

.settings-option-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.settings-option.selected .settings-option-radio {
    border-color: var(--primary-500);
}

.settings-option.selected .settings-option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--primary-500);
    border-radius: 50%;
}

.settings-option-content {
    flex: 1;
}

.settings-option-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.settings-option-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.settings-option-example {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ============================================
   LEGAL TEXT LAYOUT (Codex Review)
   Structured rendering for legislative text
   ============================================ */

/* Verbatim legislative quote - distinct from AI summaries */
.legal-quote {
    font-family: var(--font-legal);
    font-size: var(--text-base);
    line-height: 1.85;
    color: var(--gray-800);
    background: var(--gray-50);
    border-left: 3px solid var(--primary-400);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.legal-quote::before {
    content: '"';
    font-size: 2em;
    color: var(--gray-300);
    float: left;
    margin-right: var(--space-2);
    margin-top: -0.25em;
    font-family: Georgia, serif;
}

/* AI-generated summary - visually distinct */
.ai-summary {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    border-radius: var(--radius-md);
    position: relative;
}

.ai-summary::before {
    content: 'AI Summary';
    position: absolute;
    top: calc(-1 * var(--space-2) - 6px);
    left: var(--space-3);
    background: var(--bg-card);
    padding: 0 var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Legislative list with proper nesting */
.legal-list {
    font-family: var(--font-legal);
    font-size: var(--text-base);
    line-height: 1.85;
    padding-left: 0;
    list-style: none;
    counter-reset: legal-item;
}

.legal-list > li {
    position: relative;
    padding-left: 2.5em;
    margin-bottom: var(--space-3);
    text-indent: -2.5em;
    padding-right: 0;
}

.legal-list > li::before {
    counter-increment: legal-item;
    content: "(" counter(legal-item, lower-alpha) ")";
    font-weight: 500;
    color: var(--gray-600);
    display: inline-block;
    width: 2em;
    text-align: left;
    margin-right: 0.5em;
}

/* Nested list: (i), (ii), (iii) */
.legal-list .legal-list-nested {
    counter-reset: legal-nested;
    margin-top: var(--space-2);
    margin-left: 2.5em;
}

.legal-list .legal-list-nested > li::before {
    counter-increment: legal-nested;
    content: "(" counter(legal-nested, lower-roman) ")";
}

/* Subsection with hanging indent */
.legal-subsection {
    font-family: var(--font-legal);
    font-size: var(--text-base);
    line-height: 1.85;
    position: relative;
    padding-left: 3em;
    margin-bottom: var(--space-4);
}

.legal-subsection-number {
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--gray-700);
}

/* Paragraph marker style: (a), (b), etc. */
.legal-paragraph {
    position: relative;
    padding-left: 2em;
    margin-bottom: var(--space-2);
}

.legal-paragraph-marker {
    position: absolute;
    left: 0;
    font-weight: 500;
    color: var(--gray-600);
}

/* Evidence/Provenance marker */
.evidence-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-600);
    background: var(--primary-100);
    border-radius: 50%;
    cursor: pointer;
    vertical-align: super;
    margin-left: 2px;
    transition: all var(--duration-fast);
}

.evidence-marker:hover {
    background: var(--primary-200);
    transform: scale(1.1);
}

/* Evidence popover */
.evidence-popover {
    position: absolute;
    z-index: 100;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3);
    display: none;
}

.evidence-popover.show {
    display: block;
}

.evidence-popover-quote {
    font-family: var(--font-legal);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--gray-50);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--primary-400);
    margin-bottom: var(--space-2);
}

.evidence-popover-citation {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
}
