:root {
    --primary-blue: #003366;
    --accent-blue: #007BFF;
    --light-blue: #E7F1FF;
    --bg-gray: #F8F9FA;
    --text-dark: #1A1A1A;
    --text-muted: #6C757D;
    --white: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.auth-locked {
    overflow: hidden;
}

.hidden { display: none !important; }
.mt-4 { margin-top: 1.5rem; }

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 28, 52, 0.72);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 95, 115, 0.18);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    padding: 2rem;
}

.auth-card h1 {
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-card p {
    color: var(--text-muted);
}

.auth-eyebrow {
    color: var(--accent-blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.auth-form {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.auth-input {
    background: var(--white);
}

.auth-error {
    color: #b42318;
    margin-top: 0.9rem;
    font-weight: 600;
}

/* ── Background Map (identical to RegRepo) ─────────────────────────────── */
.world-map-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/8/80/World_map_-_low_resolution.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 0.05;
    z-index: -1;
    pointer-events: none;
    filter: grayscale(100%) contrast(1.1) brightness(0.95);
}

/* ── Header (identical to RegRepo) ──────────────────────────────────────── */
.main-header {
    background-color: var(--white);
    border-bottom: 1px solid #E0E0E0;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.5px;
}

.logo-text .accent {
    color: var(--accent-blue);
}

.powered-by {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: -2px;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-btn {
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-blue);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

.nav-btn:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.nav-btn:active {
    transform: translateY(1px);
}

.nav-btn.active {
    background: var(--light-blue);
    color: var(--primary-blue);
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius);
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-blue);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ── Main Container ─────────────────────────────────────────────────────── */
.app-container {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}
.section-header p { color: var(--text-muted); font-size: 1rem; }

/* ── Upload Dropzone (matches RegRepo upload style) ─────────────────────── */
.upload-dropzone {
    border: 2px dashed rgba(0, 95, 115, 0.35);
    border-radius: 14px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(0, 95, 115, 0.03);
    position: relative;
    overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary-blue);
    background: rgba(0, 95, 115, 0.07);
}

.dropzone-icon { margin-bottom: 0.5rem; }
.upload-icon { width: 48px; height: 48px; color: var(--accent-blue); }
.dropzone-label { font-size: 0.95rem; color: var(--text-dark); margin: 0.25rem 0; }
.dropzone-link { color: var(--accent-blue); font-weight: 600; cursor: pointer; }
.dropzone-formats { font-size: 0.78rem; color: var(--text-muted); margin: 0.25rem 0 0 0; }

/* ── Buttons (matches RegRepo) ──────────────────────────────────────────── */
.primary-btn {
    background-color: var(--accent-blue);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit;
    font-size: 0.95rem;
}

.primary-btn:hover {
    background-color: #0069D9;
}

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

.secondary-btn {
    background-color: var(--white);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.95rem;
}

.secondary-btn:hover {
    background-color: var(--light-blue);
}

.icon-btn {
    background: var(--white);
    border: 1px solid #E0E0E0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

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

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--white);
    border: 1px solid #E0E0E0;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.action-btn svg {
    flex-shrink: 0;
}

.action-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--light-blue);
}

/* Legacy .btn classes mapped to new system */
.btn { font-family: inherit; cursor: pointer; transition: all 0.2s; border: none; }
.btn-primary { background-color: var(--accent-blue); color: var(--white); padding: 0.75rem 2rem; border-radius: 25px; font-weight: 600; }
.btn-primary:hover { background-color: #0069D9; }
.btn-secondary { background-color: var(--white); color: var(--accent-blue); border: 1px solid var(--accent-blue); padding: 0.75rem 1.5rem; border-radius: 25px; font-weight: 600; }
.btn-secondary:hover { background-color: var(--light-blue); }
.btn-icon { background: var(--white); border: 1px solid #E0E0E0; padding: 0.5rem 0.75rem; border-radius: 50px; display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--text-dark); cursor: pointer; transition: all 0.2s; }
.btn-icon:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* ── Progress Overlay ───────────────────────────────────────────────────── */
.progress-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(5px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}

.spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(0, 51, 102, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-blue);
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.progress-text { margin: 1rem 0; font-weight: 600; color: var(--text-dark); }
.progress-bar-container { width: 60%; height: 6px; background: #E9ECEF; border-radius: 3px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--accent-blue); transition: width 0.3s ease; }

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

/* ── Results Component ──────────────────────────────────────────────────── */
.result-card-panel, .result-glass, .glass-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    margin-top: 2rem;
    animation: fadeInUp 0.5s ease;
}

.result-card-panel h2, .result-glass h2 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.result-card {
    background: var(--bg-gray);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #E0E0E0;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.result-card h4 {
    color: var(--primary-blue);
    font-size: 1rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
    background: var(--light-blue);
    color: var(--primary-blue);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(0, 95, 115, 0.1);
}

.section-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-gray);
    border-radius: var(--radius-lg);
    border: 1px solid #E0E0E0;
}

