/* SahayakSetu — Bharat Civic · Night Durbar */

:root {
    /* Deep warm ink (not navy) — reads black/brown under saffron accents. */
    --color-primary-blue: #2a1b12;
    --color-accent-amber: #ea7a1f;
    --color-bg: #070809;
    --color-bg-elevated: #0b0c0e;
    --color-surface: #0d0e11;
    --color-surface-2: #111214;
    --color-border: #2a1d14;
    --color-border-strong: #3a2618;
    --color-accent: #ea7a1f;
    --color-accent-soft: rgba(234, 122, 31, 0.14);
    --color-text: #ece6dc;
    --color-text-muted: #9a8f86;
    --color-success: #2ecc71;
    --color-warn: #e7b24a;
    --color-error: #e74c3c;
    --color-user-bubble: #17100d;
    --color-bot-bubble: #12100e;
    /* Saffron glow / edge (replaces bright blue chrome in components). */
    --color-chrome-line: rgba(234, 122, 31, 0.35);
    --color-chrome-glow: rgba(234, 122, 31, 0.12);

    --font-display: "Libre Baskerville", Georgia, serif;
    --font-body: "DM Sans", system-ui, sans-serif;

    --header-height: 64px;
    --max-width: 1280px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45);
    --shadow-glow-amber: 0 0 48px rgba(234, 122, 31, 0.12);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.62;
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: 0.01em;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 100% 70% at 50% -15%, rgba(234, 122, 31, 0.11), transparent 50%),
        radial-gradient(ellipse 55% 45% at 100% 20%, rgba(58, 42, 30, 0.12), transparent 48%),
        radial-gradient(ellipse 50% 55% at 0% 85%, rgba(15, 21, 34, 0.95), transparent 52%),
        radial-gradient(ellipse 80% 50% at 50% 100%, rgba(58, 42, 30, 0.15), transparent 45%),
        var(--color-bg);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%232a1d14' stroke-width='0.5'%3E%3Cpath d='M0 40h80M40 0v80'/%3E%3C/g%3E%3C/svg%3E");
}

.mandala-frame {
    position: fixed;
    inset: 10px;
    z-index: 0;
    pointer-events: none;
    border: 1px solid rgba(58, 42, 30, 0.12);
    border-radius: 24px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 0 80px rgba(0, 0, 0, 0.25);
}

.header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-height);
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.94) 0%, rgba(10, 14, 20, 0.82) 100%);
    backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(234, 122, 31, 0.5), rgba(58, 42, 30, 0.45), transparent);
    opacity: 0.85;
    pointer-events: none;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.logo-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #e8702a;
    text-shadow: 0 0 28px rgba(234, 122, 31, 0.3);
}

.logo-hindi {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.logo-assistant {
    font-size: 0.68rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--color-primary-blue) 55%, var(--color-text-muted));
    margin-top: 5px;
    letter-spacing: 0.03em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.mode-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-surface-2);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mode-btn {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(234, 122, 31, 0.22), rgba(58, 42, 30, 0.12));
    color: #f2a33a;
    box-shadow: inset 0 0 0 1px rgba(234, 122, 31, 0.25);
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(58, 42, 30, 0.25);
    background: linear-gradient(135deg, rgba(20, 28, 46, 0.95), rgba(18, 26, 42, 0.85));
    font-size: 0.76rem;
    color: var(--color-text-muted);
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
}

.status-dot.pulse {
    animation: status-pulse 1.2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.55; }
}

.main-shell {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 28px 22px 96px;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
    gap: 28px;
    align-items: start;
}

.chat-column {
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

.sidebar-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(22, 31, 48, 0.98) 0%, rgba(15, 21, 34, 0.92) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 22px 20px 20px;
    box-shadow: var(--shadow-lg), var(--shadow-glow-amber);
}

.sidebar-card-accent {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a341f, var(--color-accent), #f2a33a);
    opacity: 0.9;
}

