/* BIA Edge - Immigration Research Database Stylesheet */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* BIA Edge Brand Colors - Hybrid Theme */
    --primary-color: #1c1d30;      /* Dark navy - header/footer */
    --primary-light: #2a2b42;      /* Lighter navy */
    --accent-color: #B1976B;       /* Gold/tan accent */
    --accent-hover: #9a8259;       /* Darker gold for hover */
    --background: #f7fafc;         /* Light background for content */
    --surface: #ffffff;            /* White surfaces */
    --text-primary: #1c1d30;       /* Dark text on light backgrounds */
    --text-on-dark: #ffffff;       /* White text on dark backgrounds */
    --text-secondary: #4a5568;     /* Secondary text */
    --text-muted: #718096;         /* Muted text */
    --border-color: #e2e8f0;       /* Light borders */
    --border-dark: #3a3b50;        /* Borders on dark backgrounds */
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --error-color: #e53e3e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
}

/* Header - Dark Theme */
header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 20px;
    background-color: var(--primary-color);
    color: var(--text-on-dark);
}

header h1 {
    color: var(--text-on-dark);
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

header h1 a {
    color: var(--text-on-dark);
    text-decoration: none;
}

header h1 a:hover {
    color: var(--accent-color);
}

.site-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

header .subtitle {
    color: #D3D4EE;
    font-size: 1.1rem;
    font-weight: 300;
    max-width: 36rem;
    margin: 0 auto;
    text-wrap: balance;
}

/* Main Navigation */
header nav.main-nav {
    margin-top: 16px;
    display: flex;
    gap: 4px 6px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

header nav.main-nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 5px 8px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    white-space: nowrap;
}

header nav.main-nav a:hover {
    color: #fff;
    background-color: rgba(177, 151, 107, 0.2);
}

header nav.main-nav a.active {
    color: #fff;
    font-weight: 600;
    background-color: rgba(177, 151, 107, 0.25);
}

header nav.main-nav .nav-separator {
    display: none; /* Hide separators - use gaps instead */
}

/* Legacy nav styles for backwards compatibility */
header nav a {
    color: var(--accent-color) !important;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

header nav a:hover {
    color: #c9b186 !important;
}

header nav span {
    color: #D3D4EE !important;
}

header nav strong {
    color: var(--accent-color) !important;
}

/* Search Section */
.search-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.2fr);
    gap: 28px;
    align-items: start;
}

.hero-copy h2 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.08;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.hero-description {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 34rem;
}

.hero-supporting-link {
    margin-top: 18px;
}

.hero-supporting-link a {
    color: var(--accent-hover);
    font-weight: 600;
    text-decoration: none;
}

.hero-supporting-link a:hover {
    text-decoration: underline;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-input-group {
    display: flex;
    gap: 12px;
}

#search-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(177, 151, 107, 0.2);
}

#search-btn {
    padding: 14px 28px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#search-btn:hover {
    background-color: var(--accent-hover);
}

#search-btn:active {
    transform: scale(0.98);
}

#search-btn:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

.search-filters {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.search-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Help Button */
.help-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.help-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Toggle Advanced Button */
.toggle-advanced-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.toggle-advanced-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.toggle-advanced-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Advanced Filters Panel */
.advanced-filters {
    background: var(--background);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
    border: 1px solid var(--border-color);
}

.advanced-filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.advanced-filters-row:last-child {
    margin-bottom: 0;
}

.advanced-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    flex: 1;
}

.advanced-filters label span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.advanced-filters input,
.advanced-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.9rem;
}

.advanced-filters input:focus,
.advanced-filters select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(177, 151, 107, 0.15);
}

.clear-filters-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--error-color);
    border-radius: var(--radius);
    color: var(--error-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-end;
}

.clear-filters-btn:hover {
    background: var(--error-color);
    color: white;
}

/* Checkbox labels in advanced filters */
.advanced-filters .checkbox-label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: auto;
    flex: none;
}

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

.advanced-filters .checkbox-label span {
    font-size: 0.9rem;
    color: var(--text-color);
}

.advanced-filters .filter-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Search Help Tooltip */
.search-help-tooltip {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-width: 320px;
    margin-top: 8px;
}

.search-help-tooltip h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.search-help-tooltip ul {
    list-style: none;
    margin-bottom: 12px;
}

