/* ============================================
   Leaf Intelligence — Enforcement Analytics
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
th, td, td button, td a { text-align: left !important; }
html { scroll-behavior: smooth; }
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 25%, #f0fdf4 50%, #eff6ff 75%, #fdf4ff 100%);
    background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.06); }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.12); }
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse-ring { 0% { transform: scale(0.8); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 0; } 100% { transform: scale(0.8); opacity: 0; } }
@keyframes shimmer { 0% { background-position: 200% 50%; } 100% { background-position: -200% 50%; } }

.animate-fadeIn { animation: fadeIn 0.4s ease-out; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease-out; }
.animate-shimmer { animation: shimmer 3s ease-in-out infinite; }
.skeleton-bar {
    display: inline-block;
    height: 1.5rem;
    width: 3rem;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Staggered children */
.page-content > *:nth-child(1) { animation: fadeInUp 0.4s ease-out 0.05s both; }
.page-content > *:nth-child(2) { animation: fadeInUp 0.4s ease-out 0.1s both; }
.page-content > *:nth-child(3) { animation: fadeInUp 0.4s ease-out 0.15s both; }
.page-content > *:nth-child(4) { animation: fadeInUp 0.4s ease-out 0.2s both; }
.page-content > *:nth-child(5) { animation: fadeInUp 0.4s ease-out 0.25s both; }
.page-content > *:nth-child(6) { animation: fadeInUp 0.4s ease-out 0.3s both; }

/* ============================================
   Floating Sidebar Rail
   ============================================ */

#sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: 60px;
    z-index: 50;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04);
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
#sidebar nav {
    overflow-x: hidden;
}
#sidebar:hover {
    width: 220px;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.10),
        0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 56px;
    flex-shrink: 0;
}
.sidebar-logo > div:first-child {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
}

/* User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

/* Labels — hidden when collapsed */
.sidebar-label {
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    transition: opacity 0.18s ease, max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
#sidebar:hover .sidebar-label {
    opacity: 1;
    max-width: 180px;
    pointer-events: auto;
}

/* Badge (RPI count, BETA tag) */
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: auto;
    line-height: 1.4;
}

/* Nav icon sizing */
.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    min-width: 20px;
}

/* Navigation Buttons */
.nav-btn {
    color: #64748b;
    font-weight: 500;
    position: relative;
    justify-content: flex-start;
    padding-left: 18px;
    min-height: 42px;
}
.nav-btn:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.04);
}
.nav-btn.active {
    color: #0f172a;
    background: rgba(22, 163, 74, 0.08);
}
.nav-btn.active .nav-icon {
    color: #16a34a;
}
/* Sidebar pinned (mobile toggle / manual pin) */
#sidebar.sidebar-pinned {
    width: 220px;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.10),
        0 2px 6px rgba(0, 0, 0, 0.05);
}
#sidebar.sidebar-pinned .sidebar-label {
    opacity: 1;
    max-width: 180px;
    pointer-events: auto;
}

/* Active dot indicator */
.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.5);
}

/* KPI Card hover */
.kpi-card { transition: all 0.2s ease; }
.kpi-card:hover { transform: translateY(-2px); }

/* Page transitions */
.page-content { display: none; }
.page-content.active { display: block; }
#page-documents.active { display: block; }

/* Loading overlay hide */
.loading-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Trend view loading overlay — fills the container as a standalone block */
.trend-loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    background: rgba(248, 250, 252, 0.95);
    border-radius: 0.75rem;
    animation: trendFadeIn 0.2s ease-out;
}
.trend-loading-overlay.fade-out {
    animation: trendFadeOut 0.3s ease-out forwards;
}
.trend-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: trendSpin 0.8s linear infinite;
}
@keyframes trendSpin {
    to { transform: rotate(360deg); }
}
@keyframes trendFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes trendFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Table rows */
tbody tr { transition: background-color 0.15s ease; }

/* Chart canvas responsive */
canvas { max-width: 100%; }

/* Risk gauge animation */
@keyframes gaugeStroke {
    from { stroke-dashoffset: 314; }
}
.page-content.active circle:nth-child(2) {
    animation: gaugeStroke 1.2s ease-out;
}

/* Accent input */
input[type="checkbox"] {
    cursor: pointer;
}

/* Focus ring brand color */
*:focus-visible {
    outline: 2px solid rgba(22, 163, 74, 0.4);
    outline-offset: 2px;
}

/* Leaf AI page — flex column chat layout */
#page-leafai.active { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#page-leafai #leafai-messages { scrollbar-width: thin; }

/* Leaf AI message animation */
@keyframes leafMsgIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.leaf-msg-in { animation: leafMsgIn 0.3s ease-out; }

/* Heatmap cells */
.heatmap-cell { user-select: none; transition: opacity 0.12s, transform 0.12s; }
.heatmap-cell:hover { opacity: 0.82; transform: scale(1.08); box-shadow: 0 0 0 2px rgba(22,163,74,0.45); position: relative; z-index: 1; }

/* Vendor search card hover */
.vendor-suggest-card { transition: all 0.18s ease; }
.vendor-suggest-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

/* Data Search tab toggle */
.ds-tab-btn { cursor: pointer; border: none; background: none; }
.ds-panel.hidden { display: none; }

/* ============================================
   Leaf AI Chat UI — Ported from leafai.html
   ============================================ */

/* Chat message entry animation */
.fade-in-up { animation: fadeInUp 0.5s ease forwards; }