.sidebar-heading {
    position: relative;
    z-index: 1;
    font-family: var(--font-display);
    font-size: 1.08rem;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.sidebar-tab {
    border: 1px solid var(--color-border);
    background: rgba(11, 15, 26, 0.5);
    color: var(--color-text-muted);
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 160ms ease;
}

.sidebar-tab.active {
    color: var(--color-accent);
    border-color: rgba(240, 123, 40, 0.5);
    background: var(--color-accent-soft);
}

.sidebar-tab.tab-glow {
    animation: sidebar-tab-glow 600ms ease-out;
}

@keyframes sidebar-tab-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(240, 123, 40, 0);
    }
    35% {
        box-shadow: 0 0 0 6px rgba(240, 123, 40, 0.22);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(240, 123, 40, 0);
    }
}

.sidebar-panel {
    display: none;
}

.sidebar-panel.active {
    display: block;
}

.sidebar-trust {
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: rgba(11, 15, 26, 0.45);
    margin-bottom: 12px;
}

.sidebar-trust-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.sidebar-trust-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--color-text-muted);
}

.sidebar-trust-dot[data-level="high"] { background: var(--color-success); }
.sidebar-trust-dot[data-level="medium"] { background: var(--color-warn); }
.sidebar-trust-dot[data-level="low"] { background: var(--color-error); }

#sidebarTrustHint {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.sidebar-query {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    background: rgba(19, 25, 41, 0.7);
}

.sidebar-evidence-list {
    display: grid;
    gap: 8px;
}

.sidebar-evidence-row {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: rgba(11, 15, 26, 0.38);
}

.sidebar-evidence-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.sidebar-evidence-rank {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.sidebar-evidence-name {
    font-size: 0.78rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-evidence-score {
    font-size: 0.75rem;
    color: var(--color-accent);
    font-weight: 600;
}

.sidebar-evidence-meter {
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.sidebar-evidence-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b45309, var(--color-accent));
}

.sidebar-empty {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.sidebar-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin: 12px 0 6px;
}

.sidebar-lang {
    font-size: 0.95rem;
    font-weight: 600;
}

.scheme-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
}

.scheme-pill {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(22, 32, 48, 0.9);
    color: var(--color-text);
}

.share-btn {
    margin-top: 18px;
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(234, 122, 31, 0.45);
    background: rgba(234, 122, 31, 0.06);
    color: #f2a33a;
    font-weight: 600;
    padding: 12px 14px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.2s ease, transform 0.18s ease, border-color 0.2s ease;
}

.share-btn:hover {
    background: rgba(234, 122, 31, 0.14);
    border-color: rgba(234, 122, 31, 0.65);
    transform: translateY(-1px);
}

.hero {
    padding-bottom: 32px;
}

.hero-content {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
}

.composer-surface {
    position: relative;
    padding: clamp(20px, 4vw, 36px) clamp(18px, 3vw, 32px) clamp(22px, 3.5vw, 32px);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(58, 42, 30, 0.28);
    background:
        linear-gradient(155deg, rgba(22, 32, 52, 0.78) 0%, rgba(14, 20, 34, 0.58) 100%);
    backdrop-filter: blur(20px) saturate(1.15);
    box-shadow:
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 0 0 1px rgba(234, 122, 31, 0.08),
        0 20px 48px rgba(0, 0, 0, 0.28);
    margin-bottom: 8px;
}

/* Gradient accent (no mask — works everywhere). */
.composer-surface::after {
    content: "";
    position: absolute;
    left: 1px;
    right: 1px;
    top: 1px;
    height: 3px;
    border-radius: calc(var(--radius-xl) - 2px) calc(var(--radius-xl) - 2px) 0 0;
    background: linear-gradient(
        90deg,
        rgba(58, 42, 30, 0.2) 0%,
        rgba(234, 122, 31, 0.8) 45%,
        rgba(58, 42, 30, 0.5) 100%
    );
    pointer-events: none;
}

.finder-panel {
    max-width: 640px;
    margin: 0 auto 28px;
    padding: clamp(20px, 3vw, 28px);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(58, 42, 30, 0.2);
    background: linear-gradient(165deg, rgba(22, 31, 48, 0.92) 0%, rgba(14, 20, 34, 0.88) 100%);
    box-shadow: var(--shadow-md);
}

