:root {
    --pearl: #F5F0EB;
    --surface: #FFFFFF;
    --charcoal: #2C2C2C;
    --charcoal-light: #4A4A4A;
    --nacre: #8B7355;
    --nacre-light: #A89070;
    --sand: #D4C5B2;
    --sand-light: #E8DFD3;
    --border: #E5DDD4;
    --border-light: #F0EAE2;
    --muted: #9A9189;
    --bg-hover: #FAF7F3;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--pearl);
    color: var(--charcoal);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Nav */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 1;
    min-width: 0;
}
.nav-email {
    font-size: 12px;
    color: var(--nacre);
    letter-spacing: 0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}
.nav-menu-btn {
    background: none;
    border: none;
    color: var(--charcoal);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
}
.nav-menu-btn:hover { color: var(--nacre); }

/* Slide-out menu */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 90;
}
.menu-panel {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 100;
    transition: right 0.25s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.menu-panel.open { right: 0; }
.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.menu-email {
    font-size: 12px;
    color: var(--nacre);
    letter-spacing: 0.02em;
}
.menu-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}
.menu-close:hover { color: var(--charcoal); }
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    font-size: 13px;
    font-family: inherit;
    color: var(--charcoal);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item svg { color: var(--muted); flex-shrink: 0; }
.menu-logout { color: #C45; }
.menu-logout svg { color: #C45; }
.menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}
.menu-section-title {
    font-size: 10px;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 20px 6px;
}
.menu-empty {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 20px;
}
.menu-history-item {
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.menu-history-item:hover { background: var(--bg-hover); }
.menu-history-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 2px;
}
.menu-history-meta {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}
.menu-history-time {
    font-family: 'SF Mono', monospace;
    font-size: 10px;
    color: var(--sand);
}

@media (max-width: 420px) {
    .menu-panel { width: 280px; right: -300px; }
}
.nav-logo {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--charcoal);
    text-transform: uppercase;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}
.nav-logo:hover { color: var(--nacre); }
.nav-link {
    font-size: 13px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover { color: var(--charcoal); }

/* Homepage */
.home {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 52px);
    justify-content: center;
    padding-bottom: 120px;
}
.home-logo {
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 0.25em;
    color: var(--charcoal);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.home-sub {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-bottom: 40px;
}

/* Search input */
.search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-family: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--charcoal);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: var(--nacre);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.08);
}
.search-input::placeholder { color: var(--sand); }

/* Options panel (appears on focus) */
.options-panel {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    padding: 16px 20px;
    display: none;
}
.options-panel.visible { display: block; }

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.option-row:last-child { margin-bottom: 0; }
.option-label {
    font-size: 12px;
    color: var(--muted);
    width: 70px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.option-input {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    background: var(--pearl);
    border: 1px solid var(--border-light);
    color: var(--charcoal);
    outline: none;
}
.option-input:focus {
    border-color: var(--nacre);
}
.option-select {
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    background: var(--pearl);
    border: 1px solid var(--border-light);
    color: var(--charcoal);
    outline: none;
    cursor: pointer;
}

/* Region chips */
.region-chip {
    padding: 4px 10px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
}
.region-chip:hover { border-color: var(--nacre); color: var(--charcoal); }
.region-chip.active {
    background: var(--nacre);
    border-color: var(--nacre);
    color: white;
}

/* Submit button */
.btn-investigate {
    width: 100%;
    padding: 12px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--charcoal);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-investigate:hover { background: var(--charcoal-light); }
.btn-investigate:disabled { opacity: 0.4; cursor: not-allowed; }

/* Toggle */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}
.toggle-label input { accent-color: var(--nacre); }