/* Context card animation */
.context-card-enter { animation: contextCardSlideIn 0.3s ease-out; }
@keyframes contextCardSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.context-tab-btn { white-space: nowrap; transition: all 0.2s ease; }
.context-tab-btn:hover { background: #f8fafc; }

/* Typing indicator */
.typing-indicator span {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #94a3b8;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Stream cursor */
.stream-cursor {
    display: inline-block; width: 2px; height: 1.2em;
    background: #10b981; margin-left: 2px;
    animation: blink 1s infinite; vertical-align: text-bottom;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ── Artifact Container ── */
.artifact-container {
    background: white; border-radius: 16px; overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.2);
    position: relative;
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.1),
        0 2px 8px rgba(16, 185, 129, 0.15),
        0 8px 24px rgba(6, 182, 212, 0.12),
        0 16px 48px rgba(14, 165, 233, 0.08);
}
.artifact-container:hover {
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.2),
        0 4px 12px rgba(16, 185, 129, 0.2),
        0 12px 32px rgba(6, 182, 212, 0.18),
        0 20px 56px rgba(14, 165, 233, 0.12);
}
.artifact-container::before {
    content: ''; position: absolute; inset: -2px;
    border-radius: 18px; padding: 2px;
    background: linear-gradient(135deg,
        rgba(16, 185, 129, 0.4) 0%,
        rgba(6, 182, 212, 0.4) 50%,
        rgba(14, 165, 233, 0.4) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0.6; pointer-events: none; z-index: -1; filter: blur(8px);
}

/* ── Report Content (markdown rendering) ── */
.report-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1e293b; line-height: 1.75; font-size: 0.9375rem; font-weight: 400;
}
.report-content h1 {
    font-size: 2rem; font-weight: 600; color: #0f172a;
    margin-top: 2.5rem; margin-bottom: 1.25rem;
    padding-bottom: 0.75rem; border-bottom: 2px solid #10b981; line-height: 1.3;
}
.report-content h1:first-child { margin-top: 0; }
.report-content h2 {
    font-size: 1.5rem; font-weight: 600; color: #0f172a;
    margin-top: 2rem; margin-bottom: 1rem;
    padding-left: 0.75rem; border-left: 3px solid #10b981; line-height: 1.4;
}
.report-content h3 {
    font-size: 1.25rem; font-weight: 500; color: #334155;
    margin-top: 1.75rem; margin-bottom: 0.875rem; line-height: 1.4;
}
.report-content h4 {
    font-size: 1.125rem; font-weight: 500; color: #475569;
    margin-top: 1.5rem; margin-bottom: 0.75rem; line-height: 1.4;
}
.report-content h5 {
    font-size: 1rem; font-weight: 500; color: #475569;
    margin-top: 1.25rem; margin-bottom: 0.625rem; line-height: 1.4;
}
.report-content p {
    color: #334155; line-height: 1.8; margin-bottom: 1.25rem;
    text-align: left; font-weight: 400;
}
.report-content strong, .report-content b { color: #0f172a; font-weight: 500; }
.report-content em, .report-content i { font-style: italic; color: #475569; }
.report-content ul, .report-content ol {
    margin-left: 1.75rem; margin-bottom: 1.25rem; padding-left: 0.5rem;
}
.report-content ul { list-style-type: disc; }
.report-content ol { list-style-type: decimal; }
.report-content li {
    color: #334155; line-height: 1.8; margin-bottom: 0.625rem; padding-left: 0.5rem;
}
.report-content ul li::marker { color: #10b981; font-size: 1.2em; }
.report-content ol li::marker { color: #10b981; font-weight: 600; }
.report-content blockquote {
    border-left: 4px solid #10b981; padding-left: 1.5rem;
    padding-top: 0.5rem; padding-bottom: 0.5rem;
    margin: 1.5rem 0; background: #f8fafc;
    border-radius: 0 8px 8px 0; color: #475569; font-style: italic;
}
.report-content code {
    background: #f1f5f9; padding: 0.125rem 0.375rem; border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace; font-size: 0.875em;
    color: #be185d; border: 1px solid #e2e8f0;
}
.report-content pre {
    background: #1e293b; color: #e2e8f0; padding: 1.25rem;
    border-radius: 8px; overflow-x: auto; margin: 1.5rem 0;
    border: 1px solid #334155;
}
.report-content pre code {
    background: transparent; color: inherit; padding: 0;
    border: none; font-size: 0.875rem;
}
.report-content a {
    color: #0891b2; text-decoration: underline;
    text-decoration-color: rgba(8, 145, 178, 0.3);
    text-underline-offset: 2px; transition: all 0.2s ease;
}
.report-content a:hover { color: #0e7490; text-decoration-color: rgba(14, 116, 144, 0.6); }
.report-content hr { border: none; border-top: 2px solid #e2e8f0; margin: 2rem 0; }
.report-content table {
    width: 100%; border-collapse: collapse; margin: 2rem 0;
    font-size: 0.8125rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.report-content thead { background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); }
.report-content th {
    color: #0f172a; font-weight: 500; padding: 0.75rem 1rem;
    text-align: left; border-bottom: 2px solid #10b981;
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.05em; line-height: 1.5;
}
.report-content td {
    padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0;
    color: #334155; font-weight: 400; line-height: 1.6; vertical-align: top;
}
.report-content tbody tr:last-child td { border-bottom: none; }
.report-content tbody tr { transition: background-color 0.15s ease; }
.report-content tbody tr:hover { background: #f8fafc; }
.report-content tbody tr:nth-child(even) { background: #fafbfc; }
.report-content tbody tr:nth-child(even):hover { background: #f3f4f6; }
.report-content table a { color: #0891b2; text-decoration: none; font-size: 0.8125rem; font-weight: 400; }
.report-content table a:hover { text-decoration: underline; }
.report-content sup { color: #0891b2; font-weight: 600; font-size: 0.75em; }

/* ── Citation Badges ── */
.citation-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af; padding: 6px 12px; border-radius: 8px;
    font-size: 0.75rem; font-weight: 600; text-decoration: none;
    transition: all 0.2s ease; border: 1px solid #bfdbfe;
    max-width: 100%; word-break: break-word;
}
.citation-badge span { overflow-wrap: break-word; word-break: break-all; line-height: 1.4; }
.citation-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

/* ── Action Buttons (copy, download, regenerate) ── */
.action-btn {
    padding: 0.5rem; color: #6b7280; background: transparent;
    border: none; border-radius: 0.5rem; cursor: pointer;
    transition: all 0.2s ease; display: flex;
    align-items: center; justify-content: center;
}
.action-btn:hover { background-color: #f3f4f6; color: #374151; }
.action-btn:active { transform: scale(0.95); background-color: #e5e7eb; }

/* ── Deep Search Progress ── */
.deep-search-progress {
    background: #ffffff; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 1.5rem; margin: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.deep-search-title {
    color: #1f2937; font-size: 0.875rem; font-weight: 500;
    margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.deep-search-title .spinner {
    width: 1rem; height: 1rem; border: 2px solid #e5e7eb;
    border-top-color: #8b5cf6; border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar-container {
    width: 100%; height: 8px; background: #f3f4f6;
    border-radius: 4px; overflow: hidden; position: relative;
}
.progress-bar-fill {
    height: 100%; background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    border-radius: 4px; transition: width 0.3s ease;
}

/* ── Track Changes Toggle ── */
.tc-mode-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 20px;
    border: 1.5px solid #e5e7eb; background: #ffffff;
    color: #6b7280; font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    font-family: inherit; white-space: nowrap; user-select: none;
}
.tc-mode-toggle:hover { border-color: #c084fc; color: #7c3aed; background: #faf5ff; }
.tc-mode-toggle.active {
    border-color: #a78bfa;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #6d28d9; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}
.tc-mode-toggle.active .tc-toggle-icon { color: #7c3aed; }
.tc-toggle-icon { width: 15px; height: 15px; flex-shrink: 0; transition: color 0.2s; }
.tc-toggle-label { line-height: 1; }
.tc-mode-toggle.active::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #7c3aed; animation: tcPulse 2s ease-in-out infinite; flex-shrink: 0;
}
@keyframes tcPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ── Attachment Button ── */
.attachment-btn {
    width: 40px; height: 40px; display: flex;
    align-items: center; justify-content: center;
    border: none; background: transparent; border-radius: 10px;
    color: #9ca3af; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); position: relative;
}
.attachment-btn:hover { background: #f3f4f6; color: #059669; transform: scale(1.05); }
.attachment-btn.has-files { color: #059669; background: #ecfdf5; }
.attachment-btn svg { width: 20px; height: 20px; }
.attachment-badge {
    position: absolute; top: 2px; right: 2px;
    width: 16px; height: 16px; background: #10b981;
    color: white; font-size: 0.625rem; font-weight: 600;
    border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
    animation: badgePop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes badgePop { 0% { transform: scale(0); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ── Tools Button ── */
.tools-btn {
    position: relative; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    background: transparent; border: none;
}
.tools-btn:hover { background: #f3f4f6; }
.tools-btn svg { width: 20px; height: 20px; color: #6b7280; transition: all 0.2s; }
.tools-btn:hover svg { color: #374151; }
.tools-btn.has-selection { background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%); }
.tools-btn.has-selection svg { color: #3b82f6; }

/* ── Plus Button (initial input) ── */
.plus-btn-v2 {
    width: 32px; height: 32px; border-radius: 8px;
    border: none; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280; transition: all 0.12s; flex-shrink: 0;
}
.plus-btn-v2:hover { background: #f3f4f6; color: #374151; }

/* ── Attach Button (initial input) ── */
.attach-btn-v2 {
    width: 32px; height: 32px; border-radius: 8px;
    border: none; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280; transition: all 0.12s; flex-shrink: 0; position: relative;
}
.attach-btn-v2:hover { background: #f3f4f6; color: #374151; }
.attach-badge {
    position: absolute; top: 2px; right: 2px;
    width: 14px; height: 14px; background: #3b82f6;
    color: white; border-radius: 50%; font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* ── Plus Menu Wrapper ── */
.plus-menu-wrapper {
    position: absolute; left: 0; bottom: calc(100% + 8px);
    z-index: 9999; display: flex; gap: 4px; align-items: flex-end;
}
.plus-menu-main {
    width: 220px; background: white; border-radius: 14px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: visible; animation: pmFadeIn 0.15s ease-out; padding: 6px 0;
}
.plus-menu-side {
    width: 250px; background: white; border-radius: 14px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
    animation: pmFadeIn 0.12s ease-out; padding: 6px 0; overflow: hidden;
}
@keyframes pmFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Plus menu items */
.pm-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 14px; font-size: 14px;
    color: #374151; background: none; border: none;
    cursor: pointer; transition: background 0.1s;
    text-align: left; font-family: inherit; position: relative;
}
.pm-item:hover, .pm-item.active { background: #f5f5f5; }
.pm-item svg.pm-icon { width: 16px; height: 16px; flex-shrink: 0; color: #6b7280; }
.pm-item .pm-arrow { margin-left: auto; color: #c0c0c0; width: 14px; height: 14px; flex-shrink: 0; }
.pm-item .pm-check { margin-left: auto; color: #3b82f6; width: 16px; height: 16px; flex-shrink: 0; }
.pm-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }

/* Side panel items */
.sp-header {
    padding: 8px 14px 4px; font-size: 11px; font-weight: 600;
    color: #a0a0a0; text-transform: uppercase; letter-spacing: 0.04em;
}
.sp-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 8px 14px; font-size: 14px;
    color: #374151; background: none; border: none;
    cursor: pointer; transition: background 0.1s;
    text-align: left; font-family: inherit;
}
.sp-item:hover { background: #f5f5f5; }
.sp-item-icon {
    width: 26px; height: 26px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sp-item-icon svg { width: 14px; height: 14px; }
.sp-item-icon.ct { background: #dbeafe; } .sp-item-icon.ct svg { stroke: #2563eb; }
.sp-item-icon.of { background: #fce7f3; } .sp-item-icon.of svg { stroke: #db2777; }
.sp-item-icon.pm { background: #d1fae5; } .sp-item-icon.pm svg { stroke: #059669; }
.sp-item-icon.ob { background: #ffedd5; } .sp-item-icon.ob svg { stroke: #ea580c; }
.sp-item-icon.fda { background: #dbeafe; } .sp-item-icon.fda svg { stroke: #2563eb; }
.sp-item-icon.cms { background: #e0e7ff; } .sp-item-icon.cms svg { stroke: #4338ca; }
.sp-item-icon.nmpa { background: #fee2e2; } .sp-item-icon.nmpa svg { stroke: #dc2626; }
.sp-item-icon.global { background: #d1fae5; } .sp-item-icon.global svg { stroke: #059669; }
.sp-item .sp-label { font-size: 14px; color: #374151; font-weight: 400; }
.sp-item .sp-desc { font-size: 11px; color: #a0a0a0; margin-top: 1px; }
.sp-item .sp-check { margin-left: auto; width: 16px; height: 16px; color: #3b82f6; flex-shrink: 0; }

/* ── Mode Indicator Badge ── */
.mode-indicator {
    display: inline-flex; align-items: center;
    padding: 1px 7px; border-radius: 5px;
    font-size: 11px; font-weight: 600;
    margin-left: auto; margin-right: 4px;
}
.mode-indicator.fda    { background: #dbeafe; color: #1d4ed8; }
.mode-indicator.cms    { background: #e0e7ff; color: #4338ca; }
.mode-indicator.nmpa   { background: #fee2e2; color: #dc2626; }
.mode-indicator.global { background: #d1fae5; color: #059669; }

/* ── Input Status Bar ── */
.input-status-bar { display: flex; align-items: center; gap: 6px; padding: 2px 12px 8px; flex-wrap: wrap; }
.status-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 500; background: #f3f4f6; color: #6b7280;
}
.status-chip .chip-x { width: 12px; height: 12px; cursor: pointer; color: #b0b0b0; }
.status-chip .chip-x:hover { color: #ef4444; }

/* ── Reasoning Trigger Button ── */
.reasoning-trigger-v3 {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    border: 1.5px solid #e5e7eb; background: white;
    cursor: pointer; transition: all 0.15s;
    font-family: inherit; font-size: 13px; color: #374151;
    white-space: nowrap; flex-shrink: 0;
}
.reasoning-trigger-v3:hover { background: #f9fafb; border-color: #d1d5db; }
.reasoning-trigger-v3 .rt-icon { width: 16px; height: 16px; flex-shrink: 0; }
.reasoning-trigger-v3 .rt-label { font-weight: 600; font-size: 13px; }
.reasoning-trigger-v3 .rt-chevron { width: 14px; height: 14px; color: #9ca3af; transition: transform 0.15s; }
.reasoning-trigger-v3.open .rt-chevron { transform: rotate(180deg); }

/* Compact reasoning for continuous input */
#continuousChatInput .reasoning-trigger-v3 { padding: 6px 12px; border: none; background: #f3f4f6; border-radius: 18px; }
#continuousChatInput .reasoning-trigger-v3:hover { background: #e5e7eb; }

/* Reasoning level color variants */
.reasoning-trigger-v3.level-quick { color: #059669; }
.reasoning-trigger-v3.level-quick .rt-icon { color: #059669; }
.reasoning-trigger-v3.level-deep { color: #7c3aed; }
.reasoning-trigger-v3.level-deep .rt-icon { color: #7c3aed; }
.reasoning-trigger-v3.level-write { color: #2563eb; }
.reasoning-trigger-v3.level-write .rt-icon { color: #2563eb; }
.reasoning-trigger-v3.level-cmsquick { color: #d97706; }
.reasoning-trigger-v3.level-cmsquick .rt-icon { color: #d97706; }
.reasoning-trigger-v3.level-cmsdeep { color: #4338ca; }
.reasoning-trigger-v3.level-cmsdeep .rt-icon { color: #4338ca; }
.reasoning-trigger-v3.level-nmpa { color: #dc2626; }
.reasoning-trigger-v3.level-nmpa .rt-icon { color: #dc2626; }

/* ── Reasoning Dropdown Menu ── */
.reasoning-menu-v3 {
    position: absolute; bottom: calc(100% + 10px); right: 0;
    width: 300px; background: white; border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 9999; overflow: hidden; animation: rmFadeIn 0.15s ease-out;
}
@keyframes rmFadeIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.reasoning-menu-v3 .rm-header {
    padding: 14px 16px 10px; border-bottom: 1px solid #f3f4f6;
    display: flex; align-items: center; justify-content: space-between;
}
.reasoning-menu-v3 .rm-title { font-size: 14px; font-weight: 700; color: #111827; }
.reasoning-menu-v3 .rm-mode-badge {
    font-size: 10px; font-weight: 700; padding: 3px 10px;
    border-radius: 12px; text-transform: uppercase; letter-spacing: 0.04em;
}
.reasoning-menu-v3 .rm-mode-badge.fda { background: #dbeafe; color: #1d4ed8; }
.reasoning-menu-v3 .rm-mode-badge.cms { background: #e0e7ff; color: #4338ca; }
.reasoning-menu-v3 .rm-mode-badge.nmpa { background: #fee2e2; color: #dc2626; }
.reasoning-menu-v3 .rm-mode-badge.global { background: #d1fae5; color: #059669; }
.reasoning-menu-v3 .rm-options { padding: 8px 0; }
.reasoning-menu-v3 .rm-opt {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 12px 16px; background: none;
    border: none; cursor: pointer; transition: background 0.1s;
    text-align: left; font-family: inherit;
}
.reasoning-menu-v3 .rm-opt:hover { background: #f9fafb; }
.reasoning-menu-v3 .rm-opt.selected { background: #f0fdf4; }
.reasoning-menu-v3 .rm-opt-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.reasoning-menu-v3 .rm-opt-icon svg { width: 18px; height: 18px; }
.reasoning-menu-v3 .rm-opt-icon.quick { background: #d1fae5; }
.reasoning-menu-v3 .rm-opt-icon.quick svg { stroke: #059669; }
.reasoning-menu-v3 .rm-opt-icon.deep { background: #ede9fe; }
.reasoning-menu-v3 .rm-opt-icon.deep svg { stroke: #7c3aed; }
.reasoning-menu-v3 .rm-opt-icon.write { background: #dbeafe; }
.reasoning-menu-v3 .rm-opt-icon.write svg { stroke: #2563eb; }
.reasoning-menu-v3 .rm-opt-icon.cmsquick { background: #fef3c7; }
.reasoning-menu-v3 .rm-opt-icon.cmsquick svg { stroke: #d97706; }
.reasoning-menu-v3 .rm-opt-icon.cmsdeep { background: #e0e7ff; }
.reasoning-menu-v3 .rm-opt-icon.cmsdeep svg { stroke: #4338ca; }
.reasoning-menu-v3 .rm-opt-icon.nmpa { background: #fee2e2; }
.reasoning-menu-v3 .rm-opt-icon.nmpa svg { stroke: #dc2626; }
.reasoning-menu-v3 .rm-opt-text { flex: 1; min-width: 0; }
.reasoning-menu-v3 .rm-opt-title {
    font-size: 14px; font-weight: 600; color: #111827;
    display: flex; align-items: center; gap: 8px;
}
.reasoning-menu-v3 .rm-opt-time {
    font-size: 10px; font-weight: 600; padding: 2px 7px;
    border-radius: 6px; background: #f3f4f6; color: #6b7280;
}
.reasoning-menu-v3 .rm-opt-desc { font-size: 12px; color: #6b7280; margin-top: 2px; line-height: 1.4; }
.reasoning-menu-v3 .rm-opt-check { width: 20px; height: 20px; color: #10b981; flex-shrink: 0; display: none; }
.reasoning-menu-v3 .rm-opt.selected .rm-opt-check { display: block; }

/* ── Continuous Chat Input Overrides ── */
#continuousChatInput .tools-btn,
#continuousChatInput .attachment-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: #f9fafb; border: none; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
#continuousChatInput .tools-btn:hover,
#continuousChatInput .attachment-btn:hover { background: #f3f4f6; color: #374151; }
#continuousChatInput .tools-btn svg,
#continuousChatInput .attachment-btn svg { width: 18px; height: 18px; }
#continuousChatInput .send-btn-v3 {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none; color: white; display: flex;
    align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
#continuousChatInput .send-btn-v3:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: scale(1.05); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
#continuousChatInput .send-btn-v3 svg { width: 16px; height: 16px; }
#continuousChatInput textarea:focus { box-shadow: none !important; outline: none !important; }

/* ── Consolidated continuous input override ── */
#continuousChatInput {
    padding: 16px 24px !important;
    align-items: stretch !important;
}
#continuousChatInput textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* ── File Upload Preview ── */
.file-upload-preview { padding: 0; }
.file-upload-item {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; background: #f8fafc;
    border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: 12px; color: #475569; position: relative;
}
.file-upload-item .file-name { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-upload-item .file-size { color: #94a3b8; font-size: 11px; }
.file-upload-item .file-remove {
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #94a3b8; transition: all 0.15s;
}
.file-upload-item .file-remove:hover { color: #ef4444; background: #fef2f2; }
.file-upload-item.uploading { border-color: #93c5fd; background: #eff6ff; }
.file-upload-item.completed { border-color: #86efac; background: #f0fdf4; }

/* ── Selected Tools Badges ── */
.selected-tools-badges {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px;
}
.selected-tools-badges .tool-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600; background: #f3f4f6; color: #6b7280;
}

/* ── Mode Chip Continuous ── */
.mode-chip-continuous {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 14px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.mode-chip-continuous.fda { background: #dbeafe; color: #1d4ed8; }
.mode-chip-continuous.cms { background: #e0e7ff; color: #4338ca; }
.mode-chip-continuous.nmpa { background: #fee2e2; color: #dc2626; }
.mode-chip-continuous.global { background: #d1fae5; color: #059669; }

/* ============================================
   Split-View: Leaf AI Chat + Detail Panel
   ============================================ */

/* Hidden by default */
#detailChatPanel {
    display: none;
}

/* When split-view is active, contentArea becomes a flex row */
#contentArea.split-view {
    display: flex !important;
    overflow: hidden;
}

/* Left half: chat panel */
#contentArea.split-view #detailChatPanel {
    display: flex;
    flex-direction: column;
    width: 50%;
    height: 100%;
    flex-shrink: 0;
    border-right: 1px solid #ebeef2;
    overflow: hidden;
}

/* The Leaf AI page inside the chat panel fills it completely (only in split-view) */
#contentArea.split-view #detailChatPanel #page-leafai {
    display: flex !important;
    flex-direction: column;
    height: 100% !important;
    width: 100%;
    overflow: hidden;
}

/* Right half: active page content takes the remaining 50% */
#contentArea.split-view .page-content.active {
    width: 50%;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Data Search page in split view needs same treatment */
#contentArea.split-view #page-datasearch.active {
    width: 50%;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Ensure ds-panels fill height in split view */
#contentArea.split-view .ds-panel {
    height: 100%;
    overflow-y: auto;
}

/* Tweak the Leaf AI chat content area in split view for better fit */
#detailChatPanel #chatContent {
    min-height: 0;
}

/* Compact the initial input in split view */
#detailChatPanel #emptyChatState .max-w-4xl {
    max-width: 100%;
    padding: 0 1rem;
}

#detailChatPanel #emptyChatState h2 {
    font-size: 1.5rem;
}

#detailChatPanel #emptyChatState p {
    font-size: 0.8rem;
}

#detailChatPanel #emptyChatState .w-32 {
    width: 5rem;
    height: 5rem;
}

#detailChatPanel #emptyChatState .h-32 {
    height: 5rem;
}

#detailChatPanel #emptyChatState img {
    width: 5rem;
    height: 5rem;
}

/* Compact the input bar in split view */
#detailChatPanel #initialInputBar .w-\[420px\],
#detailChatPanel .relative.bg-white.rounded-2xl {
    max-width: 100%;
}

/* Make sure continuous input is compact */
#detailChatPanel #continuousChatInput {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Subtle visual separator between panels */
#contentArea.split-view #detailChatPanel {
    position: relative;
}

#contentArea.split-view #detailChatPanel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, #dde1e7 10%, #dde1e7 90%, transparent);
}

/* Override fixed-height inner layouts in split view to use full parent height */
#contentArea.split-view .page-content.active .h-\[calc\(100vh-3\.5rem\)\],
#contentArea.split-view #page-datasearch.active .h-\[calc\(100vh-3\.5rem\)\] {
    height: 100% !important;
}

/* In split view, the data search sticky tabs should stay compact */
#contentArea.split-view #datasearch-tabs {
    overflow-x: auto;
    scrollbar-width: none;
}
#contentArea.split-view #datasearch-tabs::-webkit-scrollbar {
    display: none;
}

/* Compact grid layouts in split view to avoid horizontal overflow */
#contentArea.split-view .page-content.active .grid-cols-5,
#contentArea.split-view #page-datasearch.active .grid-cols-5 {
    grid-template-columns: repeat(3, 1fr);
}
#contentArea.split-view .page-content.active .grid-cols-4,
#contentArea.split-view #page-datasearch.active .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
}

/* Narrow the inspector list sidebar in split view */
#contentArea.split-view #page-inspectors .w-\[340px\] {
    width: 240px;
}

/* When document detail view is active, fill parent height and stop scrolling */
.doc-detail-active {
    height: 100% !important;
    overflow: hidden !important;
    padding: 0 !important;
}

/* Ensure parent containers don't scroll when detail viewer is active */
.ds-panel:has(.doc-detail-active) {
    overflow: hidden !important;
}
#page-datasearch:has(.doc-detail-active) {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column;
}
#page-datasearch:has(.doc-detail-active) .ds-panel {
    flex: 1;
    overflow: hidden !important;
}

/* Document viewer tab transitions */
.doc-viewer-tab {
    transition: all 0.15s ease;
}

/* Document Detail Overlay Modal */
body.doc-modal-open {
    overflow: hidden !important;
}
.doc-modal-slide-up {
    animation: docModalSlideUp 0.25s ease-out;
}
@keyframes docModalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
#docDetailOverlayBody iframe {
    min-height: 70vh;
}
#docDetailOverlay .intel-full-width {
    max-width: 100%;
}

/* Floating Leaf AI Mini Chat Widget */
.leaf-mini-slide-up {
    animation: leafMiniSlideUp 0.25s ease-out;
}
@keyframes leafMiniSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
#leafMiniSuggestions button {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    color: #15803d;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
}
#leafMiniSuggestions button:hover {
    background: linear-gradient(135deg, #dcfce7, #d1fae5);
    border-color: #86efac;
}

/* Leaf AI chart icon on trends cards */
.leaf-chart-ask {
    opacity: 0.4;
    transition: all 0.2s ease;
}
.leaf-chart-ask:hover {
    opacity: 1;
}

/* Leaf AI mini-chat loader dots */
@keyframes leafMiniBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}
.leaf-dot { animation: leafMiniBounce 1.4s ease-in-out infinite; }
.leaf-dot:nth-child(2) { animation-delay: 0.16s; }
.leaf-dot:nth-child(3) { animation-delay: 0.32s; }

/* Persistent FAB pulse when conversation active */
#leafMiniFab.has-convo::after {
    content: '';
    position: absolute;
    top: -1px; right: -1px;
    width: 10px; height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
}

/* ============================================
   DOCUMENT GENERATION UI
   ============================================ */

.doc-gen-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    margin-top: 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.doc-gen-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.doc-gen-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.doc-gen-card-ico {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, #ccfbf1, rgba(16, 185, 129, 0.15));
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-gen-card-ico svg { width: 18px; height: 18px; color: #0d9488; }
.doc-gen-card-txt { font-size: 13.5px; color: #334155; }
.doc-gen-card-txt strong { color: #1e293b; }
.doc-gen-card-btn {
    padding: 9px 18px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.2s; font-family: inherit;
    background: linear-gradient(135deg, #0d9488, #059669); color: #fff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2); white-space: nowrap;
}
.doc-gen-card-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Input zone (expandable) */
.doc-gen-input-zone {
    max-height: 0; opacity: 0; overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.doc-gen-input-zone.open { max-height: 300px; opacity: 1; margin-top: 14px; }

.doc-gen-type-pills {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
    animation: docGenFadeSlide 0.3s ease;
}
@keyframes docGenFadeSlide {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.doc-gen-tp {
    padding: 6px 12px; border-radius: 8px; border: 1.5px solid #e2e8f0;
    background: #fff; font-size: 12px; font-weight: 500; color: #475569;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center;
    gap: 5px; font-family: inherit;
}
.doc-gen-tp:hover { border-color: #2dd4bf; color: #0f766e; background: #f0fdfa; }
.doc-gen-tp.selected {
    border-color: #14b8a6; background: #f0fdfa; color: #0f766e;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.08);
}
.doc-gen-tp-ico { font-size: 14px; }

.doc-gen-input-row { display: flex; gap: 8px; align-items: flex-end; }
.doc-gen-textarea {
    flex: 1; resize: none; border: 1.5px solid #e2e8f0; border-radius: 10px;
    padding: 10px 14px; font-size: 13px; font-family: inherit; color: #334155;
    background: #f8fafc; outline: none; transition: all 0.2s;
    min-height: 44px; max-height: 120px; line-height: 1.5;
}
.doc-gen-textarea:focus {
    border-color: #2dd4bf; background: #fff;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.08);
}
.doc-gen-textarea::placeholder { color: #94a3b8; }

.doc-gen-send {
    width: 40px; height: 40px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #0d9488, #059669); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}
.doc-gen-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.doc-gen-send svg { width: 18px; height: 18px; }

.doc-gen-hint {
    font-size: 11px; color: #94a3b8; margin-top: 6px;
    display: flex; align-items: center; gap: 4px;
}
.doc-gen-hint kbd {
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 3px;
    padding: 1px 5px; font-size: 10px; font-family: 'JetBrains Mono', monospace;
}

/* Banner */
.doc-gen-banner {
    background: #fff; border-top: 2px solid #14b8a6;
    padding: 12px 20px; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; margin-top: 0;
    border-radius: 0 0 12px 12px;
    animation: docGenSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes docGenSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.doc-gen-banner-text {
    font-size: 13px; color: #475569; display: flex; align-items: center; gap: 8px;
}
.doc-gen-banner-text svg { width: 16px; height: 16px; color: #0d9488; flex-shrink: 0; }
.doc-gen-banner-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.doc-gen-banner-btn {
    padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.doc-gen-banner-btn.primary { background: #0d9488; color: #fff; }
.doc-gen-banner-btn.primary:hover { background: #0f766e; }
.doc-gen-banner-btn.secondary { background: #f1f5f9; color: #475569; }
.doc-gen-banner-btn.secondary:hover { background: #e2e8f0; }

/* Header button */
.header-create-doc-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: linear-gradient(135deg, #0d9488, #059669);
    color: #fff; font-size: 13px; font-weight: 600; border-radius: 8px;
    border: none; cursor: pointer; transition: all 0.2s; font-family: inherit;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2); white-space: nowrap;
}
.header-create-doc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); opacity: 0.95;
}
.header-create-doc-btn svg { width: 15px; height: 15px; }

@media (max-width: 640px) {
    .doc-gen-card-row { flex-direction: column; align-items: flex-start; }
    .doc-gen-card-btn { width: 100%; text-align: center; }
    .doc-gen-banner { flex-direction: column; gap: 8px; }
    .doc-gen-banner-actions { width: 100%; }
    .doc-gen-banner-btn { flex: 1; text-align: center; }
}

/* ============================================
   TRACK CHANGES UI
   ============================================ */

/* Status chip */
.tc-status-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px; background: #ede9fe;
    color: #6d28d9; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    animation: tcChipIn 0.25s ease-out;
}
@keyframes tcChipIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

/* Tabbed container */
.tc-tabbed-container {
    border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden;
    background: #ffffff; margin-top: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.tc-tab-bar {
    display: flex; align-items: center; gap: 0;
    border-bottom: 1px solid #e5e7eb; background: #fafafa; padding: 0 4px;
}
.tc-tab {
    position: relative; display: flex; align-items: center; gap: 7px;
    padding: 11px 18px; font-size: 13px; font-weight: 500; color: #6b7280;
    background: transparent; border: none; cursor: pointer;
    transition: color 0.15s; font-family: inherit; white-space: nowrap;
}
.tc-tab:hover { color: #374151; }
.tc-tab.active { color: #111827; font-weight: 600; }
.tc-tab.active::after {
    content: ''; position: absolute; bottom: -1px; left: 12px; right: 12px;
    height: 2.5px; border-radius: 2px 2px 0 0; background: #7c3aed;
}
.tc-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.tc-tab-badge {
    font-size: 10px; font-weight: 700; padding: 1px 7px;
    border-radius: 999px; background: #f3f4f6; color: #6b7280; line-height: 1.4;
}
.tc-tab.active .tc-tab-badge { background: #ede9fe; color: #6d28d9; }

/* Tab actions */
.tc-tab-actions {
    margin-left: auto; display: flex; align-items: center; gap: 6px; padding-right: 10px;
}
.tc-action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 7px; font-size: 11.5px; font-weight: 500;
    border: 1px solid #e5e7eb; background: #ffffff; color: #374151;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.tc-action-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.tc-action-btn svg { width: 13px; height: 13px; }
.tc-action-btn.primary {
    background: linear-gradient(135deg, #059669, #0d9488);
    color: #ffffff; border-color: transparent;
}
.tc-action-btn.primary:hover { opacity: 0.92; }
.tc-action-btn.accept-all { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tc-action-btn.accept-all:hover { background: #dcfce7; }
.tc-action-btn.reject-all { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tc-action-btn.reject-all:hover { background: #fee2e2; }

/* Tab panels */
.tc-tab-panel { display: none; min-height: 200px; }
.tc-tab-panel.active { display: block; }
.tc-panel-report { padding: 0; }
.tc-panel-document { padding: 0; display: flex; flex-direction: column; }

/* Stats bar */
.tc-stats-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 20px; background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
    font-size: 12px; color: #6b7280; flex-wrap: wrap;
}
.tc-stat { display: flex; align-items: center; gap: 5px; }
.tc-stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tc-stat-dot.insertions { background: #22c55e; }
.tc-stat-dot.deletions { background: #ef4444; }
.tc-stat-dot.replacements { background: #3b82f6; }
.tc-stat-dot.comments { background: #f59e0b; }
.tc-stat-count { font-weight: 700; color: #374151; }

/* Filter pills */
.tc-filter-pills { margin-left: auto; display: flex; gap: 4px; }
.tc-filter-pill {
    padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
    border: 1px solid #e5e7eb; background: #fff; color: #6b7280;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.tc-filter-pill.active { background: #111827; color: #ffffff; border-color: #111827; }
.tc-filter-pill:hover:not(.active) { background: #f3f4f6; }

/* Document wrapper */
.tc-document-wrapper {
    background: #e8e8e8; padding: 32px 24px;
    min-height: 500px; overflow-y: auto; max-height: 75vh;
}
.tc-document-render { max-width: 860px; margin: 0 auto; position: relative; }
.tc-document-render .docx-wrapper { background: transparent !important; padding: 0 !important; }
.tc-document-render .docx-wrapper > section.docx {
    background: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06) !important;
    border-radius: 2px; margin-bottom: 24px;
    min-width: unset !important; width: 100% !important; max-width: 816px;
    padding: 72px 72px 80px !important; box-sizing: border-box;
}

/* Fallback render */
.tc-document-render.tc-fallback-render {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
    border-radius: 2px; padding: 72px 72px 80px;
    font-family: 'Calibri', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14.5px; line-height: 1.65; color: #1a1a1a; min-height: 600px; max-width: 816px;
}
.tc-fallback-render .doc-heading-1 { font-size: 22px; font-weight: 700; color: #1e3a5f; margin: 28px 0 8px; border-bottom: 1.5px solid #d1d9e6; padding-bottom: 6px; }
.tc-fallback-render .doc-heading-2 { font-size: 17.5px; font-weight: 600; color: #2d4a6f; margin: 22px 0 6px; }
.tc-fallback-render .doc-heading-3 { font-size: 15px; font-weight: 600; color: #374151; margin: 16px 0 4px; }
.tc-fallback-render .doc-para { margin: 0 0 10px; position: relative; }
.tc-fallback-render .doc-list-item { margin: 0 0 4px; padding-left: 24px; position: relative; }
.tc-fallback-render .doc-list-item::before { content: '\2022'; position: absolute; left: 8px; color: #9ca3af; }

@media (max-width: 768px) {
    .tc-document-render .docx-wrapper > section.docx { padding: 40px 28px 48px !important; }
    .tc-document-wrapper { padding: 16px 8px; }
}

/* Inline change marks */
.tc-mark-delete {
    text-decoration: line-through; color: #dc2626; background: #fef2f2;
    padding: 0 2px; border-radius: 2px; cursor: pointer;
    position: relative; transition: background 0.15s;
}
.tc-mark-delete:hover { background: #fee2e2; }
.tc-mark-insert {
    color: #16a34a; background: #f0fdf4; border-bottom: 2px solid #86efac;
    padding: 0 2px; border-radius: 2px; cursor: pointer;
    position: relative; transition: background 0.15s;
}
.tc-mark-insert:hover { background: #dcfce7; }
.tc-mark-comment {
    background: #fef9c3; border-bottom: 2px dashed #f59e0b;
    padding: 0 2px; border-radius: 2px; cursor: pointer; transition: background 0.15s;
}
.tc-mark-comment:hover { background: #fef08a; }

/* Accepted/rejected states */
.tc-mark-delete.accepted { display: none; }
.tc-mark-insert.accepted { color: inherit; background: transparent; border-bottom: none; text-decoration: none; }
.tc-mark-delete.rejected { text-decoration: none; color: inherit; background: transparent; }
.tc-mark-insert.rejected { display: none; }
.tc-mark-comment.rejected { background: transparent; border-bottom: none; }

/* Block insert */
.tc-block-insert {
    border-left: 3px solid #22c55e; background: #f0fdf4;
    padding: 8px 16px; margin: 8px 0; border-radius: 0 6px 6px 0;
    position: relative; cursor: pointer; transition: background 0.15s;
}
.tc-block-insert:hover { background: #dcfce7; }
.tc-block-insert.accepted { border-left-color: transparent; background: transparent; padding: 0; }
.tc-block-insert.rejected { display: none; }

/* Popover */
.tc-popover {
    position: absolute; z-index: 100; width: 320px;
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.03);
    padding: 0; animation: tcPopIn 0.18s ease-out; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
@keyframes tcPopIn {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.tc-popover-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid #f3f4f6; background: #fafafa;
}
.tc-popover-type {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; display: flex; align-items: center; gap: 5px;
}
.tc-popover-type.replace { color: #2563eb; }
.tc-popover-type.insert { color: #16a34a; }
.tc-popover-type.delete { color: #dc2626; }
.tc-popover-type.comment { color: #d97706; }
.tc-popover-type-dot { width: 7px; height: 7px; border-radius: 50%; }
.tc-popover-type.replace .tc-popover-type-dot { background: #3b82f6; }
.tc-popover-type.insert .tc-popover-type-dot { background: #22c55e; }
.tc-popover-type.delete .tc-popover-type-dot { background: #ef4444; }
.tc-popover-type.comment .tc-popover-type-dot { background: #f59e0b; }
.tc-popover-close {
    width: 24px; height: 24px; border-radius: 6px; border: none;
    background: transparent; color: #9ca3af; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.1s;
}
.tc-popover-close:hover { background: #f3f4f6; color: #374151; }
.tc-popover-close svg { width: 14px; height: 14px; }
.tc-popover-body { padding: 12px 14px; }
.tc-popover-diff { font-size: 13px; line-height: 1.55; margin-bottom: 10px; }
.tc-popover-diff .del {
    text-decoration: line-through; color: #dc2626; background: #fef2f2;
    padding: 1px 3px; border-radius: 2px;
}
.tc-popover-diff .ins {
    color: #16a34a; background: #f0fdf4; padding: 1px 3px; border-radius: 2px;
}
.tc-popover-reason {
    font-size: 12px; color: #6b7280; line-height: 1.5; margin-bottom: 8px;
    padding: 8px 10px; background: #f9fafb; border-radius: 8px;
    border-left: 3px solid #e5e7eb;
}
.tc-popover-ref {
    display: flex; align-items: center; gap: 5px; font-size: 11.5px;
    color: #7c3aed; cursor: pointer; padding: 6px 0; transition: color 0.15s;
    font-weight: 500; border: none; background: none; font-family: inherit;
}
.tc-popover-ref:hover { color: #6d28d9; text-decoration: underline; }
.tc-popover-ref svg { width: 13px; height: 13px; flex-shrink: 0; }
.tc-popover-actions {
    display: flex; gap: 6px; padding: 10px 14px;
    border-top: 1px solid #f3f4f6; background: #fafafa;
}
.tc-popover-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 0; border-radius: 8px; font-size: 12px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.tc-popover-btn svg { width: 14px; height: 14px; }
.tc-popover-btn.accept { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tc-popover-btn.accept:hover { background: #dcfce7; }
.tc-popover-btn.reject { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tc-popover-btn.reject:hover { background: #fee2e2; }

/* Sidebar */
.tc-doc-layout { display: flex; gap: 0; min-height: 400px; }
.tc-doc-main { flex: 1; min-width: 0; overflow-y: auto; }
.tc-sidebar {
    width: 380px; flex-shrink: 0; border-left: 1px solid #e5e7eb;
    background: #fafafa; overflow-y: auto; max-height: 70vh;
}
.tc-sidebar-header {
    position: sticky; top: 0; z-index: 5; padding: 12px 14px;
    background: #fafafa; border-bottom: 1px solid #f3f4f6;
    font-size: 12px; font-weight: 700; color: #374151;
    display: flex; align-items: center; justify-content: space-between;
}
.tc-sidebar-item {
    padding: 10px 14px; border-bottom: 1px solid #f5f5f5;
    cursor: pointer; transition: background 0.12s; position: relative;
}
.tc-sidebar-item:hover { background: #f3f4f6; }
.tc-sidebar-item.active { background: #f5f3ff; border-left: 3px solid #7c3aed; }
.tc-sidebar-item.resolved { opacity: 0.5; }
.tc-sidebar-item-type {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; margin-bottom: 4px;
    display: flex; align-items: center; gap: 5px;
}
.tc-sidebar-item-type.replace { color: #2563eb; }
.tc-sidebar-item-type.insert { color: #16a34a; }
.tc-sidebar-item-type.delete { color: #dc2626; }
.tc-sidebar-item-type.comment { color: #d97706; }
.tc-sidebar-item-preview {
    font-size: 12px; color: #4b5563; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tc-sidebar-item-status {
    position: absolute; top: 10px; right: 12px;
    font-size: 10px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
}
.tc-sidebar-item-status.accepted { background: #dcfce7; color: #15803d; }
.tc-sidebar-item-status.rejected { background: #fee2e2; color: #b91c1c; }
.tc-sidebar-item-reason {
    font-size: 11px; color: #6b7280; line-height: 1.4; margin-top: 3px; font-style: italic;
}

.tc-summary-bar {
    padding: 10px 16px; background: #f0f9ff; border-bottom: 1px solid #bae6fd;
    font-size: 13px; color: #0c4a6e; line-height: 1.5;
}

/* Loading */
.tc-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 48px 24px; gap: 16px;
}
.tc-loading-spinner {
    width: 36px; height: 36px; border: 3px solid #e5e7eb;
    border-top-color: #7c3aed; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tc-loading-text { font-size: 13px; color: #6b7280; font-weight: 500; }
.tc-loading-subtext { font-size: 11.5px; color: #9ca3af; margin-top: -8px; }

/* Research ref highlight */
.tc-ref-highlight {
    background: #fef3c7 !important; outline: 2px solid #f59e0b;
    outline-offset: 2px; border-radius: 4px;
    transition: background 0.4s, outline 0.4s;
}
.tc-ref-highlight-fade {
    transition: background 1s, outline 1s;
    outline-color: transparent; background: transparent !important;
}

/* Responsive */
@media (max-width: 900px) {
    .tc-doc-layout { flex-direction: column; }
    .tc-sidebar { width: 100%; border-left: none; border-top: 1px solid #e5e7eb; max-height: 300px; }
    .tc-document-render { padding: 24px 20px; }
}
@media (max-width: 640px) {
    .tc-tab-actions { display: none; }
    .tc-stats-bar { padding: 8px 12px; gap: 10px; }
    .tc-filter-pills { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Global Map — Leaflet overrides
   ═══════════════════════════════════════════════════════════════════════════ */

/* Popup wrapper */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    font-family: 'DM Sans', system-ui, sans-serif;
    border: 1px solid #ebeef2;
}
.leaflet-popup-content {
    margin: 0;
    min-width: 260px;
    max-width: 340px;
}
.leaflet-popup-tip {
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.map-popup-header {
    padding: 12px 16px;
    border-bottom: 1px solid #ebeef2;
}
.map-popup-body {
    padding: 12px 16px;
}
.map-popup-footer {
    padding: 10px 16px;
    background: #fafbfc;
    border-top: 1px solid #ebeef2;
}
.map-popup-footer button {
    cursor: pointer;
}

/* Cluster markers */
.marker-cluster-small {
    background-color: rgba(22, 163, 74, 0.15);
}
.marker-cluster-small div {
    background-color: rgba(22, 163, 74, 0.65);
}
.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.15);
}
.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.65);
}
.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.15);
}
.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.65);
}
.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px 'DM Sans', sans-serif;
    font-weight: 700;
    color: white;
    line-height: 30px;
}

/* Prevent map z-index fighting with modals/dropdowns */
#globalMap .leaflet-pane { z-index: 1; }
#globalMap .leaflet-top, #globalMap .leaflet-bottom { z-index: 2; }

.map-controls-wrap {
    padding: 4px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.map-control-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.map-control-select {
    border: 1px solid #cbd5e1;
    background: white;
    color: #0f172a;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
}
.map-control-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #334155;
    font-weight: 600;
    cursor: pointer;
}
.map-control-toggle input {
    width: 14px;
    height: 14px;
}
.map-density-hint {
    font-size: 11px;
    color: #475569;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 6px 12px;
}

/* ── AI Query (NLQ) Module ──────────────────────────────────────────── */
#nlqTable table { border-collapse: collapse; }
#nlqTable tbody tr { transition: background-color 0.15s ease; }
#nlqChartWrap canvas { max-height: 320px; }
#nlqCommentary { min-height: 60px; }
#nlqCommentary ul { list-style-type: disc; padding-left: 1.25rem; }
#nlqCommentary li { margin-bottom: 0.25rem; }
@keyframes nlqShimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}
.nlq-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 400px 100%;
    animation: nlqShimmer 1.5s ease-in-out infinite;
}
/* Step progress dots */
#nlqStepDots { display: flex; gap: 6px; align-items: center; }
/* Breadcrumbs */
#nlqBreadcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Drill-down modal cards */
#nlqDrillDocList > div:hover { background-color: #f8fafc; }
/* Observation intelligence cards */
#nlqObsCards .border-l-3 { border-left-width: 3px; }
/* Vendor profile grid */
#nlqVendorProfile .grid { gap: 1.5rem; }
/* Chart drill-down cursor */
#nlqChartWrap canvas { cursor: pointer; }
/* Quick chip hover animation */
.nlq-chip-btn { transition: all 0.15s ease; }
.nlq-chip-btn:hover { transform: translateY(-1px); }
/* Per-tab NLQ chart cursor */
[id$="NlqCanvas"] { cursor: pointer; }
[id$="NlqAiCanvas"] { cursor: pointer; }
/* Per-tab NLQ results transition */
[id$="NlqResultsZone"] { transition: opacity 0.2s ease; }

/* ── AI Report Prose Enhancements ──────────────────────────────────── */
[id$="NlqAiReportBody"] h2 { font-size: 0.95rem; font-weight: 700; color: #1e293b; margin: 1rem 0 0.4rem; }
[id$="NlqAiReportBody"] h3 { font-size: 0.875rem; font-weight: 700; color: #334155; margin: 0.75rem 0 0.35rem; }
[id$="NlqAiReportBody"] p { margin-bottom: 0.5rem; line-height: 1.65; }
[id$="NlqAiReportBody"] ul, [id$="NlqAiReportBody"] ol { list-style-position: outside; padding-left: 1.5rem; margin: 0.4rem 0; }
[id$="NlqAiReportBody"] ul { list-style-type: disc; }
[id$="NlqAiReportBody"] ol { list-style-type: decimal; }
[id$="NlqAiReportBody"] li { margin-bottom: 0.3rem; line-height: 1.55; }
[id$="NlqAiReportBody"] strong { color: #0f172a; font-weight: 600; }
[id$="NlqAiReportBody"] code { background: #f1f5f9; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.85em; color: #334155; }
[id$="NlqAiReportBody"] blockquote { border-left: 3px solid #10b981; padding-left: 0.75rem; color: #475569; font-style: italic; margin: 0.75rem 0; }
[id$="NlqAiReportBody"] table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.8rem; }
[id$="NlqAiReportBody"] th { background: #f8fafc; padding: 0.4rem 0.6rem; text-align: left; font-weight: 600; border-bottom: 2px solid #e2e8f0; font-size: 0.75rem; text-transform: uppercase; color: #64748b; }
[id$="NlqAiReportBody"] td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #f1f5f9; }
[id$="NlqAiReportBody"] a { color: #059669; text-decoration: underline; }
[id$="NlqAiReportBody"] hr { border: none; border-top: 1px solid #e2e8f0; margin: 0.75rem 0; }

/* ═══════════════════════════════════════════════════════════
   Unified Intelligence Panel — Full-Width Layout
   ═══════════════════════════════════════════════════════════ */

/* Full-width intelligence container (replaces old max-w-3xl) */
.intel-full-width {
    max-width: 100%;
    padding: 1.5rem;
}

/* Two-column grid for details sections */
.intel-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* Responsive observation grid — 2 columns at full width */
.intel-obs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
    align-items: start;
}

/* Observation card polish */
.obs-card { border-left: 3px solid #94a3b8; }
.obs-card summary { list-style: none; }
.obs-card summary::-webkit-details-marker { display: none; }
.obs-sev-critical { border-left-color: #ef4444; }
.obs-sev-major { border-left-color: #f59e0b; }
.obs-sev-minor { border-left-color: #3b82f6; }

/* "Ask Leaf AI" header button */
.ask-leaf-btn {
    transition: all 0.2s ease;
}
.ask-leaf-btn:hover {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.ask-leaf-btn img {
    filter: drop-shadow(0 0 2px rgba(16, 185, 129, 0.3));
}

/* ── Split-view responsive overrides ─────────────────────── */
/* Collapse 2-col to 1-col when AI chat is open */
#contentArea.split-view .intel-two-col {
    grid-template-columns: 1fr;
}
#contentArea.split-view .intel-obs-grid {
    grid-template-columns: 1fr;
}
/* Compress the 5-col stat row in the risk hero to 3 cols */
#contentArea.split-view .grid.grid-cols-5[style*="min-width"] {
    min-width: 0 !important;
    grid-template-columns: repeat(3, 1fr);
}
/* Hero banner wraps vertically in narrow split view */
#contentArea.split-view .rounded-2xl > .flex.items-start {
    flex-direction: column;
    gap: 1rem;
}

/* ── Vendor/Site profile staggered entry animations ─────── */
@keyframes vendorSectionIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.vendor-section {
    opacity: 0;
    animation: vendorSectionIn 0.4s ease forwards;
}
.vendor-section:nth-child(1)  { animation-delay: 0s; }
.vendor-section:nth-child(2)  { animation-delay: 0.05s; }
.vendor-section:nth-child(3)  { animation-delay: 0.1s; }
.vendor-section:nth-child(4)  { animation-delay: 0.15s; }
.vendor-section:nth-child(5)  { animation-delay: 0.2s; }
.vendor-section:nth-child(6)  { animation-delay: 0.25s; }
.vendor-section:nth-child(7)  { animation-delay: 0.3s; }
.vendor-section:nth-child(8)  { animation-delay: 0.35s; }
.vendor-section:nth-child(9)  { animation-delay: 0.4s; }
.vendor-section:nth-child(10) { animation-delay: 0.45s; }
.vendor-section:nth-child(11) { animation-delay: 0.5s; }
.vendor-section:nth-child(12) { animation-delay: 0.55s; }
.vendor-section:nth-child(13) { animation-delay: 0.6s; }
.vendor-section:nth-child(14) { animation-delay: 0.65s; }
.vendor-section:nth-child(15) { animation-delay: 0.7s; }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .vendor-section { animation: none; opacity: 1; }
}

/* ── Split-view panel transition ────────────────────────── */
#detailChatPanel {
    transition: width 0.3s ease, opacity 0.25s ease;
    opacity: 0;
}
#contentArea.split-view #detailChatPanel {
    opacity: 1;
}

/* Compact empty state in split view */
#detailChatPanel #emptyChatState {
    align-items: flex-start;
    padding-top: 2rem;
}

/* Context suggestion chips in split view */
.leaf-context-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
    justify-content: center;
}
.leaf-context-chips button {
    font-size: 0.6875rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.7);
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}
.leaf-context-chips button:hover {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

/* FDA Dashboard Compliance Profile badges */
.badge-nai { background-color: #dcfce7; color: #166534; }
.badge-vai { background-color: #fef3c7; color: #92400e; }
.badge-oai { background-color: #fee2e2; color: #991b1b; }
.badge-class-i { background-color: #fee2e2; color: #991b1b; }
.badge-class-ii { background-color: #fef3c7; color: #92400e; }
.badge-class-iii { background-color: #f3f4f6; color: #374151; }
.mfr-warning-card { border-left: 3px solid #ef4444; background-color: #fef2f2; }
.fda-dash-toggle { cursor: pointer; user-select: none; }
.fda-dash-toggle .fda-chev { transition: transform 0.2s ease; }
.fda-dash-toggle.collapsed .fda-chev { transform: rotate(-90deg); }

/* ── Non-Compliant Findings Section ────────────────────────────────────────── */
.border-l-3 { border-left-width: 3px; }
.nc-doc-card { transition: box-shadow 0.15s ease; }
.nc-doc-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.nc-jur-tab { cursor: pointer; white-space: nowrap; }
.nc-jur-tab:hover { background-color: rgba(0,0,0,0.02); }