.finder-panel.hidden {
    display: none;
}

.talk-panel.hidden {
    display: none;
}

.finder-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.finder-sub {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.finder-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.finder-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.finder-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
}

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

.chip {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-muted);
}

.chip:has(input:checked) {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-accent-soft);
}

.chip input {
    display: none;
}

.finder-submit {
    margin-top: 10px;
    border: none;
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    background: linear-gradient(135deg, #ea7a1f 0%, #d97706 45%, #b45309 100%);
    color: #1a0f08;
    font-family: var(--font-body);
    box-shadow: 0 8px 24px rgba(234, 122, 31, 0.25);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.finder-submit:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(234, 122, 31, 0.28);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f2a33a;
    background: linear-gradient(135deg, rgba(234, 122, 31, 0.12), rgba(58, 42, 30, 0.08));
    margin-bottom: 20px;
    box-shadow: 0 0 24px rgba(234, 122, 31, 0.06);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(120deg, #fde68a, var(--color-accent-amber), #ea580c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-subtitle {
    color: var(--color-text-muted);
    max-width: 34rem;
    margin: 0 auto 26px;
    font-size: 1.02rem;
    line-height: 1.55;
}

.language-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
}

.lang-pill {
    position: relative;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    padding: 9px 16px 9px 32px;
    background: rgba(12, 18, 32, 0.65);
    color: var(--color-text-muted);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), transform 0.15s ease;
}

.lang-pill:hover {
    border-color: rgba(58, 42, 30, 0.45);
    color: var(--color-text);
    transform: translateY(-1px);
}

.lang-pill .lang-check {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0;
    color: var(--color-accent);
    transition: opacity 0.2s ease;
}

.lang-pill.active {
    border-color: rgba(234, 122, 31, 0.55);
    color: #fff8f0;
    background: linear-gradient(135deg, rgba(234, 122, 31, 0.18), rgba(58, 42, 30, 0.12));
    box-shadow: 0 4px 20px rgba(234, 122, 31, 0.08);
}

.lang-pill.active .lang-check {
    opacity: 1;
}

.voice-section {
    margin-bottom: 22px;
}

.voice-btn {
    border: none;
    background: transparent;
    display: flex;
    margin: 0 auto 10px;
    cursor: pointer;
}

.voice-btn-inner {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 32% 22%, #f2a33a 0%, transparent 42%),
        radial-gradient(circle at 70% 78%, var(--color-primary-blue) 0%, #0d0a08 100%);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    position: relative;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.voice-btn-inner::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(234, 122, 31, 0.15);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.voice-btn.active .voice-btn-inner::after {
    opacity: 1;
    animation: voice-ring 2s ease-in-out infinite;
}

@keyframes voice-ring {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.06);
        opacity: 0.85;
    }
}

.voice-btn:hover .voice-btn-inner {
    transform: scale(1.03);
}

.voice-btn.active .voice-btn-inner {
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--color-primary-blue) 45%, transparent),
        0 0 28px color-mix(in srgb, var(--color-accent-amber) 55%, transparent),
        0 14px 40px rgba(0, 0, 0, 0.55);
    animation: mic-glow 1.6s ease-in-out infinite;
}

@keyframes mic-glow {
    0%,
    100% {
        box-shadow:
            0 0 0 3px color-mix(in srgb, var(--color-primary-blue) 45%, transparent),
            0 0 22px color-mix(in srgb, var(--color-accent-amber) 45%, transparent),
            0 14px 40px rgba(0, 0, 0, 0.55);
    }
    50% {
        box-shadow:
            0 0 0 4px color-mix(in srgb, var(--color-accent-amber) 50%, transparent),
            0 0 36px color-mix(in srgb, var(--color-primary-blue) 35%, transparent),
            0 14px 40px rgba(0, 0, 0, 0.55);
    }
}