/* Recent items */
.recent-section {
    width: 100%;
    margin-top: 48px;
}
.recent-title {
    font-size: 11px;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.recent-hide {
    font-size: 10px;
    font-family: inherit;
    color: var(--sand);
    background: none;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.recent-hide:hover { color: var(--nacre); }
.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.recent-item:hover { color: var(--nacre); }
.recent-item:last-child { border-bottom: none; }
.recent-name { font-size: 14px; font-weight: 500; }
.recent-context { font-size: 12px; color: var(--muted); margin-left: 8px; }
.recent-time { font-size: 11px; color: var(--sand); font-family: 'SF Mono', monospace; }

/* ========================================
   RESEARCH VIEW
   ======================================== */
.research-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px;
}

/* Sidebar */
.sidebar { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
.sidebar-title {
    font-size: 10px;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 13px;
    color: var(--sand);
}
.pipeline-step.active { color: var(--nacre); font-weight: 500; }
.pipeline-step.done { color: var(--charcoal-light); }
.step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}
.step-dot.active { background: var(--nacre); animation: pulse 1.5s ease-in-out infinite; }
.step-dot.done { background: var(--nacre); }
.step-check { color: var(--nacre); margin-left: auto; font-size: 11px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Tracks */
.track-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--sand);
}
.track-item.active { color: var(--nacre); }
.track-item.done { color: var(--charcoal-light); }
.track-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
}
.track-dot.active { background: var(--nacre); animation: pulse 1.5s ease-in-out infinite; }
.track-dot.done { background: var(--nacre); }
.track-count { margin-left: auto; color: var(--sand); }