.section-item { border-bottom: 1px solid #E0E0E0; padding: 1.5rem 0; }
.section-item:last-child { border-bottom: none; }
.section-item h5 { color: var(--primary-blue); margin-bottom: 1rem; font-size: 1.1rem; }
.section-item p { color: var(--text-dark); font-size: 0.95rem; line-height: 1.7; margin-bottom: 0.75rem; }
.section-item ul, .section-item ol { color: var(--text-dark); padding-left: 1.5rem; margin-bottom: 1rem; line-height: 1.7; }

.section-item table { width: 100%; border-collapse: collapse; margin-top: 1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.section-item th, .section-item td { border: 1px solid #E0E0E0; padding: 0.75rem; text-align: left; }
.section-item th { background: var(--light-blue); color: var(--primary-blue); font-weight: 600; }
.section-item tr:nth-child(even) { background: var(--bg-gray); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Search Mode Tabs ──────────────────────────────────────────────────── */
.search-mode-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--white);
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.search-mode-tab:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.search-mode-tab.active {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

.search-mode-tab.active svg {
    color: var(--white);
}

.search-panel {
    margin-bottom: 1rem;
}

/* ── Search Layout (matches RegRepo search styling) ─────────────────────── */
.search-bar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.search-container {
    display: flex;
    background: var(--white);
    padding: 0.35rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #EAEAEA;
    transition: all 0.3s ease;
    max-width: 700px;
    width: 100%;
}

.search-container:focus-within {
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.1);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.search-input {
    flex-grow: 1;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: var(--text-dark);
}

.search-layout { display: flex; gap: 2rem; align-items: flex-start; min-height: 60vh; margin-top: 1rem; }

.results-sidebar {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
}

.result-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 0;
    border: 1px solid #E0E0E0;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.result-item:hover, .result-item.active {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--accent-blue);
}

.result-item h3 { margin-bottom: 0.25rem; color: var(--primary-blue); }
.result-item h4 a { color: var(--accent-blue); text-decoration: none; }
.result-item p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }

/* ── Detail Pane ────────────────────────────────────────────────────────── */
.detail-pane {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 100px;
    max-height: 80vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.detail-pane .section-item p,
.detail-pane .markdown-body p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #E0E0E0;
    padding-bottom: 1rem;
}

.detail-header h2 { color: var(--primary-blue); }
.subtitle { color: var(--text-muted); font-size: 1rem; }

.language-selector label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.glass-select {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid #E0E0E0;
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236C757D' d='M6 8.825L1.175 4 2.238 2.938 6 6.7l3.763-3.763L10.825 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    transition: all 0.2s;
}

.glass-select:hover {
    border-color: var(--accent-blue);
}

.glass-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.glass-select option { background: var(--white); }

/* ── Knowledge Graph ────────────────────────────────────────────────────── */
.kg-container h3 { color: var(--primary-blue); margin-bottom: 1rem; }
.edges-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 200px; overflow-y: auto; }

.kg-edge {
    background: var(--bg-gray);
    padding: 0.75rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    border: 1px solid #E0E0E0;
}

.kg-node {
    color: var(--primary-blue);
    font-weight: 600;
    background: var(--light-blue);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.kg-rel {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Knowledge Graph Explorer ───────────────────────────────────────────── */
.kg-explorer {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.kg-explorer-body {
    padding: 1.25rem 1.5rem;
}

/* Breadcrumb */
.kg-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.kg-crumb {
    color: var(--accent-blue);
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.kg-crumb:hover {
    text-decoration: underline;
}

.kg-crumb.active {
    color: var(--text-dark);
    font-weight: 600;
    cursor: default;
}

.kg-crumb.active:hover {
    text-decoration: none;
}

.kg-crumb-sep {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0 0.15rem;
}

/* Category Pills */
.kg-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kg-category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid #E0E0E0;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.kg-category-pill:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--light-blue);
    transform: translateY(-1px);
}

.kg-category-pill.active {
    background: var(--accent-blue);
    color: var(--white);
    border-color: var(--accent-blue);
}

.kg-category-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kg-category-pill.active .kg-category-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Entity List */
.kg-entity-list {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
}

.kg-entity-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    background: var(--bg-gray);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.kg-entity-item:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--light-blue);
}

.kg-entity-item.active {
    background: var(--light-blue);
    border-color: var(--accent-blue);
    color: var(--primary-blue);
    font-weight: 600;
}

.kg-entity-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kg-loading {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-gray); }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Queue UI ───────────────────────────────────────────────────────────── */
.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid #E0E0E0;
}