.voice-waveform {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.voice-waveform.hidden {
    display: none;
}

.wave-bar {
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    animation: wave-bounce 0.9s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.12s; }
.wave-bar:nth-child(3) { animation-delay: 0.24s; }
.wave-bar:nth-child(4) { animation-delay: 0.36s; }
.wave-bar:nth-child(5) { animation-delay: 0.48s; }

@keyframes wave-bounce {
    0%, 100% { transform: scaleY(0.45); opacity: 0.7; }
    50% { transform: scaleY(1); opacity: 1; }
}

.voice-btn.active .wave-bar {
    animation-play-state: running;
}

.voice-btn:not(.active) .wave-bar {
    animation-play-state: paused;
}

.mic-icon, .stop-icon {
    width: 32px;
    height: 32px;
    color: #0c1222;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.25));
}

.hidden {
    display: none !important;
}

.voice-label {
    font-weight: 600;
    margin-bottom: 4px;
}

.voice-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.voice-live-caption {
    font-size: 0.88rem;
    color: var(--color-text);
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(8, 12, 22, 0.55);
    border: 1px solid rgba(58, 42, 30, 0.22);
    max-height: 4.5em;
    overflow-y: auto;
    text-align: left;
    line-height: 1.4;
    font-weight: 500;
}

.text-input-section {
    max-width: 520px;
    margin: 0 auto;
}

.text-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding: 6px 6px 6px 10px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(58, 42, 30, 0.2);
    background: rgba(8, 12, 22, 0.65);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input-wrapper:focus-within {
    border-color: rgba(234, 122, 31, 0.45);
    box-shadow:
        inset 0 2px 12px rgba(0, 0, 0, 0.2),
        0 0 0 3px rgba(234, 122, 31, 0.12);
}

.text-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--color-text);
    padding: 12px 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    min-width: 0;
}

.text-input::placeholder {
    color: rgba(148, 163, 184, 0.75);
}

.send-btn {
    flex-shrink: 0;
    width: 48px;
    min-height: 48px;
    align-self: center;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #4a341f 0%, #0f0c0a 50%, #ea7a1f 160%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.2s var(--ease-out), filter 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(58, 42, 30, 0.35);
}

.send-btn-icon {
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.send-btn:hover {
    transform: scale(1.06);
    filter: brightness(1.08);
    box-shadow: 0 6px 24px rgba(58, 42, 30, 0.45);
}

.send-btn:active {
    transform: scale(0.98);
}

.conversation-shell {
    margin-top: 32px;
    padding: 0 4px;
}

.conversation-shell-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.conversation-shell-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.02em;
}

.conversation-shell-hint {
    font-size: 0.75rem;
    color: #b6a99a;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.conversation-scroll {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(52vh, 540px);
    overflow-y: auto;
    padding: 18px 16px 20px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(58, 42, 30, 0.12);
    background:
        linear-gradient(180deg, rgba(14, 20, 34, 0.5) 0%, rgba(10, 14, 22, 0.35) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-sm);
    scrollbar-width: thin;
    scrollbar-color: rgba(234, 122, 31, 0.35) transparent;
}

.conversation-scroll::-webkit-scrollbar {
    width: 8px;
}

.conversation-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(234, 122, 31, 0.45), rgba(58, 42, 30, 0.35));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.message {
    max-width: 88%;
    padding: 14px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.62;
    align-self: flex-start;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}

.message.user {
    align-self: flex-end;
    background: var(--color-user-bubble);
    border-color: rgba(58, 42, 30, 0.25);
    border-radius: 20px 20px 6px 20px;
    animation: msg-in 0.32s var(--ease-out) both;
}

.message.assistant {
    position: relative;
    align-self: flex-start;
    padding-left: 18px;
    background: linear-gradient(165deg, #1a1411 0%, var(--color-bot-bubble) 100%);
    border-color: rgba(46, 74, 120, 0.4);
    border-radius: 20px 20px 20px 6px;
    animation: msg-in 0.38s var(--ease-out) both;
}

.message.assistant::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #ea7a1f, #4a341f);
}