/* Leads sidebar */
.lead-item {
    font-size: 11px;
    font-family: 'SF Mono', monospace;
    color: var(--muted);
    padding: 3px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lead-type { color: var(--sand); }
.lead-icon { display: inline-flex; align-items: center; margin-right: 4px; flex-shrink: 0; }
.lead-link {
    color: var(--nacre);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lead-link:hover { text-decoration: underline; }

/* Source counter */
.source-counter {
    margin-top: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
}
.source-counter-label { font-size: 10px; color: var(--sand); text-transform: uppercase; letter-spacing: 0.1em; }
.source-counter-value { font-size: 28px; font-weight: 300; color: var(--charcoal); font-family: 'SF Mono', monospace; }

/* Main content */
.research-main { min-width: 0; max-width: 800px; }
.subject-name { font-size: 22px; font-weight: 600; color: var(--charcoal); margin-bottom: 4px; letter-spacing: -0.01em; }
.subject-context { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* Candidate cards (disambiguation) */
.disambiguation-notice {
    padding: 16px 20px;
    background: #FFF8F0;
    border: 1px solid #F0DCC8;
    margin-bottom: 20px;
}
.disambiguation-notice h3 { font-size: 14px; font-weight: 600; color: var(--charcoal); margin-bottom: 2px; }
.disambiguation-notice p { font-size: 13px; color: var(--muted); }

.candidate-card {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 8px;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.candidate-card:hover {
    border-color: var(--nacre);
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.08);
}
.candidate-avatar {
    width: 56px;
    height: 56px;
    background: var(--pearl);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--sand);
    overflow: hidden;
}
.candidate-avatar img { width: 100%; height: 100%; object-fit: cover; }
.candidate-name { font-size: 15px; font-weight: 600; color: var(--charcoal); }
.candidate-role { font-size: 13px; color: var(--muted); margin-top: 2px; }
.candidate-detail { font-size: 12px; color: var(--sand); margin-top: 2px; }
.candidate-snippet { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* Confirmed subject */
.confirmed-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.confirmed-badge {
    margin-left: auto;
    font-size: 11px;
    color: var(--nacre);
    font-family: 'SF Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.risk-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    font-family: 'SF Mono', monospace;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    flex-shrink: 0;
}
.risk-badge-low { background: #EDF5ED; color: #3A6B3A; }
.risk-badge-medium { background: #FFF6E8; color: #A67B1A; }
.risk-badge-high { background: #FDE8E8; color: #B93030; }

/* Activity feed */
.activity-feed {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin-bottom: 24px;
}
.activity-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--nacre); animation: pulse 1.5s ease-in-out infinite; }
.activity-label { font-size: 13px; font-weight: 500; color: var(--charcoal-light); flex: 1; }
.cancel-btn {
    font-size: 10px;
    font-family: inherit;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 12px;
    background: none;
    border: 1px solid #C45;
    color: #C45;
    cursor: pointer;
    flex-shrink: 0;
}
.cancel-btn:hover { background: #FFF0F0; }
.activity-queries { max-height: 100px; overflow-y: auto; }
.activity-query {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    padding: 2px 0;
    font-family: 'SF Mono', monospace;
}
.activity-query-icon { color: var(--sand); flex-shrink: 0; }
.activity-track-tag { color: var(--sand); font-size: 10px; flex-shrink: 0; }

/* Brief sections */
.brief-section {
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 1px;
}
.brief-section:first-of-type { border-top-left-radius: 2px; border-top-right-radius: 2px; }
.brief-section:last-of-type { border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; margin-bottom: 16px; }
.deep-dive-section { border-left: 3px solid var(--nacre); }

/* Deep dive action buttons */
.deep-dive-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.deep-dive-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}
.deep-dive-action:last-child { border-bottom: none; }
.deep-dive-topic {
    font-size: 12px;
    color: var(--charcoal);
    line-height: 1.4;
}
.deep-dive-btn {
    padding: 5px 14px;
    font-size: 10px;
    font-family: inherit;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
    background: var(--charcoal);
    color: white;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.deep-dive-btn:hover { background: var(--charcoal-light); }
.deep-dive-btn.disabled { opacity: 0.3; cursor: not-allowed; }
.section-header {
    width: 100%;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.section-header:hover { background: var(--bg-hover); }
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    letter-spacing: 0.01em;
}
.section-toggle { font-size: 10px; color: var(--sand); transition: transform 0.2s; }
.section-toggle.open { transform: rotate(180deg); }
.section-body {
    padding: 0 24px 24px;
    font-size: 13.5px;
    line-height: 1.75;
    color: #444;
}
.section-body strong { font-weight: 600; color: var(--charcoal); }
.section-body a { color: var(--nacre); text-decoration: underline; text-underline-offset: 2px; }
.section-body a:hover { color: var(--nacre-light); }
.section-body ul { list-style: none; padding-left: 0; margin: 6px 0; }
.section-body ol { list-style: decimal; padding-left: 20px; margin: 6px 0; }
.section-body li {
    margin-bottom: 2px;
    padding-left: 14px;
    position: relative;
    line-height: 1.6;
}
.section-body li p { margin-bottom: 0; display: inline; }
.section-body ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--nacre);
}
.section-body h3 {
    font-size: 13.5px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
    color: var(--charcoal);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}
.section-body h4 { font-size: 13px; font-weight: 600; margin-top: 14px; margin-bottom: 4px; color: var(--charcoal); }
.section-body p { margin-bottom: 6px; }
.section-body sup {
    line-height: 0;
    font-size: 10px;
}
.section-body sup a {
    color: var(--nacre) !important;
    text-decoration: none !important;
    cursor: pointer;
    margin: 0 1px;
}
.section-body sup a:hover { text-decoration: underline !important; }

/* Sources */
.sources-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    margin-top: 16px;
}
.sources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.sources-header:hover { background: var(--bg-hover); }
.sources-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.sources-list { padding: 0 24px 16px; }
.source-link {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    color: var(--nacre);
    padding: 6px 0;
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}
.source-link:last-child { border-bottom: none; }
.source-link:hover { background: var(--bg-hover); color: var(--nacre-light); }
.source-link.source-highlight {
    background: #FFF8E8;
    transition: background 0.3s;
}
@keyframes source-flash {
    0% { background: #FFEEB8; }
    100% { background: transparent; }
}
.source-highlight { animation: source-flash 2s ease-out; }
.source-num {
    color: var(--sand);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    flex-shrink: 0;
    min-width: 28px;
}
.source-favicon {
    flex-shrink: 0;
    border-radius: 2px;
}
.source-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Timeline */
.timeline-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    margin-top: 24px;
}
.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 16px;
}
.timeline-container {
    position: relative;
    padding-left: 24px;
}
.timeline-line {
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border);
}
.timeline-event {
    position: relative;
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}
.timeline-event:last-child { border-bottom: none; }
.timeline-dot {
    position: absolute;
    left: -21px;
    top: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sand);
}
.timeline-dot.cat-career { background: var(--nacre); }
.timeline-dot.cat-company { background: #5B7FA5; }
.timeline-dot.cat-investment { background: #6B8E6B; }
.timeline-dot.cat-education { background: #8B6B8E; }
.timeline-dot.cat-award { background: #C9A96E; }
.timeline-dot.cat-personal { background: #C97B6E; }
.timeline-dot.cat-news { background: #6B8EC9; }
.timeline-date {
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.timeline-desc {
    color: var(--charcoal-light);
    line-height: 1.4;
}
.timeline-cat {
    font-size: 10px;
    font-family: 'SF Mono', monospace;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Action buttons */
.actions { display: flex; gap: 8px; margin-top: 24px; }
.btn-secondary {
    padding: 8px 16px;
    font-size: 12px;
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--nacre); color: var(--charcoal); }

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .research-layout {
        grid-template-columns: 180px minmax(0, 1fr);
        gap: 24px;
        padding: 20px;
    }
    .nav-inner { max-width: 100%; }
}

/* Tablet portrait / large phone */
@media (max-width: 768px) {
    .nav-inner { padding: 0 16px; height: 48px; }
    .nav-logo { font-size: 13px; }

    .home {
        padding: 0 20px;
        padding-bottom: 60px;
    }
    .home-logo { font-size: 24px; }
    .home-sub { margin-bottom: 28px; }
    .mode-selector { flex-direction: column; }
    .mode-card { padding: 12px 16px; text-align: left; display: flex; align-items: center; gap: 12px; }
    .mode-card::after { right: 16px; }
    .mode-name { margin-bottom: 0; }
    .mode-desc, .mode-time { display: inline; }
    .search-input { font-size: 15px; padding: 12px 16px; }
    .options-panel { padding: 14px 16px; }
    .option-row { flex-direction: column; align-items: stretch; gap: 4px; }
    .option-label { width: auto; }
    .option-row:last-child { flex-direction: column; gap: 12px; }
    .option-row:last-child .btn-investigate { width: 100% !important; padding: 12px !important; }
    .recent-item { flex-direction: column; align-items: flex-start; gap: 2px; }

    /* Research: sidebar becomes top bar */
    .research-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 16px;
    }
    .sidebar {
        position: relative;
        top: auto;
        max-height: none;
        overflow: visible;
        display: flex;
        flex-wrap: wrap;
        gap: 6px 12px;
        align-items: center;
        padding: 12px 0;
        margin-bottom: 16px;
        border-bottom: 1px solid var(--border-light);
    }
    .sidebar-title { width: 100%; margin-bottom: 2px; }
    .pipeline-step { padding: 3px 0; font-size: 12px; }
    .sidebar .track-item,
    .sidebar .lead-item { display: none; }
    .source-counter { margin-top: 0; padding: 0; border: none; margin-left: auto; }
    .source-counter-value { font-size: 20px; }

    .subject-name { font-size: 18px; }
    .subject-context { font-size: 12px; margin-bottom: 16px; }
    .candidate-card { padding: 12px; gap: 10px; }
    .candidate-avatar { width: 40px; height: 40px; font-size: 16px; }
    .confirmed-card { padding: 10px 14px; gap: 10px; }
    .section-header { padding: 12px 16px; }
    .section-body { padding: 0 16px 16px; font-size: 13px; }
    .sources-panel { padding: 16px; }
    .source-link { font-size: 11px; }
    .actions { flex-wrap: wrap; }
    .actions .btn-secondary { flex: 1; min-width: 120px; text-align: center; }

    /* Graph */
    .graph-container { height: 250px; }
    .graph-container.expanded { height: 400px; }

    /* Timeline */
    .timeline-event { grid-template-columns: 110px 1fr auto; gap: 8px; font-size: 12px; }

    /* Monitoring */
    .watchlist-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Small phone */
@media (max-width: 420px) {
    .home { padding: 0 14px; }
    .home-logo { font-size: 20px; letter-spacing: 0.18em; }
    .home-sub { font-size: 11px; }
    .search-input { font-size: 14px; padding: 11px 14px; }
    .research-layout { padding: 12px; }
    .section-title { font-size: 12px; }
    .subject-name { font-size: 16px; }
    .section-header { padding: 10px 12px; }
    .section-body { padding: 0 12px 14px; font-size: 12.5px; }
    .timeline-event { grid-template-columns: 90px 1fr; }
    .timeline-cat { display: none; }
    .risk-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Print — Professional PDF export */
@media print {
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    body {
        background: white;
        color: #1a1a1a;
        font-size: 11pt;
        line-height: 1.5;
    }

    .nav, .sidebar, .activity-feed, .actions,
    .btn-secondary, .btn-investigate, .region-chip,
    .section-toggle, .deep-dive-section button,
    .disambiguation-notice, .candidate-card { display: none !important; }

    .research-layout {
        display: block;
        max-width: 100%;
        padding: 0;
    }

    /* Cover / Header */
    .subject-name {
        font-size: 22pt;
        margin-bottom: 2px;
        padding-top: 20px;
        border-bottom: 2px solid #8B7355;
        padding-bottom: 8px;
    }
    .subject-name::before {
        content: "NACRE Intelligence Report";
        display: block;
        font-size: 9pt;
        font-weight: 400;
        letter-spacing: 0.15em;
        text-transform: uppercase;
        color: #8B7355;
        margin-bottom: 8px;
    }
    .subject-context {
        font-size: 11pt;
        margin-bottom: 20px;
    }

    .confirmed-card {
        border: 1px solid #ddd;
        margin-bottom: 16px;
        padding: 12px 16px;
        page-break-after: avoid;
    }
    .confirmed-badge { display: none; }

    /* Sections */
    .brief-section {
        border: none;
        border-bottom: 1px solid #e5e5e5;
        margin-bottom: 0;
        page-break-inside: avoid;
    }
    .section-header {
        padding: 12px 0 4px;
        cursor: default;
    }
    .section-title {
        font-size: 13pt;
        color: #8B7355;
    }
    .section-body {
        padding: 0 0 12px;
        display: block !important;
        font-size: 10pt;
        color: #333;
    }

    /* Deep dive sections */
    .deep-dive-section {
        border-left: 3px solid #8B7355;
        padding-left: 12px;
    }

    /* Timeline */
    .timeline-panel {
        border: 1px solid #ddd;
        margin-top: 16px;
        page-break-inside: avoid;
    }
    .timeline-dot { print-color-adjust: exact; }

    /* Sources */
    .sources-panel {
        border: 1px solid #ddd;
        margin-top: 16px;
        font-size: 8pt;
    }
    .source-link { color: #555; }

    /* Footer */
    .sources-panel::after {
        content: "Generated by NACRE Intelligence Research — Confidential";
        display: block;
        margin-top: 16px;
        padding-top: 8px;
        border-top: 1px solid #ddd;
        font-size: 8pt;
        color: #999;
        text-align: center;
        letter-spacing: 0.05em;
    }

    /* Page setup */
    @page {
        margin: 2cm 1.8cm;
        size: A4;
    }
}

/* ========================================
   VISUAL NETWORK
   ======================================== */
.visual-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}
.visual-title { font-size: 14px; font-weight: 600; color: var(--charcoal); margin-bottom: 4px; }
.visual-stats { font-size: 11px; color: var(--muted); margin-bottom: 12px; font-family: 'SF Mono', monospace; }
.visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.visual-card {
    background: var(--pearl);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.visual-photo-link {
    display: block;
    height: 100px;
    overflow: hidden;
    background: var(--sand-light);
}
.visual-photo-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.visual-card-info {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.visual-faces { font-size: 11px; font-weight: 500; color: var(--charcoal); }
.visual-date { font-size: 10px; color: var(--muted); font-family: 'SF Mono', monospace; }
.visual-location { font-size: 10px; color: var(--sand); }
.visual-recurring {
    font-size: 12px;
    color: var(--charcoal-light);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
}

/* ========================================
   AUDIO/VIDEO INTELLIGENCE
   ======================================== */
.audio-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}
.audio-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
}
.audio-subtitle {
    font-size: 11px;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.audio-appearances { margin-bottom: 8px; }
.audio-appearance-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    color: var(--nacre);
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
}
.audio-appearance-item:last-child { border-bottom: none; }
.audio-appearance-item:hover { color: var(--nacre-light); }
.audio-platform {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    background: var(--pearl);
    color: var(--muted);
    font-family: 'SF Mono', monospace;
    flex-shrink: 0;
}
.audio-appearance-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audio-declaration, .audio-mention, .audio-redflag {
    font-size: 12px;
    color: var(--charcoal-light);
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.5;
}
.audio-declaration:last-child, .audio-mention:last-child, .audio-redflag:last-child { border-bottom: none; }
.audio-timestamp {
    font-size: 10px;
    font-family: 'SF Mono', monospace;
    color: var(--nacre);
    margin-right: 6px;
    flex-shrink: 0;
}
.audio-context {
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
}
.audio-topic-summary {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--charcoal-light);
    line-height: 1.5;
    font-style: italic;
}

/* ========================================
   KNOWLEDGE GRAPH
   ======================================== */
.graph-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.graph-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
}
.graph-title { font-size: 14px; font-weight: 600; color: var(--charcoal); }
.graph-stats { font-size: 11px; color: var(--muted); font-family: 'SF Mono', monospace; }
.graph-container {
    height: 300px;
    width: 100%;
    transition: height 0.3s ease;
}
.graph-container.expanded { height: 550px; }

/* ========================================
   ANOMALIES
   ======================================== */
.anomalies-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}
.anomalies-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
}
.anomaly-item {
    padding: 12px 14px;
    margin-bottom: 6px;
    border: 1px solid var(--border-light);
}
.anomaly-positive { border-left: 3px solid #C45; }
.anomaly-negative { border-left: 3px solid #6B8EC9; }
.anomaly-cleanup { border-left: 3px solid #D4A034; }
.anomaly-velocity { border-left: 3px solid #8B6B8E; }
.anomaly-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.anomaly-cat {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 6px;
    font-family: 'SF Mono', monospace;
    background: var(--pearl);
    color: var(--muted);
}
.anomaly-confidence {
    font-size: 9px;
    color: var(--sand);
    font-family: 'SF Mono', monospace;
    text-transform: uppercase;
}
.anomaly-title-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 2px;
}
.anomaly-desc {
    font-size: 12px;
    color: var(--charcoal-light);
    line-height: 1.5;
}

/* ========================================
   RISK SCORE
   ======================================== */
.risk-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}
.risk-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}
.risk-gauge-container { flex-shrink: 0; }
.risk-verdict {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.verdict-proceed { color: #5A8A5A; }
.verdict-caution { color: #D4A034; }
.verdict-do_not_proceed { color: #C45; }

.risk-alert {
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 6px;
}
.risk-alert-critical { background: #FFF0F0; border: 1px solid #FCE0E0; color: #C45; }
.risk-alert-medium { background: #FFF8F0; border: 1px solid #F0DCC8; color: #B87A2A; }

.risk-signals { margin-top: 12px; }
.risk-signal {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    color: var(--charcoal-light);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
}
.risk-signal:last-child { border-bottom: none; }
.signal-severity {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 6px;
    flex-shrink: 0;
    font-family: 'SF Mono', monospace;
}
.signal-critical { background: #FFF0F0; color: #C45; }
.signal-high { background: #FFF3F0; color: #C66; }
.signal-medium { background: #FFF8F0; color: #B87A2A; }
.signal-low { background: #F0F5F0; color: #5A8A5A; }

/* ========================================
   AUTH
   ======================================== */
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 28px 24px;
}
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}
.auth-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
}
.auth-tab.active {
    color: var(--charcoal);
    border-bottom-color: var(--nacre);
}
.auth-tab:hover { color: var(--charcoal); }
.auth-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    background: var(--pearl);
    border: 1px solid var(--border-light);
    color: var(--charcoal);
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--nacre); }
.auth-input::placeholder { color: var(--sand); }
.auth-error {
    font-size: 12px;
    color: #C45;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #FFF0F0;
    border: 1px solid #FCE0E0;
}
.auth-skip {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    font-size: 12px;
    font-family: inherit;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
}
.auth-skip:hover { color: var(--nacre); }

/* ========================================
   MODE SELECTOR
   ======================================== */
.mode-selector {
    display: flex;
    gap: 0;
    width: 100%;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.mode-card {
    flex: 1;
    padding: 18px 12px 14px;
    background: none;
    border: none;
    border-right: 1px solid var(--border-light);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
    position: relative;
}
.mode-card:last-child { border-right: none; }
.mode-card:hover { background: var(--bg-hover); }
.mode-card.active {
    background: var(--pearl);
}
.mode-card.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--nacre);
}
.mode-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--charcoal);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.mode-desc {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 2px;
}
.mode-time {
    font-size: 10px;
    color: var(--sand);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

@media (max-width: 680px) {
    .mode-card { padding: 14px 8px 10px; }
    .mode-name { font-size: 11px; }
    .mode-desc { font-size: 10px; }
}

/* ========================================
   ASK / Q&A
   ======================================== */
.ask-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px 24px;
    margin-top: 16px;
}
.ask-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
}
.ask-input-row {
    display: flex;
    gap: 8px;
}
.ask-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    background: var(--pearl);
    border: 1px solid var(--border-light);
    color: var(--charcoal);
    outline: none;
    transition: border-color 0.2s;
}
.ask-input:focus { border-color: var(--nacre); }
.ask-input::placeholder { color: var(--sand); }
.ask-btn {
    padding: 10px 20px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--charcoal);
    color: white;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.ask-btn:hover { background: var(--charcoal-light); }
.ask-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ask-qa {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}
.ask-q {
    font-size: 13px;
    font-weight: 600;
    color: var(--nacre);
    margin-bottom: 8px;
}
.ask-q::before { content: 'Q: '; }
.ask-a {
    font-size: 13px;
    color: var(--charcoal-light);
    line-height: 1.65;
}

/* ========================================
   MONITORING
   ======================================== */
.monitoring-section { margin-bottom: 8px; }
.monitoring-title {
    font-size: 11px;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}
.monitoring-empty {
    font-size: 13px;
    color: var(--muted);
    padding: 16px 0;
}

.alert-item {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 16px;
    margin-bottom: 6px;
}
.alert-type-sanctions_hit { border-left: 3px solid #C45; }
.alert-type-adverse_media { border-left: 3px solid #D4A034; }
.alert-type-corporate_change { border-left: 3px solid #5B7FA5; }
.alert-type-risk_change { border-left: 3px solid #8B6B8E; }
.alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.alert-type-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    background: var(--pearl);
    color: var(--muted);
    font-family: 'SF Mono', monospace;
}
.alert-subject { font-size: 13px; font-weight: 500; color: var(--charcoal); }
.alert-time { font-size: 11px; color: var(--sand); margin-left: auto; font-family: 'SF Mono', monospace; }
.alert-summary { font-size: 12px; color: var(--charcoal-light); line-height: 1.4; }

.watchlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 16px;
    margin-bottom: 4px;
}
.watchlist-name { font-size: 14px; font-weight: 500; color: var(--charcoal); }
.watchlist-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 2px; }