.search-help-tooltip li {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.search-help-tooltip code {
    background: var(--background);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-color);
}

.search-help-tooltip .help-example {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 8px;
}

/* Stats Section */
.stats-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    text-align: center;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stats-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.proof-points-section {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.home-destinations-section {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border: 1px solid rgba(177, 151, 107, 0.18);
    background:
        radial-gradient(circle at top right, rgba(177, 151, 107, 0.16), transparent 32%),
        linear-gradient(180deg, #fffdf9 0%, #ffffff 62%, #f7fafc 100%);
    box-shadow: var(--shadow-md);
}

.home-destinations-header {
    margin-bottom: 22px;
    max-width: 760px;
}

.home-destinations-eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--accent-hover);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.home-destinations-header h2 {
    font-size: 1.85rem;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 8px;
}

.home-destinations-copy {
    color: var(--text-secondary);
    max-width: 680px;
}

.home-destinations-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.home-destination-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(177, 151, 107, 0.28);
    border-top: 4px solid var(--accent-color);
    background:
        linear-gradient(180deg, rgba(28, 29, 48, 0.04) 0%, rgba(177, 151, 107, 0.08) 100%),
        var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(28, 29, 48, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.home-destination-card::after {
    content: '';
    position: absolute;
    inset: auto -36px -36px auto;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(177, 151, 107, 0.18) 0%, rgba(177, 151, 107, 0) 70%);
    pointer-events: none;
}

.home-destination-card:hover,
.home-destination-card:focus-visible {
    transform: translateY(-4px);
    border-color: rgba(177, 151, 107, 0.52);
    box-shadow: 0 16px 32px rgba(28, 29, 48, 0.14);
}

.home-destination-card:focus-visible {
    outline: 3px solid rgba(177, 151, 107, 0.28);
    outline-offset: 2px;
}

.home-destination-kicker {
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
    color: var(--accent-hover);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-destination-card h3 {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    font-size: 1.45rem;
    color: var(--primary-color);
}

.home-destination-card p {
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
}

.home-destination-cta {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 18px;
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
}

.home-destination-card:hover .home-destination-cta,
.home-destination-card:focus-visible .home-destination-cta {
    color: var(--accent-hover);
}

.secondary-tools-section {
    padding: 28px;
    border: 1px solid rgba(28, 29, 48, 0.08);
    background:
        linear-gradient(180deg, rgba(28, 29, 48, 0.02), rgba(177, 151, 107, 0.04)),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.secondary-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.secondary-tool-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 86px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.84);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.secondary-tool-card:hover,
.secondary-tool-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(177, 151, 107, 0.42);
    box-shadow: var(--shadow-md);
}

/* Results Section */
.results-section {
    margin-bottom: 40px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.results-header h2 {
    color: var(--primary-color);
    font-size: 1.4rem;
}

#results-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.active-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.active-filter-chip,
.active-filter-reset {
    border: 1px solid rgba(177, 151, 107, 0.28);
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(177, 151, 107, 0.08);
    color: var(--primary-color);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.active-filter-chip:hover,
.active-filter-reset:hover {
    background: rgba(177, 151, 107, 0.14);
}

.active-filter-reset {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* Result Card */
.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent-color);
    cursor: default;
    transition: box-shadow 0.2s, transform 0.1s;
}

.result-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.result-citation {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    white-space: nowrap;
}

.result-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-meta .meta-pill {
    gap: 0;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.result-meta .filter-pill-button {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.result-meta .filter-pill-button:hover {
    border-color: rgba(177, 151, 107, 0.48);
    background: rgba(177, 151, 107, 0.16);
}

.result-meta .meta-source {
    background: rgba(28, 29, 48, 0.06);
    border-color: rgba(28, 29, 48, 0.14);
    color: var(--primary-color);
}

.result-meta .meta-topic {
    background: rgba(177, 151, 107, 0.12);
    border-color: rgba(177, 151, 107, 0.28);
    color: var(--accent-hover);
}

.result-meta .cited-by {
    color: var(--primary);
    font-weight: 500;
}

.result-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-excerpt.muted {
    color: var(--text-muted);
    font-style: italic;
}

.legal-links {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legal-links a {
    color: var(--accent-color);
    text-decoration: none;
}

.legal-links a:hover {
    text-decoration: underline;
}

.result-excerpt mark {
    background-color: #fef3c7;
    padding: 1px 4px;
    border-radius: 2px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: sticky;
    top: 0;
    float: right;
    margin: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--background);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--border-color);
}

#document-detail {
    padding: 24px;
    padding-top: 0;
}

.doc-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.doc-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.doc-citation {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 500;
}

.doc-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
}

.doc-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.doc-meta-value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.doc-summary {
    margin-bottom: 24px;
}

.doc-summary h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.doc-summary p {
    color: var(--text-primary);
    line-height: 1.7;
}

.doc-text {
    margin-top: 24px;
}

.doc-text h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-text-content {
    background: var(--background);
    border-radius: var(--radius);
    padding: 24px 32px;
    font-size: 1rem;
    line-height: 1.9;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: var(--text-primary);
    text-align: justify;
    hyphens: auto;
}

/* Paragraphs in document text */
.doc-text-content p {
    margin: 0 0 1.2em 0;
    text-indent: 2em;
}

.doc-text-content p:first-child {
    text-indent: 0;
}

/* Section headers in legal documents */
.doc-section-header {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-color);
    margin: 1.5em 0 0.75em 0;
    padding-bottom: 0.25em;
    border-bottom: 2px solid var(--accent-color);
    text-indent: 0 !important;
}