@keyframes msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.error {
    align-self: flex-start;
    border-color: rgba(231, 76, 60, 0.5);
    background: rgba(231, 76, 60, 0.12);
    color: #ffd6d0;
}

.message.moderation-block {
    background: color-mix(in srgb, var(--color-warn) 10%, var(--color-bot-bubble));
    border-left: 3px solid var(--color-warn);
}

.moderation-category-headline {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.moderation-prefix {
    margin-right: 4px;
}

.explain-panel,
.near-miss-panel,
.eligibility-hints-panel {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.explain-panel {
    background: rgba(46, 204, 113, 0.06);
    border-left: 3px solid var(--color-success);
}

.near-miss-panel {
    background: rgba(240, 197, 40, 0.08);
    border-left: 3px solid var(--color-warn);
}

.eligibility-hints-panel {
    background: rgba(234, 122, 31, 0.06);
    border-left: 3px solid var(--color-accent);
}

.explain-panel-title,
.near-miss-panel-title,
.eligibility-hints-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.explain-panel-title {
    color: var(--color-success);
}

.near-miss-panel-title {
    color: var(--color-warn);
}

.eligibility-hints-title {
    color: var(--color-accent);
}

.eligibility-hint-row {
    margin-top: 6px;
    color: var(--color-text);
}

.explain-panel-body,
.near-miss-panel-body {
    color: var(--color-text);
    white-space: pre-wrap;
}

.assistant-wrap {
    align-self: flex-start;
    max-width: 88%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: answer-reveal 220ms var(--ease-out, ease) both;
}

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

.query-understanding {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: rgba(19, 25, 41, 0.9);
    color: var(--color-text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.query-understanding .qu-raw,
.query-understanding .qu-parsed {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.query-understanding .qu-parsed { color: var(--color-accent); }

.confidence-arc {
    display: grid;
    grid-template-columns: 64px auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(11, 15, 26, 0.55);
}
.arc-svg { width: 64px; height: 64px; grid-row: 1 / 3; }
.arc-bg {
    fill: none;
    stroke: rgba(255,255,255,0.12);
    stroke-width: 6;
    stroke-linecap: round;
}
.arc-fill {
    fill: none;
    stroke: #ea7a1f;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--pct, 0));
    transition: stroke-dashoffset 320ms ease;
}
.confidence-arc[data-status="partial"] .arc-fill { stroke: var(--color-warn); }
.confidence-arc[data-status="unverified"] .arc-fill { stroke: var(--color-error); }
.arc-score {
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1;
}
.arc-label {
    font-family: var(--font-display);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #ea7a1f;
}
.confidence-arc[data-status="partial"] .arc-label { color: var(--color-warn); }
.confidence-arc[data-status="unverified"] .arc-label { color: var(--color-error); }
.arc-sub {
    grid-column: 2;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.next-step {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid rgba(240,123,40,0.35);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-sm);
    background: rgba(240,123,40,0.08);
}
.ns-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
.ns-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: var(--color-accent);
    text-transform: uppercase;
    font-family: var(--font-display);
}
.ns-est { font-size: 0.72rem; color: var(--color-text-muted); }
.ns-track { list-style: none; padding-left: 0; }
.ns-step {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
}
.ns-dot {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid var(--color-accent);
    display: grid; place-items: center;
    color: var(--color-accent);
    font-size: 0.72rem;
}
.ns-step strong { font-size: 0.9rem; color: var(--color-text); }
.ns-step p { font-size: 0.78rem; color: var(--color-text-muted); }
.ns-plan-subtitle {
    margin: 2px 0 6px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.ns-plan-list {
    margin: 0 0 10px 18px;
    font-size: 0.8rem;
    color: var(--color-text);
}

/* Grounded action plan (agent) — glass card + motion */
@keyframes ap-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.action-plan-panel {
    margin-top: 12px;
    padding: 16px 16px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(234, 122, 31, 0.35);
    background:
        linear-gradient(135deg, rgba(22, 32, 48, 0.95), rgba(19, 25, 41, 0.88)),
        radial-gradient(120% 80% at 100% 0%, rgba(240, 123, 40, 0.12), transparent 55%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.action-plan-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 45%,
        transparent 55%
    );
    background-size: 200% 100%;
    animation: ap-shimmer 4.5s ease-in-out infinite;
    pointer-events: none;
}

.ap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.ap-kicker {
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #f2a33a;
}

.ap-status-badge {
    font-size: 0.68rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.ap-status-plan-ready {
    border-color: rgba(46, 204, 113, 0.45);
    color: #7dcea0;
    box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.15);
}

.ap-status-need-more-info {
    border-color: rgba(240, 197, 40, 0.5);
    color: #f0d78c;
}

.ap-status-insufficient-data {
    border-color: rgba(138, 155, 176, 0.45);
    color: var(--color-text-muted);
}

.ap-subtitle {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 10px 0 8px;
    position: relative;
    z-index: 1;
}

.ap-eligibility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    position: relative;
    z-index: 1;
}

.ap-e-card {
    padding: 10px 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(11, 15, 26, 0.55);
}

.ap-e-title {
    font-size: 0.88rem;
    margin: 6px 0 4px;
    line-height: 1.25;
}

.ap-e-meta {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.ap-verdict-pill {
    display: inline-block;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
}

.ap-v-ok {
    background: rgba(46, 204, 113, 0.15);
    color: #7dcea0;
    border: 1px solid rgba(46, 204, 113, 0.35);
}

.ap-v-mid {
    background: rgba(240, 197, 40, 0.12);
    color: #f0d78c;
    border: 1px solid rgba(240, 197, 40, 0.35);
}

.ap-v-bad {
    background: rgba(231, 76, 60, 0.12);
    color: #f1948a;
    border: 1px solid rgba(231, 76, 60, 0.35);
}

.ap-v-unknown {
    background: rgba(138, 155, 176, 0.12);
    color: var(--color-text-muted);
    border: 1px solid rgba(138, 155, 176, 0.35);
}

.ap-doc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.ap-chip {
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(234, 122, 31, 0.35);
    background: rgba(234, 122, 31, 0.08);
    color: #fdeccd;
}

.ap-track {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.ap-step {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: flex-start;
}

.ap-dot {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f2a33a;
    border: 1px solid rgba(234, 122, 31, 0.45);
    background: rgba(234, 122, 31, 0.1);
    box-shadow: 0 0 20px rgba(234, 122, 31, 0.12);
}

.ap-step strong {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 4px;
}

.ap-step-detail {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.ap-where {
    display: block;
    word-break: break-word;
}

.ap-time {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.7rem;
    color: #a39688;
}

.ap-questions {
    margin: 0;
    padding-left: 18px;
    font-size: 0.82rem;
    color: var(--color-text);
    position: relative;
    z-index: 1;
}

.ap-questions li {
    margin-bottom: 6px;
}

.ap-disclaimer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    color: var(--color-text-muted);
    line-height: 1.45;
    position: relative;
    z-index: 1;
}

.ap-animate-in {
    opacity: 0;
    animation: ap-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ap-delay-1 { animation-delay: 0.04s; }
.ap-delay-2 { animation-delay: 0.1s; }
.ap-delay-3 { animation-delay: 0.16s; }
.ap-delay-4 { animation-delay: 0.22s; }
.ap-delay-5 { animation-delay: 0.28s; }
.ap-delay-6 { animation-delay: 0.34s; }
.ap-delay-7 { animation-delay: 0.4s; }
.ap-delay-8 { animation-delay: 0.46s; }

.confidence-meter {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    position: relative;
}

.confidence-meter-fill {
    height: 100%;
    border-radius: inherit;
    width: 0%;
    transition: width 0.35s ease;
}

.confidence-meter-fill.low {
    background: linear-gradient(90deg, #f0c528, #e67e22);
}

.confidence-meter-fill.mid {
    background: linear-gradient(90deg, #8a9bb0, #f0c528);
}

.confidence-meter-fill.high {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.confidence-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.typing-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 14px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1a2438, #141c2e);
    border: 1px solid rgba(58, 42, 30, 0.2);
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: typing-bounce 1.05s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: 0ms; }
.typing-dot:nth-child(2) { animation-delay: 160ms; }
.typing-dot:nth-child(3) { animation-delay: 320ms; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-7px); opacity: 1; }
}

.features, .schemes {
    margin-top: 48px;
}

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

.feature-card {
    padding: 22px 20px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(58, 42, 30, 0.15);
    background: linear-gradient(160deg, rgba(22, 31, 48, 0.9) 0%, rgba(14, 20, 34, 0.75) 100%);
    transition: transform 0.22s var(--ease-out), border-color 0.22s ease, box-shadow 0.22s ease;
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(234, 122, 31, 0.28);
    box-shadow: var(--shadow-md), 0 0 40px rgba(234, 122, 31, 0.06);
}

.feature-card h3 {
    font-size: 1.02rem;
    margin: 10px 0 8px;
    font-weight: 700;
}

.feature-card p {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.feature-icon {
    font-size: 1.75rem;
    line-height: 1;
    display: inline-flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(58, 42, 30, 0.1);
    border: 1px solid rgba(58, 42, 30, 0.2);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    margin-bottom: 20px;
    letter-spacing: 0.02em;
    color: var(--color-text);
}

.section-title-inline {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.section-title-inline::after {
    content: "";
    flex: 1;
    height: 1px;
    min-width: 48px;
    background: linear-gradient(90deg, rgba(234, 122, 31, 0.5), rgba(58, 42, 30, 0.25), transparent);
}

.schemes .section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.schemes .section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    min-width: 48px;
    background: linear-gradient(90deg, rgba(58, 42, 30, 0.45), rgba(234, 122, 31, 0.2), transparent);
}

.schemes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.scheme-card {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(46, 74, 120, 0.45);
    background: linear-gradient(165deg, rgba(22, 31, 48, 0.95) 0%, rgba(14, 20, 34, 0.85) 100%);
    padding: 0;
    text-align: left;
    color: inherit;
    transition: transform 0.2s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.scheme-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent);
    transition: width 0.18s ease;
}
.scheme-card[data-ministry="finance"]::before { background: #E4C26B; }
.scheme-card[data-ministry="health"]::before { background: #2ECC71; }
.scheme-card[data-ministry="housing"]::before { background: #ea7a1f; }
.scheme-card[data-ministry="agri"]::before { background: #94C83D; }

.scheme-card:hover {
    transform: translateY(-5px);
    border-color: rgba(234, 122, 31, 0.4);
    box-shadow: var(--shadow-md), 0 0 36px rgba(234, 122, 31, 0.08);
}
.scheme-card:hover::before { width: 6px; }

.scheme-card-main {
    width: 100%;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    padding: 16px 12px 10px;
    cursor: pointer;
}

.scheme-card-main:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.scheme-card h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.scheme-card p {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.scheme-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 0 12px 14px;
    border-top: 1px solid rgba(30, 45, 69, 0.6);
}

.scheme-links.sheet-links {
    border-top: none;
    padding: 0;
    margin-top: 12px;
}

.scheme-link {
    color: var(--color-accent);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 600;
}

.scheme-link:hover {
    text-decoration: underline;
}

.scheme-link.hidden {
    display: none !important;
}

.source-links-block {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(11, 15, 26, 0.55);
}

.source-links-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #c9b8a6;
    margin-bottom: 8px;
    font-weight: 700;
}

.source-links-row {
    padding: 8px 0;
    border-top: 1px dashed rgba(234, 122, 31, 0.22);
}

.source-links-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.source-links-row:last-of-type {
    padding-bottom: 0;
}

.source-links-row {
    margin-bottom: 10px;
}

.source-links-row:last-child {
    margin-bottom: 0;
}

.source-links-scheme-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text);
}

.source-links-confidence {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    line-height: 1.35;
}

.citation-source-block {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(240, 123, 40, 0.25);
    background: rgba(240, 123, 40, 0.06);
}

.citation-footnotes-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-accent);
    margin-bottom: 4px;
}

.citation-footnotes-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin: 0 0 8px;
}

.citation-footnotes {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--color-text-muted);
}

.citation-footnote-item {
    scroll-margin-top: 80px;
}

.primary-source {
    border-left: 3px solid var(--color-accent);
    padding-left: 8px;
    margin-bottom: 6px;
    list-style-position: outside;
}

.citation-fn-primary-line {
    display: block;
    color: var(--color-text);
    margin-bottom: 4px;
}

.citation-fn-primary-link {
    display: inline-block;
    margin-top: 2px;
}

.citation-fn-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.citation-fn-link:hover {
    text-decoration: underline;
}

.cite-ref {
    font-size: 0.72em;
    margin-left: 1px;
}

.cite-ref-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 700;
    cursor: help;
}

.cite-ref-link:hover {
    text-decoration: underline;
}

.source-links-row .scheme-links {
    border-top: none;
    padding: 0;
    gap: 8px 12px;
}

.scheme-sheet {
    position: fixed;
    inset: 0;
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.debug-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background: rgba(15, 21, 34, 0.98);
    border-left: 1px solid var(--color-border);
    transform: translateX(100%);
    transition: transform 220ms ease;
    z-index: 500;
    display: flex;
    flex-direction: column;
}
.debug-drawer.open { transform: translateX(0); }
.debug-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: 14px;
    border-bottom: 1px solid var(--color-border);
}
.debug-drawer-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: 4px;
}
.debug-drawer-header p { font-size: 0.72rem; color: var(--color-text-muted); }
.debug-drawer-content {
    margin: 0;
    padding: 14px;
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--color-text);
    overflow: auto;
    white-space: pre-wrap;
}