.q-name {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    color: var(--text-dark);
}

.q-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.status-pending { background: #E9ECEF; color: var(--text-muted); }
.status-processing { background: var(--light-blue); color: var(--accent-blue); animation: pulse 2s infinite; }
.status-done { background: #D4EDDA; color: #155724; }
.status-error { background: #F8D7DA; color: #721C24; }
.status-skipped { background: #E9ECEF; color: #6C757D; }

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

/* ── Chatbot UI ─────────────────────────────────────────────────────────── */
.chatbot-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #005F73, #0077B6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 51, 102, 0.3);
    transition: transform 0.3s;
}

.chatbot-toggle:hover { transform: scale(1.05); }

.chatbot-window {
    width: 520px;
    height: 70vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--white);
    border: 1px solid #E0E0E0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.chatbot-window.hidden { transform: scale(0); opacity: 0; pointer-events: none; }

.chatbot-header {
    padding: 1rem;
    border-bottom: 1px solid #E0E0E0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-gray);
}

.chatbot-header h4 { margin: 0; color: var(--primary-blue); font-size: 1.1rem; }

.chatbot-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--white);
}

.chat-msg {
    max-width: 85%;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-msg.bot-msg {
    background: var(--bg-gray);
    border: 1px solid #E0E0E0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text-dark);
}

.chat-msg.bot-msg .markdown-body p:last-child { margin-bottom: 0; }

.chat-msg.user-msg {
    background: var(--accent-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-input-area {
    padding: 1rem;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 0.5rem;
    background: var(--bg-gray);
}

.chatbot-input-area input { flex: 1; }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.85rem 1.2rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94A3B8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chatbot markdown styling */
.chatbot-messages .markdown-body h2,
.chatbot-messages .markdown-body strong {
    color: var(--primary-blue);
}

.chatbot-messages .markdown-body ul,
.chatbot-messages .markdown-body ol {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.chatbot-messages .markdown-body li {
    margin-bottom: 0.25rem;
}

.chatbot-messages .markdown-body p {
    margin-bottom: 0.5rem;
}

.chatbot-messages .markdown-body p:last-child {
    margin-bottom: 0;
}

/* Disabled state for chat input */
.chatbot-input-area input:disabled,
.chatbot-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── GCS Sync Section ──────────────────────────────────────────────────── */
.sync-section {
    margin-top: 2rem;
}

.sync-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.sync-header h3 {
    color: var(--primary-blue);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

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

.sync-btn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.sync-status-text {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.95rem;
}

.sync-progress-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-bar-container {
    background: #E9ECEF;
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #005F73);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.sync-log {
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-gray);
    border: 1px solid #E0E0E0;
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    margin-top: 0.75rem;
}

.sync-log-entry {
    padding: 0.15rem 0;
}

.sync-log-time {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.sync-log-info { color: var(--text-dark); }
.sync-log-success { color: #155724; }
.sync-log-warning { color: #856404; }
.sync-log-error { color: #721C24; font-weight: 600; }
.sync-log-muted { color: var(--text-muted); }

.sync-summary {
    margin-top: 1rem;
}

.sync-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.sync-stat {
    text-align: center;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid #E0E0E0;
}

.sync-stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.sync-stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ── Key Changes Section ───────────────────────────────────────────────── */
.key-changes-container {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
    border: 1px solid #F0DCA0;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.key-changes-container h3 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.version-badge {
    display: inline-block;
    background: var(--accent-blue);
    color: var(--white);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.key-changes-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.key-changes-content ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.key-changes-content li {
    margin-bottom: 0.35rem;
}

.key-changes-content strong {
    color: var(--primary-blue);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .search-layout { flex-direction: column; }
    .results-sidebar { flex: none; width: 100%; max-height: 300px; }
    .detail-pane { position: static; max-height: none; }
}

@media (max-width: 768px) {
    .main-header { padding: 1rem; }
    .header-content { padding: 0.5rem; }
    .main-nav .nav-btn { display: none; }
    .app-container { padding: 0 1rem; }
    .section-header h1 { font-size: 1.5rem; }
}