.doc-section-header:first-child {
    margin-top: 0;
}

/* Block quotes in legal documents */
.doc-text-content blockquote,
.doc-quote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background: #f8f9fa;
    border-left: 4px solid var(--accent-color);
    font-style: italic;
    color: var(--text-secondary);
}

.doc-quote p {
    margin: 0;
    text-indent: 0;
}

/* Citation links within document text */
.doc-text-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-color);
    transition: all 0.2s ease;
}

.doc-text-content a:hover {
    color: var(--primary-color);
    border-bottom-style: solid;
    border-bottom-color: var(--primary-color);
}

/* Truncation notice - only style if it contains the truncation text */
.doc-text-content .truncation-notice {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    text-indent: 0;
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid var(--border-color);
}

/* Footnotes section - displayed at bottom of document text */
.doc-footnotes {
    margin-top: 2em;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.doc-footnotes .footnotes-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0 0 1em 0;
}

.doc-footnotes .footnotes-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75em;
}

.doc-footnotes .footnote {
    margin: 0 0 0.75em 0;
    padding-left: 1.5em;
    text-indent: -1.5em;
    line-height: 1.6;
}

.doc-footnotes .footnote sup {
    font-weight: 600;
    color: var(--accent-color);
    margin-right: 0.25em;
}

.doc-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.doc-link:hover {
    background: var(--accent-hover);
}

/* Footer - Dark Theme */
footer {
    text-align: center;
    padding: 24px;
    background-color: var(--primary-color);
    color: #D3D4EE;
    font-size: 0.85rem;
    border-top: none;
    margin-top: 40px;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: #c9b186;
}

footer p {
    margin: 8px 0;
}

.footer-tool-links,
.footer-attribution {
    font-size: 0.84rem;
}

.footer-tool-links a,
.footer-attribution a {
    white-space: nowrap;
}

.about-freshness-status {
    margin-top: 16px;
}

.about-alerts {
    margin: 18px 0;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(214, 158, 46, 0.22);
    background: rgba(214, 158, 46, 0.08);
}

.about-alerts h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.about-alerts ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.about-coverage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 20px;
}

.about-freshness-table-wrap {
    overflow-x: auto;
}

.about-freshness-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.about-freshness-table th,
.about-freshness-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.92rem;
}

.about-freshness-table th {
    background: var(--background);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.error {
    background: #fed7d7;
    color: var(--error-color);
    padding: 16px;
    border-radius: var(--radius);
    margin: 16px 0;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .home-hero {
        grid-template-columns: 1fr;
    }

    .proof-points-section,
    .about-coverage-grid {
        grid-template-columns: 1fr;
    }

    .secondary-tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .container {
        padding: 12px;
    }

    header {
        padding: 24px 12px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header .subtitle {
        max-width: 100%;
        font-size: 0.98rem;
        overflow-wrap: anywhere;
    }

    header nav.main-nav {
        width: 100%;
        max-width: none;
        margin-top: 14px;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    header nav.main-nav a {
        width: 100%;
        text-align: center;
        font-size: 0.76rem;
        padding: 6px 4px;
    }

    .search-input-group {
        flex-direction: column;
    }

    #search-btn {
        width: 100%;
    }

    .search-filters {
        flex-direction: column;
        gap: 12px;
    }

    .result-header {
        flex-direction: column;
    }

    .result-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal {
        padding: 20px 10px;
    }

    .doc-meta {
        grid-template-columns: 1fr;
    }
}


/* =============================================================================
   Q&A Section (Phase 3: Smart Search & AI Q&A)
   ============================================================================= */

.qa-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.qa-header {
    text-align: center;
    margin-bottom: 20px;
}

.qa-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.qa-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.qa-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qa-form textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    min-height: 80px;
}

.qa-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.qa-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.qa-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.qa-options .qa-appendix-toggle {
    font-size: 0.85rem;
}

.qa-options select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    font-size: 0.9rem;
}