.scheme-sheet.open {
    opacity: 1;
    pointer-events: auto;
}

.scheme-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 14, 0.65);
}

.scheme-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(100%);
    transition: transform 0.32s var(--ease-out);
    background: linear-gradient(180deg, rgba(26, 36, 56, 0.98) 0%, rgba(14, 20, 34, 0.98) 100%);
    backdrop-filter: blur(16px);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border: 1px solid rgba(58, 42, 30, 0.2);
    padding: 26px 22px 32px;
    max-height: 72vh;
    overflow-y: auto;
    box-shadow: 0 -24px 64px rgba(0, 0, 0, 0.45);
}

.scheme-sheet.open .scheme-sheet-panel {
    transform: translateY(0);
}

.sheet-close {
    position: absolute;
    right: 14px;
    top: 10px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.6rem;
    cursor: pointer;
}

.sheet-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: 6px;
    padding-right: 32px;
}

.sheet-ministry {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.sheet-line {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.sheet-cta {
    margin-top: 16px;
    width: 100%;
    border-radius: var(--radius-lg);
    border: none;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    background: linear-gradient(135deg, #ea7a1f, #d97706);
    color: #1a0f08;
    font-family: var(--font-body);
    box-shadow: 0 8px 24px rgba(234, 122, 31, 0.22);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.sheet-cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 16px 56px;
    color: var(--color-text-muted);
    font-size: 0.86rem;
    border-top: 1px solid transparent;
    background: linear-gradient(0deg, rgba(8, 12, 20, 0.95) 0%, transparent 100%),
        linear-gradient(90deg, transparent, rgba(58, 42, 30, 0.08), transparent);
}

.footer-note {
    margin-top: 6px;
    font-size: 0.78rem;
}

@media (max-width: 960px) {
    .main-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: 3;
    }

    .nav-link {
        display: none;
    }
    .query-understanding .qu-raw,
    .query-understanding .qu-parsed {
        max-width: 120px;
    }
}

@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .header {
        height: auto;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .main-shell {
        padding-left: 14px;
        padding-right: 14px;
    }

    .composer-surface {
        padding: 18px 14px 20px;
        border-radius: var(--radius-lg);
    }

    .conversation-shell-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .conversation-scroll {
        max-height: none;
        padding: 14px 12px 16px;
    }

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

    .section-title-inline::after,
    .schemes .section-title::after {
        display: none;
    }
}