#qa-submit {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: auto;
}

#qa-submit:hover {
    background-color: var(--accent-hover);
}

#qa-submit:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

.qa-loading {
    text-align: center;
    padding: 40px;
}

.qa-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.qa-loading p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.qa-response {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.qa-answer {
    margin-bottom: 24px;
}

.qa-answer h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

#qa-answer-text {
    color: var(--text-primary);
    line-height: 1.7;
}

#qa-answer-text p {
    margin-bottom: 12px;
}

#qa-answer-text strong {
    color: var(--primary-color);
}

#qa-answer-text ol, #qa-answer-text ul {
    margin: 12px 0;
    padding-left: 24px;
}

#qa-answer-text li {
    margin-bottom: 8px;
}

#qa-answer-text .error {
    color: var(--error-color);
    padding: 16px;
    background: #fff5f5;
    border-radius: var(--radius);
    border: 1px solid #feb2b2;
}

.qa-sources h4 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.qa-sources ul {
    list-style: none;
    padding: 0;
}

.qa-sources li {
    padding: 12px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.qa-sources .source-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 2px 8px;
}

.qa-sources li a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.qa-sources li a:hover {
    text-decoration: underline;
}

.qa-sources .citation {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.qa-sources .relevance {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 4px 8px;
    border-radius: 4px;
}

.qa-sources .no-sources {
    color: var(--text-muted);
    font-style: italic;
}

.qa-sources .source-group-header {
    background: var(--surface);
    font-weight: 600;
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    padding: 8px 12px;
    margin-top: 12px;
}

.qa-sources .source-group-header:first-child {
    margin-top: 0;
}

.qa-sources .source-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.qa-sources .source-statute,
.qa-sources .source-regulation {
    border-left: 3px solid #6366f1;
}

.qa-sources .source-reference {
    border-left: 3px solid #10b981;
}

.qa-sources .source-case {
    border-left: 3px solid var(--accent-color);
}

.qa-stats {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

.qa-appendix,
.qa-research-steps {
    margin-top: 20px;
}

.qa-appendix h4,
.qa-research-steps h4 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.qa-appendix ul,
.qa-research-steps ul {
    list-style: none;
    padding: 0;
}

.qa-appendix li,
.qa-research-steps li {
    padding: 10px 12px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Responsive Q&A */
@media (max-width: 600px) {
    .qa-options {
        flex-direction: column;
        align-items: stretch;
    }

    #qa-submit {
        margin-left: 0;
        width: 100%;
    }

    .qa-sources li {
        flex-direction: column;
        align-items: flex-start;
    }

    .qa-sources .relevance {
        margin-left: 0;
    }
}

/* =============================================================================
   User Features (Phase 4: User Accounts, Saved Searches, Collections)
   ============================================================================= */

/* Header with user menu */
.header-top {
    position: relative;
    margin-bottom: 8px;
}

.header-top h1 {
    text-align: center;
}

.user-menu {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-buttons {
    display: flex;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--accent-color);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-danger:hover {
    background-color: #c53030;
}

/* User dropdown menu */
.user-dropdown {
    position: relative;
}

.user-menu-btn {
    background: var(--background);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu-btn:hover {
    background: var(--border-color);
}

.dropdown-arrow {
    font-size: 0.7rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 100;
    margin-top: 4px;
}

.dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: var(--background);
}

.dropdown-menu hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Auth Modal */
.auth-modal-content {
    max-width: 400px;
    padding: 32px;
}

.auth-modal-content h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(177, 151, 107, 0.15);
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff5f5;
    border-radius: var(--radius);
}

.auth-modal-content .btn-primary {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Panel Modals (Saved Searches, Collections) */
.panel-modal-content {
    max-width: 600px;
    padding: 24px;
}

.panel-modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.panel-list {
    max-height: 400px;
    overflow-y: auto;
}

.panel-list .empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-style: italic;
}

.panel-item {
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-item:hover {
    background: var(--border-color);
}

.panel-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.panel-item-name {
    font-weight: 600;
    color: var(--primary-color);
}

.panel-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.panel-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.panel-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.panel-item-actions button {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Collection detail */
.collection-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.collection-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Collection select list for add-to-collection */
.collection-select-list {
    max-height: 250px;
    overflow-y: auto;
}

.collection-select-item {
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.collection-select-item:hover {
    background: var(--accent-color);
    color: white;
}

.collection-select-item .doc-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.collection-select-item:hover .doc-count {
    color: rgba(255, 255, 255, 0.8);
}

/* Search preview in save search modal */
.search-preview {
    background: var(--background);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.search-preview code {
    color: var(--accent-color);
    font-family: monospace;
}

/* Doc name preview in add-to-collection */
.doc-name-preview {
    background: var(--background);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 500;
}

/* Results header with actions */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-header-actions {
    display: flex;
    gap: 8px;
}

/* Add to collection button on result cards */
.result-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.quick-view-btn,
.add-to-collection-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-view-btn:hover,
.add-to-collection-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Responsive user features */
@media (max-width: 640px) {
    .header-top {
        position: static;
    }

    .header-top h1 {
        margin-bottom: 12px;
    }

    .site-brand {
        width: 100%;
    }

    .user-menu {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
    }

    .user-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-modal-content,
    .panel-modal-content {
        max-width: 100%;
        padding: 16px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-header-actions {
        width: 100%;
    }

    .results-header-actions button {
        flex: 1;
    }
}

/* =============================================================================
   Citation Validity Badges (ImmCite)
   ============================================================================= */

/* Base validity badge styling */
.validity-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Valid - Green (good law) */
.validity-valid {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

/* Caution - Yellow (limited or questioned) */
.validity-caution {
    background-color: #fefcbf;
    color: #744210;
    border: 1px solid #f6e05e;
}

/* Negative - Orange (distinguished or criticized) */
.validity-negative {
    background-color: #feebc8;
    color: #7b341e;
    border: 1px solid #f6ad55;
}

/* Overruled - Red (bad law) */
.validity-overruled {
    background-color: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

/* Vacated - Red (no longer controlling) */
.validity-vacated {
    background-color: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

/* Reinstated - Teal/Cyan (was overruled, now good law again) */
.validity-reinstated {
    background-color: #b2f5ea;
    color: #234e52;
    border: 1px solid #4fd1c5;
}

/* Unchecked - Gray (validity not yet determined) */
.validity-unchecked {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* Not applicable - muted (outside precedential ImmCite scope) */
.validity-not_applicable {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

/* Validity banner in document detail modal */
.validity-banner {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.validity-banner-icon {
    font-size: 1.2rem;
}

.validity-banner-content {
    flex: 1;
}

.validity-banner-status {
    font-weight: 600;
    margin-bottom: 2px;
}

.validity-banner-reason {
    font-size: 0.9rem;
    opacity: 0.9;
}

.validity-banner.valid {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.validity-banner.caution {
    background-color: #fefcbf;
    color: #744210;
    border: 1px solid #f6e05e;
}

.validity-banner.negative {
    background-color: #feebc8;
    color: #7b341e;
    border: 1px solid #f6ad55;
}

.validity-banner.overruled {
    background-color: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

.validity-banner.vacated {
    background-color: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

.validity-banner.reinstated {
    background-color: #b2f5ea;
    color: #234e52;
    border: 1px solid #4fd1c5;
}

.validity-banner.not_applicable {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* Chain history section for reinstated cases */
.validity-chain-history {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
}

.validity-chain-history h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.validity-chain-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.validity-chain-item::before {
    content: "→";
    opacity: 0.6;
}

.validity-chain-item:first-child::before {
    content: "";
}

/* Link to case giving negative treatment */
.validity-treating-case {
    margin-top: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.validity-treating-label {
    opacity: 0.8;
    font-weight: 500;
}

.validity-case-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.validity-case-link:hover {
    text-decoration-style: solid;
    opacity: 0.8;
}

.validity-treatment-type {
    font-size: 0.8rem;
    opacity: 0.7;
    font-style: italic;
    margin-left: 4px;
}

/* Make link colors work in different banner contexts */
.validity-banner.overruled .validity-case-link {
    color: #822727;
}

.validity-banner.negative .validity-case-link {
    color: #7b341e;
}

.validity-banner.caution .validity-case-link {
    color: #744210;
}

.validity-banner.reinstated .validity-case-link {
    color: #234e52;
}

/* Result card with validity indicator */
.result-card.has-validity-overruled {
    border-left-color: var(--error-color);
}

.result-card.has-validity-vacated {
    border-left-color: var(--error-color);
}

.result-card.has-validity-caution {
    border-left-color: var(--warning-color);
}

.result-card.has-validity-negative {
    border-left-color: #dd6b20;
}

/* =============================================================================
   Case Outcome Badges
   ============================================================================= */

/* Base outcome badge styling */
.outcome-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-left: 6px;
}

/* Granted - Green (favorable to applicant) */
.outcome-granted {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

/* Denied - Red (unfavorable to applicant) */
.outcome-denied {
    background-color: #fed7d7;
    color: #822727;
    border: 1px solid #fc8181;
}

/* Remanded - Blue (sent back for further proceedings) */
.outcome-remanded {
    background-color: #bee3f8;
    color: #2a4365;
    border: 1px solid #90cdf4;
}

/* Dismissed - Gray (procedural dismissal) */
.outcome-dismissed {
    background-color: #e2e8f0;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

/* Sustained - Green variant (appeal sustained) */
.outcome-sustained {
    background-color: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

/* Reversed - Orange (lower decision reversed) */
.outcome-reversed {
    background-color: #feebc8;
    color: #7b341e;
    border: 1px solid #f6ad55;
}

/* Affirmed - Blue variant (lower decision affirmed) */
.outcome-affirmed {
    background-color: #e9d8fd;
    color: #553c9a;
    border: 1px solid #d6bcfa;
}

/* Default/Other outcome */
.outcome-other {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* =============================================================================
   View PDF Button (Prominent in document detail header)
   ============================================================================= */

.view-pdf-btn {
    padding: 10px 20px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.view-pdf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* =============================================================================
   Document Modal Back Button
   ============================================================================= */

.doc-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* ========================================
   Citation Links
   ======================================== */

/* Internal document link - linked to a case in our database */
.citation-link.citation-internal {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent-color);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.citation-link.citation-internal:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    border-bottom-style: solid;
}

/* Internal statute link - linked to a statute in our database */
.citation-link.citation-statute {
    color: #2e7d32;
    text-decoration: none;
    border-bottom: 1px dashed #2e7d32;
    cursor: pointer;
}

.citation-link.citation-statute:hover {
    color: #1b5e20;
    border-bottom-style: solid;
}

/* External link - links to external resources (CourtListener, Cornell, etc.) */
.citation-link.citation-external {
    color: #6b46c1;
    text-decoration: none;
    border-bottom: 1px dotted #6b46c1;
    cursor: pointer;
}

.citation-link.citation-external:hover {
    color: #553c9a;
    border-bottom-style: solid;
}

.citation-link.citation-external::after {
    content: "↗";
    font-size: 0.7em;
    margin-left: 2px;
    vertical-align: super;
    opacity: 0.7;
}

/* Unlinked citation - styled but not clickable */
.citation-unlinked {
    color: var(--text-secondary);
    background-color: #f0f4f8;
    padding: 0 3px;
    border-radius: 2px;
}

/* Toggle button for linked citations */
#toggle-linked-citations {
    font-size: 0.75rem;
    padding: 4px 10px;
    vertical-align: middle;
}

#toggle-linked-citations:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ========================================
   Headnotes Section
   ======================================== */

.doc-headnotes {
    margin-top: 16px;
    padding: 16px;
    background: #f0fdf4;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
}

.doc-headnotes h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 8px;
}

.headnote-item {
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #86efac;
    transition: box-shadow 0.2s;
}

.headnote-item:hover {
    box-shadow: 0 2px 8px rgba(22, 101, 52, 0.1);
}

.headnote-item.primary {
    border-left-color: #16a34a;
}

.headnote-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.headnote-badge.primary {
    background: #16a34a;
    color: white;
}

.headnote-badge.secondary {
    background: #dcfce7;
    color: #166534;
}

.headnote-title {
    font-weight: 600;
    color: #166534;
    font-size: 0.95rem;
}

.headnote-text {
    margin: 0;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.5;
}

.headnote-topic {
    font-size: 0.75rem;
    color: #059669;
    text-decoration: none;
    background: #ecfdf5;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 8px;
}

.headnote-topic:hover {
    background: #d1fae5;
}

/* =============================================================================
   Canonical Case Reader
   ============================================================================= */

.case-reader-page {
    max-width: 1320px;
}

.reader-loading,
.reader-error {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
}

.reader-error {
    color: var(--error-color);
}

.reader-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.reader-header-card {
    background: var(--surface);
    border: 1px solid #d9dee7;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.reader-case-name {
    color: var(--primary-color);
    font-size: 1.65rem;
    margin: 0 0 6px 0;
    line-height: 1.25;
}

.reader-case-citation {
    font-size: 0.98rem;
    color: #8b6d3e;
    margin: 0 0 6px 0;
    font-weight: 700;
}

.reader-case-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

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

.reader-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.65fr) minmax(320px, 1fr);
    gap: 14px;
}

.reader-main-card,
.reader-sidebar-card {
    background: var(--surface);
    border: 1px solid #d9dee7;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.reader-main-card {
    overflow: hidden;
}

.reader-analysis-content {
    background: #f7f9fc;
    border-bottom: 1px solid #d9dee7;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reader-brief {
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    padding: 14px;
}

.reader-brief h3 {
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    color: #4a5568;
    margin: 0 0 10px 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.reader-brief h4 {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #374151;
    margin: 10px 0 8px;
}

.reader-brief p {
    font-size: 0.92rem;
    color: #1f2937;
    margin: 0;
    line-height: 1.65;
}

.reader-brief-summary {
    border-left: 4px solid #4a5568;
}

.reader-headnotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.reader-headnote-card {
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #fcfdff;
    padding: 10px;
}

.reader-headnote-card h4 {
    margin: 6px 0;
    font-size: 0.88rem;
    line-height: 1.3;
    color: #1f2937;
}

.reader-headnote-card p {
    font-size: 0.85rem;
    color: #4b5563;
}

.reader-headnote-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.reader-headnote-index {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    background: #e8edf5;
    color: #374151;
}

.reader-headnote-topic {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef4ff;
    color: #334155;
}

.reader-chip-group {
    margin-top: 8px;
}

.reader-chip-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.reader-chip {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.77rem;
    font-weight: 600;
    color: #334155;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #ccd7e6;
    background: #f4f7fb;
}

.reader-chip:hover {
    background: #e8eef8;
}

.reader-chip.statute {
    background: #f1f7ff;
}

.reader-chip.regulation {
    background: #fff8ed;
}

.reader-chip.reference {
    background: #f5f2ff;
}

.reader-list-block ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reader-list-block li {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: baseline;
    font-size: 0.83rem;
    padding: 7px 9px;
    border: 1px solid #e3e9f2;
    border-radius: 7px;
    background: #fbfdff;
}

.reader-list-block li span {
    color: #6b7280;
    font-size: 0.78rem;
}

.reader-list-block a {
    color: #1f3f7f;
    text-decoration: none;
    font-weight: 600;
}

.reader-list-block a:hover {
    text-decoration: underline;
}

.reader-text-topbar {
    border-bottom: 1px solid #d9dee7;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    color: #64748b;
    background: #f8fafc;
}

.reader-mode-indicator {
    font-weight: 700;
    color: #374151;
}

.reader-text-content {
    padding: 32px 40px;
    color: #1f2937;
    font-family: "Iowan Old Style", "Book Antiqua", Palatino, "Times New Roman", serif;
    font-size: 1.045rem;
    line-height: 1.9;
    max-width: 84ch;
    margin: 0 auto;
    text-align: left;
    min-height: 50vh;
    background: #fffdf9;
    hyphens: auto;
    font-feature-settings: "liga", "onum";
}

.reader-text-heading {
    margin: 1.4em 0 0.75em;
    font-family: var(--font-body);
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #374151;
    border-top: 1px solid #dbe3ef;
    padding-top: 0.7em;
}

.reader-text-content p {
    margin: 0 0 1.15em;
    text-indent: 1.45em;
}

.reader-text-content p:first-of-type,
.reader-text-heading + p,
.reader-footnotes p,
.reader-truncation-note,
.reader-empty {
    text-indent: 0;
}

.reader-case-paragraph {
    margin: 0 0 1.15em;
    text-indent: 1.45em;
}

.reader-case-paragraph:first-of-type,
.reader-text-heading + .reader-case-paragraph {
    text-indent: 0;
}

.reader-list-item {
    margin: 0 0 0.95em;
    text-indent: 0;
    padding-left: 1.2em;
    position: relative;
}

.reader-list-item::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #64748b;
}

.reader-footnote-paragraph {
    margin: 0 0 0.85em;
    text-indent: 0;
    padding-left: 0.85em;
    color: #334155;
    font-size: 0.92rem;
    border-left: 2px solid #dbe3ef;
}

.reader-text-content.linked-mode {
    font-family: "Iowan Old Style", "Book Antiqua", Palatino, "Times New Roman", serif;
}

.reader-text-content a {
    color: #1f3f7f;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

#reader-text-content ::selection {
    background: #fff0a6;
    color: #111827;
}

.reader-truncation-note {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
}

.reader-footnotes {
    margin-top: 1.9em;
    border-top: 1px solid #dbe3ef;
    padding-top: 1em;
}

.reader-footnotes h4 {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.65em;
}

.reader-footnotes p {
    font-size: 0.88rem;
    color: #374151;
}

.reader-empty {
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-body);
}

.reader-sidebar-card {
    position: sticky;
    top: 10px;
    align-self: start;
    max-height: calc(100vh - 20px);
    overflow: auto;
    padding: 13px;
    background: #fcfdff;
}

.reader-sidebar-section + .reader-sidebar-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.reader-sidebar-section h3 {
    font-size: 1rem;
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.reader-validity-status {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
}

.reader-validity-reason {
    font-size: 0.87rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.reader-citation-counts {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.annotation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.annotation-mode-note,
.annotation-login-prompt,
.annotation-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.annotation-login-prompt {
    color: #9b2c2c;
}

.annotation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.annotation-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
    background: #ffffff;
}

.annotation-item.unresolved {
    border-left: 4px solid #d69e2e;
}

.annotation-item.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(177, 151, 107, 0.2);
}

.annotation-item-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.annotation-item-status {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.annotation-item-time {
    font-size: 0.73rem;
    color: var(--text-muted);
}

.annotation-item-quote {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.annotation-item-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    white-space: pre-wrap;
}

.annotation-item-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.annotation-toolbar {
    position: absolute;
    z-index: 1200;
    background: var(--primary-color);
    border: 1px solid #212336;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: flex;
    gap: 6px;
}

.annotation-toolbar .btn-primary,
.annotation-toolbar .btn-secondary {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    padding: 6px 10px;
}

.annotation-toolbar .btn-secondary {
    background: transparent;
}

.reader-highlight {
    background: #ffe88c;
    border-radius: 2px;
    padding: 0 1px;
}

.reader-highlight.focus {
    animation: reader-highlight-focus 1.2s ease-out;
}

@keyframes reader-highlight-focus {
    0% {
        background: #fcd34d;
    }
    100% {
        background: #fff1a8;
    }
}

@media (max-width: 1024px) {
.reader-layout {
        grid-template-columns: 1fr;
    }

    .reader-sidebar-card {
        position: static;
        max-height: none;
    }
}

@media (max-width: 640px) {
    .home-destinations-section {
        padding: 22px 18px;
    }

    .home-destinations-header h2 {
        font-size: 1.5rem;
    }

    .home-destinations-grid {
        grid-template-columns: 1fr;
    }

    .secondary-tools-section {
        padding: 22px 18px;
    }

    .home-destination-card {
        min-height: 0;
    }

    .reader-case-name {
        font-size: 1.4rem;
    }

    .reader-analysis-content {
        padding: 12px;
    }

    .reader-list-block li {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .reader-text-content {
        padding: 20px 18px;
        font-size: 1rem;
        line-height: 1.8;
    }

    .reader-header-card {
        padding: 14px;
    }

    .reader-header-actions .btn-primary,
    .reader-header-actions .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .annotation-toolbar {
        max-width: calc(100vw - 24px);
        overflow-x: auto;
    }
}
