:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --font-family: 'Inter', sans-serif;
}

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

.container,
main {
    display: contents;
}

body {
    font-family: var(--font-family);
    background-color: #f8fafc;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

.app-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1;
}

/* Upload Section */
.upload-section {
    width: 100%;
    max-width: 650px;
    margin-top: 8vh;
    animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.upload-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 3.5rem;
    border-radius: 2rem;
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.upload-card:hover {
    transform: translateY(-5px);
}

.finalizing-section {
    width: 100%;
    max-width: 650px;
    margin-top: 8vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3.5rem;
    text-align: center;
    animation: fadeIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.finalizing-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pdf-spin 0.8s linear infinite;
}

.finalizing-text {
    font-size: 1rem;
    color: var(--text-muted);
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.brand-logo-img {
    height: 55px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-logo-img-small {
    height: 32px;
    width: auto;
    object-fit: contain;
    display: block;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* LLM Provider Selector */
.llm-provider-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.llm-provider-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.llm-provider-dropdown-wrap {
    position: relative;
}

.llm-provider-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border: 1.5px solid rgba(99, 102, 241, 0.55);
    border-radius: 2rem;
    background: rgba(241, 241, 255, 0.92);
    color: #1e293b;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.llm-provider-btn:hover {
    border-color: #6366f1;
    background: #e8e8ff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15);
}

.llm-provider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.llm-provider-dot[data-color="openai"],    .llm-provider-dot.dot-openai    { background: #16a34a; }
.llm-provider-dot[data-color="anthropic"], .llm-provider-dot.dot-anthropic { background: #d97706; }
.llm-provider-dot[data-color="deepseek"],  .llm-provider-dot.dot-deepseek  { background: #3b82f6; }
.llm-provider-dot[data-color="gemini"],    .llm-provider-dot.dot-gemini    { background: #10b981; }
.llm-provider-dot[data-color="ovh"],       .llm-provider-dot.dot-ovh       { background: #8b5cf6; }

.llm-chevron {
    margin-left: 0.1rem;
    transition: transform 0.2s;
}

.llm-provider-dropdown-wrap.open .llm-chevron {
    transform: rotate(180deg);
}

.llm-provider-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 180px;
    background: #fff;
    border: 1.5px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.85rem;
    box-shadow: 0 8px 24px rgba(31, 38, 135, 0.12);
    list-style: none;
    padding: 0.35rem 0;
    z-index: 100;
    animation: fadeInDown 0.15s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.llm-provider-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.15s;
}

.llm-provider-option:hover {
    background: rgba(99, 102, 241, 0.07);
}

.llm-provider-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    font-weight: 600;
}

.drop-zone {
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: 1.5rem;
    padding: 3.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.4);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.02);
}

.icon-container {
    color: #6366f1;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.browse-link {
    color: #6366f1;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.browse-link:hover {
    border-bottom-color: #6366f1;
}

.file-list-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
}

.file-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 0.8rem 1.5rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition: transform 0.2s;
}

.file-info-row:hover {
    transform: translateX(5px);
}

.file-name {
    color: var(--text-main);
    word-break: break-all;
    margin-right: 1rem;
    text-align: left;
    flex: 1;
    line-height: 1.4;
}

.remove-file-btn {
    background: #fee2e2;
    border: none;
    color: #ef4444;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.remove-file-btn:hover {
    background: #fecaca;
    transform: scale(1.1);
}

.btn-primary {
    margin-top: 2.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    border-radius: 1rem;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

/* Results Section */
.results-section {
    width: 100%;
    animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 1.75rem;
    height: 62px;
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 4px 20px rgba(0,0,0,0.04);
    position: relative;
    overflow: visible;
}

.results-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-gradient);
    border-radius: 1rem 0 0 1rem;
}

.results-header .btn-primary,
#startVerificationBtn {
    margin-top: 0;
    width: auto;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.65rem;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.results-header .btn-primary:hover,
#startVerificationBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.brand-logo.small {
    margin-bottom: 0;
}

.btn-secondary {
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-main);
    padding: 0.55rem 1.1rem;
    border-radius: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.btn-icon-only {
    padding: 0;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.btn-icon-only:hover {
    color: var(--text-main);
}

.results-header .header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Verification Modal ─────────────────────────────────────────────── */
/* ── Verification Modal ───────────────────────────────────────────────── */
.verification-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.verification-modal.hidden { display: none; }

.verification-modal-content {
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 92vw;
    max-width: 1300px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top bar */
.verification-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
    gap: 1rem;
}
.verif-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.verif-header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.verif-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    white-space: nowrap;
}
.verif-doc-badge {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.verif-doc-badge.badge-br { background: #fce7f3; color: #9d174d; }
.verif-doc-badge.badge-arc { background: #d1fae5; color: #065f46; }
.verif-progress-label {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}
.verif-page-select {
    border: 1px solid rgba(0,0,0,0.18);
    border-radius: 0.5rem;
    padding: 0.38rem 0.65rem;
    font-size: 0.85rem;
    background: #f8fafc;
    cursor: pointer;
    min-width: 110px;
}
.verif-page-info {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    padding: 0.38rem 0.65rem;
    border: 1px solid rgba(0,0,0,0.18);
    border-radius: 0.5rem;
    background: #f8fafc;
    min-width: 60px;
    text-align: center;
}

/* Horizontal info bar */
.verif-info-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.6rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
    flex-wrap: wrap;
    row-gap: 0.4rem;
}
.verif-info-chip {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0 1.1rem;
}
.verif-info-chip:first-child { padding-left: 0; }
.verif-info-sep {
    width: 1px;
    height: 1.2rem;
    background: rgba(0,0,0,0.13);
    align-self: center;
    flex-shrink: 0;
}
.verif-info-key {
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.verif-info-val {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 600;
    word-break: break-all;
}
.verif-current-val.is-missing {
    color: #d97706;
    background: #fef3c7;
    padding: 0.12rem 0.4rem;
    border-radius: 0.35rem;
}
.verif-current-val.is-mismatch {
    color: #dc2626;
    background: #fee2e2;
    padding: 0.12rem 0.4rem;
    border-radius: 0.35rem;
}
.verif-current-val.is-confirm {
    color: #059669;
    background: #d1fae5;
    padding: 0.12rem 0.4rem;
    border-radius: 0.35rem;
}

/* Full-width PDF area */
.verif-pdf-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    background: #f1f5f9;
}
.verif-pdf-container {
    width: 100%;
}
.verif-page-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    color: #9ca3af;
    font-size: 0.8rem;
}
.verif-pdf-container canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* Bottom action bar */
.verif-bottom-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    border-radius: 0 0 0.75rem 0.75rem;
}
.verif-qty-pending {
    /* flex-basis:100% keeps this on its own row in the wrapping bottom bar;
       the box/border itself lives on the inner div below so it hugs the
       text instead of stretching to the bar's full width. */
    flex-basis: 100%;
    margin: 0 0 0.15rem;
}
.verif-qty-pending > div {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    padding: 0.5rem 0.7rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #1e3a8a;
}
.verif-bottom-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e1b4b;
    white-space: nowrap;
    flex-shrink: 0;
}
.verif-input {
    flex: 1;
    border: 1.5px solid #7c3aed;
    border-radius: 0.75rem;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    min-width: 0;
    color: #374151;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.verif-input::placeholder { color: #9ca3af; }
.verif-input:focus {
    outline: none;
    border-color: #6d28d9;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.13);
}

.verif-btn-indicate {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.85rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6d28d9;
    background: #fff;
    border: 1.5px solid #7c3aed;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.verif-btn-indicate:hover {
    background: #f5f3ff;
}
.verif-btn-indicate.active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.verif-btn-indicate.active:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
.verif-pdf-container {
    position: relative;
}
.verif-btn-skip {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.52rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.verif-btn-skip:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.verif-btn-confirm {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.85rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #7c3aed;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}
.verif-btn-confirm:hover {
    background: #6d28d9;
}

.verif-complete-msg {
    text-align: center;
    padding: 3rem 1rem;
    color: #059669;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Verified state for Start Verification button */
#startVerificationBtn.btn-verified {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.45);
    border-color: transparent;
    cursor: default;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    pointer-events: none;
}
#startVerificationBtn.btn-verified:hover {
    transform: none;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.45);
}

/* ── Verification complete banner ─────────────────────────────── */
.verif-complete-banner {
    position: fixed;
    top: 28px;
    right: 32px;
    z-index: 9999;
    animation: verifBannerIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
    pointer-events: none;
}
.verif-complete-banner--fade {
    opacity: 0;
    transition: opacity 0.4s ease;
}
.verif-complete-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1.5px solid #34d399;
    border-radius: 12px;
    padding: 14px 22px;
    box-shadow: 0 8px 32px rgba(5, 150, 105, 0.18), 0 2px 8px rgba(0,0,0,0.08);
}
.verif-complete-banner-inner span {
    font-size: 1.05rem;
    font-weight: 700;
    color: #065f46;
    letter-spacing: 0.01em;
}
@keyframes verifBannerIn {
    from { opacity: 0; transform: translateY(-18px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* ─────────────────────────────────────────────────────────────── */

.verif-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: rgba(255,255,255,0.22);
    border-radius: 0.4rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
}
.verif-score-sep {
    width: 1px;
    height: 1rem;
    background: rgba(255,255,255,0.35);
}

.analysis-report {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 2rem;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    border: 1px solid white;
}

.report-header {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5));
    padding: 1.5rem 3rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.2);
}

.report-body {
    padding: 4rem;
}

/* Markdown Styles */
.markdown-body {
    font-size: 1.1rem;
    color: #334155;
    line-height: 1.8;
    max-width: 100%;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: #0f172a;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.markdown-body h1 {
    font-size: 2.5rem;
    margin-top: 3rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid transparent;
    border-image: var(--primary-gradient) 1;
    display: inline-block;
    width: 100%;
}

.markdown-body h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.markdown-body h2::before {
    content: '';
    display: block;
    width: 8px;
    height: 30px;
    background: var(--secondary-gradient);
    border-radius: 4px;
}

.markdown-body h3 {
    font-size: 1.4rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.markdown-body p {
    margin-bottom: 1.8rem;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    position: relative;
}

.markdown-body strong {
    color: #4f46e5;
    font-weight: 700;
}

.markdown-body blockquote {
    border-left: none;
    position: relative;
    padding: 2rem;
    margin: 2.5rem 0;
    color: #475569;
    font-style: italic;
    background: #f8fafc;
    border-radius: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.markdown-body blockquote::before {
    content: '"';
    position: absolute;
    top: 0;
    left: 10px;
    font-size: 4rem;
    color: #e2e8f0;
    font-family: serif;
    line-height: 1;
}

.markdown-body code {
    background: #1e293b;
    color: #f472b6;
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-body pre {
    background: #0f172a;
    padding: 2rem;
    border-radius: 1rem;
    overflow-x: auto;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

.markdown-body pre code {
    background: transparent;
    color: #e2e8f0;
    padding: 0;
    box-shadow: none;
}

/* Action Buttons in Report */
.view-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: white;
    color: #4f46e5;
    border: 2px solid #4f46e5;
    padding: 0.8rem 1.5rem;
    border-radius: 0.8rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

.view-pdf-btn:hover {
    background: #4f46e5;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.view-pdf-btn svg {
    width: 20px;
    height: 20px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: white;
    width: 95%;
    max-width: 1400px;
    height: 92vh;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.close-modal {
    background: #f1f5f9;
    border: none;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-pdf-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    background-color: #334155;
    display: block;
}

.pdf-loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.pdf-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: pdf-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.pdf-spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

.pdf-page-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #94a3b8;
}

.pdf-loading-text {
    color: #94a3b8;
    font-style: italic;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background-color: white;
    display: flex;
    justify-content: flex-end;
}

/* Cell Detail Modal — shows the PDF page with a bounding box around the value */
.cost-modal-content {
    width: 92%;
    max-width: 420px;
    height: auto;
    max-height: 90vh;
}

.cost-modal-body {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    overflow-y: auto;
}

.cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
}

.cost-row-icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
}

.cost-row-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cost-row-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.cost-row-provider {
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(100, 116, 139, 0.12);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.cost-row-total .cost-row-provider {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    margin-top: -0.4rem;
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
}

.cost-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.cost-breakdown-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.cost-breakdown-model {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.cost-breakdown-value {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.cost-row-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.cost-row-value {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    white-space: nowrap;
}

.cost-row-total {
    background: var(--primary-gradient);
    border: none;
}

.cost-row-total .cost-row-label,
.cost-row-total .cost-row-value {
    color: white;
}

.cost-row-total .cost-row-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.cost-modal-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

.cost-modal-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cell-detail-modal-content {
    width: 96%;
    max-width: 1500px;
    height: 93vh;
    max-height: 93vh;
    /* Open instantly: this modal is opened repeatedly (one per cell click),
       so the 0.4s scaleIn animation and 0.3s opacity fade on .modal make
       every click feel sluggish. Override them. */
    animation: none;
}

/* Strip the opacity/blur transition for the cell-detail modal only —
   keeps other modals' polished animation intact. */
#cellDetailModal {
    transition: none;
    backdrop-filter: none;
}

.cell-detail-max-btn {
    margin-left: 0.5rem;
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.cell-detail-max-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.cell-detail-max-btn .cd-min-icon { display: none; }
.cell-detail-modal-content.cell-detail-maximized .cell-detail-max-btn .cd-max-icon { display: none; }
.cell-detail-modal-content.cell-detail-maximized .cell-detail-max-btn .cd-min-icon { display: inline-block; }

/* Maximize: only the PDF pane (cell-detail-main) goes fullscreen as an overlay.
   The modal itself stays put; the rest of the modal is hidden behind the overlay. */
.cell-detail-modal-content.cell-detail-maximized .cell-detail-main {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1100;
    background: #f8fafc;
    padding: 14px 18px;
    box-sizing: border-box;
    border-radius: 0;
    gap: 0.6rem;
}

.cell-detail-modal-content.cell-detail-maximized .cell-detail-max-btn {
    background: #ffffff;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.25);
    padding: 6px 10px;
}

/* .modal-header (title + close button) is a SIBLING of .cell-detail-main,
   not a descendant — without this it stays in the normal stacking context
   while the maximized main pane becomes a fixed, viewport-covering overlay
   at z-index 1100, silently making the title's inline-edit control and the
   × close button unclickable (covered by the PDF pane) while maximized. */
.cell-detail-modal-content.cell-detail-maximized .modal-header {
    position: relative;
    z-index: 1200;
}

.cell-detail-modal-body {
    flex: 1;
    min-height: 0;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
}

.cell-detail-pdf-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.cell-detail-top {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.cell-detail-pdf-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #475569;
}

/* Prev/next arrows + page counter grouped together in the meta bar */
.cd-red-nav-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* Reset the global margin-left:auto on .cd-page-dropdown when it sits
   inside .cd-red-nav-bar — the nav bar itself is already right-aligned. */
.cd-red-nav-bar .cd-page-dropdown {
    margin-left: 0;
}

.cd-red-arrow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.cd-red-arrow-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.cd-red-arrow-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cell-detail-doc-badge {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cell-detail-field-label {
    font-weight: 500;
    color: #334155;
}

.cell-detail-page-label {
    margin-left: auto;
    color: #64748b;
    font-size: 0.8rem;
}

.cell-detail-pdf-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 2rem 0.75rem;
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ── View bar: extracted value + Modifier / Valider ── */
.cell-detail-view-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 0 0 auto;
    box-shadow: 0 -2px 8px -4px rgba(15, 23, 42, 0.12);
}

.cd-extracted-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.cd-extracted-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.cd-extracted-value-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
}

.cd-extracted-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cd-extracted-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cd-extracted-badge-verified {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.cd-extracted-badge-missing {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.cd-view-actions {
    display: flex;
    gap: 0.65rem;
    flex-shrink: 0;
}

.cd-view-actions .cell-detail-btn-small {
    padding: 0.8rem 1.2rem;
    height: 44px;
    min-height: 44px;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
    margin: 0;
    width: auto;
    border-radius: 0.75rem;
}

/* ── Page nav "N / Total" dropdown button style ── */
.cd-page-nav-btn {
    gap: 4px !important;
}

.cd-page-nav-current {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
}

.cd-page-nav-sep {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 400;
}

.cd-page-nav-total {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.cell-detail-edit-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.4rem;
    display: flex;
    align-items: center;
    /* wrap (not nowrap) so #cellDetailQtyPending's flex-basis:100% can push
       it onto its own row above the input, matching .verif-bottom-bar. */
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 0 0 auto;
    box-shadow: 0 -2px 8px -4px rgba(15, 23, 42, 0.12);
}

.cell-detail-edit-panel.hidden {
    display: none;
}

.cell-detail-edit-hint {
    margin: 0;
    font-size: 0.875rem;
    color: #1e1b4b;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.cell-detail-edit-row {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
    flex-shrink: 0;
}

.cell-detail-input {
    flex: 1 1 auto;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 1.05rem;
    font-family: inherit;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.3s ease;
    min-width: 0;
    height: 52px;
    box-sizing: border-box;
}

.cell-detail-input-block {
    width: auto;
    flex: 1 1 auto;
    box-sizing: border-box;
}

.cell-detail-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.cell-detail-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cell-detail-edit-row {
    justify-content: flex-end;
}

.cell-detail-edit-row .cell-detail-btn-small,
.cell-detail-edit-row button.cell-detail-btn-small {
    padding: 0.75rem 1.35rem;
    font-size: 1.02rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
    height: 52px;
    min-height: 52px;
    line-height: 1.2;
    margin: 0;
    flex: 1 1 0;
    min-width: 260px;
    width: auto;
    border-radius: 0.7rem;
}

/* Match the "Start Verification" bottom bar's palette (.verif-btn-indicate /
   .verif-btn-confirm) so the correction row looks the same whether it was
   opened by clicking a table value or by Start Verification. */
#cellDetailDrawBtn {
    border-color: #7c3aed;
    color: #6d28d9;
    background: #fff;
}
#cellDetailDrawBtn:hover {
    background: #f5f3ff;
}
#cellDetailDrawBtn.selection-active {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}
#cellDetailConfirmBtn {
    background: #7c3aed;
    box-shadow: none;
}
#cellDetailConfirmBtn:hover {
    background: #6d28d9;
    transform: none;
    box-shadow: none;
}

/* Clickable value in comparison table cells */
.ct-val.ct-val-clickable {
    cursor: pointer;
    color: #2563eb;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.35);
    text-underline-offset: 2px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    text-align: left;
}

.ct-val.ct-val-clickable:hover,
.ct-val.ct-val-clickable:focus-visible {
    color: #1d4ed8;
    text-decoration-color: #1d4ed8;
    outline: none;
}

/* PDF Page Styles */
.pdf-page {
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    background: white;
    border-radius: 4px;
}

.bounding-box {
    position: absolute;
    border: 3px solid #6366f1;
    background-color: rgba(99, 102, 241, 0.15);
    transition: all 0.2s;
    cursor: pointer;
    border-radius: 2px;
}

.bounding-box:hover {
    border-color: #4f46e5;
    background-color: rgba(99, 102, 241, 0.3);
    z-index: 10;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

/* New Hover-Based Bounding Boxes */
.pdf-bbox {
    position: absolute;
    border: 2px solid;
    pointer-events: auto;
    transition: all 0.15s ease;
    cursor: default;
    z-index: 5;
    background-color: transparent;
    overflow: visible;
}

.pdf-bbox:hover {
    background-color: rgba(16, 185, 129, 0.1);
    z-index: 20;
}

.pdf-bbox-label {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    background: #10b981;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.pdf-bbox:hover .pdf-bbox-label {
    opacity: 1;
    transform: translateY(0);
}

/* ── Close (×) button shared base ── */
.pdf-bbox-close,
.bbox-close-btn {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: 1.5px solid #fff;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    line-height: 1;
    transition: opacity 0.15s ease, background 0.1s ease;
    z-index: 30;
    pointer-events: all;
}
.pdf-bbox-close:hover,
.bbox-close-btn:hover {
    opacity: 1;
    background: #b91c1c;
}

/* Cell-detail modal HTML bbox — top-right corner, centered on the corner point */
.pdf-bbox-close {
    top: -7px;
    right: -7px;
}

/* Validation / cell-detail canvas bbox — anchored via JS left/top % */
.bbox-close-btn {
    transform: translate(-50%, -50%);
}


/* ── Cell-detail modal: hover-to-edit affordance on the TITLE value
   ("BR · Quantity — 4") — the aggregate number shown in the modal header.
   This is the ONLY click-to-edit affordance in the cell-detail modal;
   there is no equivalent hover/click editing on the rendered PDF page. ── */
.cell-detail-title-value {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-bottom: 2px dashed #c7d2fe;
    border-radius: 3px;
    padding: 0 2px;
    transition: color 0.12s ease, border-color 0.12s ease;
}
.cell-detail-title-value:hover,
.cell-detail-title-value:focus {
    color: #4f46e5;
    border-color: #4f46e5;
    outline: none;
}

.cell-detail-title-edit-tip {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 8px);
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    z-index: 40;
}
.cell-detail-title-value:hover .cell-detail-title-edit-tip,
.cell-detail-title-value:focus .cell-detail-title-edit-tip {
    opacity: 1;
    visibility: visible;
}

.cell-detail-title-input {
    font: inherit;
    font-weight: 700;
    color: #0f172a;
    background: #eef2ff;
    border: 2px solid #6366f1;
    border-radius: 6px;
    padding: 0 6px;
    width: 8ch;
    min-width: 3ch;
    box-sizing: content-box;
}
.cell-detail-title-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Trigoscope Auth Overlay — Aurora Dark
   ======================================== */

@keyframes blob-move-1 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(70px, -50px);
    }

    50% {
        transform: translate(25px, 40px);
    }

    75% {
        transform: translate(-40px, -25px);
    }
}

@keyframes blob-move-2 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-60px, 35px);
    }

    50% {
        transform: translate(-25px, -45px);
    }

    75% {
        transform: translate(50px, 25px);
    }
}

@keyframes blob-move-3 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-45px, 25px) scale(1.12);
    }

    66% {
        transform: translate(35px, -35px) scale(0.9);
    }
}

/* ---- Full-screen overlay ---- */
.trigo-auth-overlay {
    position: fixed;
    inset: 0;
    background: #0a0718;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

.trigo-auth-overlay.hidden {
    display: none !important;
}

/* SVG noise grain overlay for depth */
.trigo-auth-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 220px 220px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 2;
}

/* ---- Aurora blobs ---- */
.trigo-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    z-index: 1;
}

.trigo-blob-1 {
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
    opacity: 0.55;
    top: -12%;
    left: -8%;
    animation: blob-move-1 20s ease-in-out infinite;
}

.trigo-blob-2 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
    opacity: 0.5;
    bottom: -12%;
    right: -6%;
    animation: blob-move-2 24s ease-in-out infinite;
}

.trigo-blob-3 {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, #a855f7 0%, transparent 70%);
    opacity: 0.35;
    top: 35%;
    left: 42%;
    animation: blob-move-3 18s ease-in-out infinite;
}

/* ---- Watermark logo — bottom-right corner ---- */
.trigo-bg-watermark {
    position: absolute;
    bottom: -6%;
    right: -3%;
    pointer-events: none;
    z-index: 1;
}

.trigo-bg-logo {
    width: min(60vw, 600px);
    height: auto;
    filter: brightness(0) invert(1);
    opacity: 0.22;
    transform: rotate(-6deg);
    user-select: none;
    display: block;
}

/* ---- Glassmorphism login card ---- */
.trigo-login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    background: rgba(18, 12, 48, 0.72);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 22px;
    padding: 2.75rem 2.5rem 2.25rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.3),
        0 32px 80px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Logo inside card (inverted to white) ---- */
.trigo-brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.trigo-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* ---- Text ---- */
.trigo-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: #f1eeff;
    margin-bottom: 0.3rem;
    text-align: center;
    letter-spacing: -0.02em;
}

.trigo-subtext {
    font-size: 0.875rem;
    color: #a78bfa;
    margin-bottom: 1.75rem;
    text-align: center;
}

/* ---- Fields ---- */
.trigo-field {
    margin-bottom: 1rem;
}

.trigo-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #c4b5fd;
    margin-bottom: 0.4rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.trigo-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid rgba(139, 92, 246, 0.25);
    background: rgba(255, 255, 255, 0.07);
    color: #f1eeff;
    font-size: 0.95rem;
    font-family: var(--font-family);
    outline: none;
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.trigo-input::placeholder {
    color: rgba(167, 139, 250, 0.4);
}

.trigo-input:hover {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(255, 255, 255, 0.1);
}

.trigo-input:focus {
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.11);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* ---- Errors ---- */
.trigo-field-error {
    color: #f87171;
    font-size: 0.75rem;
    margin-top: 0.35rem;
    min-height: 1rem;
}

.trigo-error-msg {
    color: #f87171;
    font-size: 0.82rem;
    margin: 0.5rem 0 0.25rem;
    min-height: 1rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.12);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
}

.trigo-error-msg:empty {
    background: none;
    padding: 0;
}

/* ---- Primary button ---- */
.trigo-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 50px;
    margin-top: 1.25rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.97rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    letter-spacing: 0.01em;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
}

.trigo-btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.6);
}

.trigo-btn-primary:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.trigo-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Switch text ---- */
.trigo-switch-text {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgba(167, 139, 250, 0.7);
}

.trigo-link {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.trigo-link:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .trigo-login-card {
        padding: 2rem 1.5rem 1.75rem;
        border-radius: 16px;
        margin: 1rem 0.75rem;
    }
}

/* User Avatar & Logout Dropdown — now inline in the summary header */
.user-avatar-wrapper {
    position: relative;
}

.user-avatar-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.65rem;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.user-avatar-btn:hover {
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-main);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* CSS tooltip for header icon buttons */
.header-icon-btn {
    position: relative;
}

.header-icon-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    background: #1e293b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateX(-50%) translateY(-4px);
    z-index: 300;
    font-family: var(--font-family);
    letter-spacing: 0.01em;
}

.header-icon-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    min-width: 150px;
    overflow: hidden;
    animation: slideUp 0.18s ease;
    z-index: 300;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font-family);
}

.user-dropdown-item:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Sign out button (small, unobtrusive) */
.ms-signout-btn {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #64748b;
    padding: 0.3rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    width: fit-content;
    margin: 0.5rem auto 1rem;
}

.ms-signout-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
}

/* ========================================
   Validation Section — Full-page Design
   ======================================== */

/* Break out of app-container constraints */
.validation-section {
    width: calc(100% + 4rem);
    margin: -2rem;
    min-height: 100vh;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease;
}

/* ── Top bar ── */
.val-topbar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.875rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.val-topbar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.val-retour-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.45rem 1rem;
    border-radius: 0.6rem;
    transition: all 0.15s;
    font-family: var(--font-family);
}

.val-retour-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* ── Scrollable body ── */
.val-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    align-self: center;
    box-sizing: border-box;
}

/* ── Intro card ── */
.val-intro-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
    padding: 1.5rem 1.75rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.val-intro-icon-wrap {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-top: 2px;
}

.val-intro-content {
    flex: 1;
    min-width: 0;
}

.val-intro-header {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.5rem;
}

.val-intro-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.val-intro-sub {
    font-size: 0.8rem;
    color: #64748b;
}

.val-intro-desc {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.val-intro-progress-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.val-intro-bar-wrap {
    flex: 1;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.question-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.val-confirmed-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

/* ── Main question card ── */
.val-main-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Step row ── */
.val-step-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.val-step-counter {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #94a3b8;
    text-transform: uppercase;
}

.val-progress-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.val-dot {
    width: 28px;
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    transition: background 0.3s;
}

.val-dot.active {
    background: #6366f1;
}

.val-dot.done {
    background: #a5b4fc;
}

/* ── Two-column layout ── */
.val-two-col {
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* ── Left: PDF column ── */
.val-pdf-col {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: white;
}

.val-doc-hdr {
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.val-doc-hdr-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
}

.val-doc-hdr-actions {
    display: flex;
    gap: 0.4rem;
}

.question-doc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.question-doc-badge.bl {
    background: #dbeafe;
    color: #1d4ed8;
}

.question-doc-badge.br {
    background: #d1fae5;
    color: #065f46;
}

.question-doc-badge.arc {
    background: #ede9fe;
    color: #5b21b6;
}

.pdf-expand-btn,
.pdf-minimize-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 0.35rem;
    transition: all 0.15s;
    font-family: var(--font-family);
}

.pdf-expand-btn:hover,
.pdf-minimize-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.val-pdf-col.pdf-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    max-width: none;
}

body.pdf-fullscreen-active .user-avatar-wrapper {
    display: none;
}

.val-pdf-col.pdf-fullscreen .question-pdf-container {
    height: calc(100vh - 48px);
    max-height: none;
}

.question-pdf-container {
    position: relative;
    overflow-y: auto;
    padding: 8px;
    min-height: 500px;
    max-height: 640px;
    background: #f8fafc;
}

/* ── Right: Question column ── */
.val-q-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0.5rem;
}

.val-question-text {
    font-size: 1rem;
    font-weight: 500;
    color: #334155;
    line-height: 1.7;
    margin: 0;
}

.val-question-text strong {
    color: #0f172a;
    font-weight: 700;
}

/* Value + confidence display */
.val-value-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.val-value-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
    word-break: break-all;
}

.val-conf-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    cursor: help;
}

.question-actions {
    display: flex;
    gap: 0.875rem;
}

.btn-answer {
    flex: 1;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.btn-answer.yes {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.btn-answer.yes:hover {
    background: #10b981;
    color: white;
    filter: brightness(1.05);
}

.btn-answer.no {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.btn-answer.no:hover {
    background: #dc2626;
    border-color: #dc2626;
    filter: brightness(1.1);
}

.correction-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease;
}

.correction-prompt {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 1rem;
    font-weight: 500;
}

.correction-input-wrap {
    margin-bottom: 1.5rem;
}

.correction-input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 1.5px solid #6366f1;
    /* purple/blue border like screenshot */
    border-radius: 0.75rem;
    font-size: 1rem;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
}

.correction-input:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.ou-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #94a3b8;
    margin: 1.25rem 0;
}

.ou-divider::before,
.ou-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.ou-divider span {
    padding: 0 1rem;
    font-size: 0.85rem;
    text-transform: lowercase;
}

.btn-outline-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    border-radius: 0.75rem;
    border: 1.5px solid #6366f1;
    background: transparent;
    color: #6366f1;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.btn-outline-primary:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

.btn-outline-primary.selection-active {
    border-color: #ef4444;
    color: #dc2626;
    background: rgba(239, 68, 68, 0.04);
}

.btn-outline-primary.selection-active:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-confirm-purple {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    background: #6D28D9;
    /* purple like screenshot */
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 15px -3px rgba(109, 40, 217, 0.3);
}

.btn-confirm-purple:hover {
    background: #5B21B6;
    transform: translateY(-2px);
    box-shadow: 0 15px 20px -5px rgba(109, 40, 217, 0.4);
}

.btn-confirm-purple:active {
    transform: translateY(0);
}

.correction-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.correction-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid #fbbf24;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-family);
    background: white;
    box-sizing: border-box;
}

.correction-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* ── Footer navigation ── */
.val-footer {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.val-prev-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    transition: all 0.15s;
    font-family: var(--font-family);
}

.val-prev-btn:hover:not(:disabled) {
    color: #334155;
    background: #f1f5f9;
}

.val-prev-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.val-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #6366f1;
    color: white;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.6rem 1.5rem;
    border-radius: 9999px;
    transition: all 0.2s;
    font-family: var(--font-family);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.val-next-btn:hover {
    background: #4f46e5;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

/* Legacy compatibility */
.question-nav {
    display: none;
}

.btn-prev-question {
    display: none;
}

/* ========================================
   Summary Section — Comparison Table
   ======================================== */
.summary-section {
    width: calc(100% + 4rem);
    margin: -2rem;
    min-height: 100vh;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease;
}

.summary-content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ── Comparison Table ──────────────────────────────────────────────────── */
.ct-wrapper {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.ct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ct-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.ct-table thead th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ct-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.ct-table tbody tr:hover {
    background: #fafbff;
}

/* First row of each lot group gets a stronger top border */
.ct-lot-first {
    border-top: 2px solid #cbd5e1;
}

/* Last row of each lot group gets a bottom gap so lots visually separate */
.ct-lot-last {
    border-bottom: 1px solid #e2e8f0;
}

/* Lot number cell — spans all field rows */
.ct-lot {
    text-align: center;
    padding: 0 0.75rem;
    border-right: 1px solid #e2e8f0;
    vertical-align: middle;
    width: 58px;
}

.ct-lot-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #334155;
    border: 1.5px solid #e2e8f0;
}

.ct-lot-ok .ct-lot-badge {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.ct-lot-warn .ct-lot-badge {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.ct-lot-fail .ct-lot-badge {
    background: #fff1f2;
    color: #dc2626;
    border-color: #fecdd3;
}

/* Doc-level MSN header row — rendered once at the top of the table.
   Visually offset from the per-lot rows below. */
.ct-msn-row {
    background: #f8fafc;
    border-bottom: 2px solid #cbd5e1;
}

.ct-msn-row td {
    border-top: 1px solid #cbd5e1;
}

.ct-msn-row .ct-field {
    color: #1e293b;
    font-weight: 700;
}

.ct-msn-badge {
    width: auto !important;
    padding: 0 0.55rem;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
}

/* Field name (Champ) column */
.ct-field {
    padding: 0.32rem 0.9rem;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    width: 118px;
    color: #475569;
    vertical-align: middle;
}

/* Dot indicator next to field name */
.ct-field-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: 1px;
    flex-shrink: 0;
}

.ct-field-dot-ok {
    background: #10b981;
}

.ct-field-dot-warn {
    background: #f59e0b;
}

.ct-field-dot-fail {
    background: #ef4444;
}

/* Value cells */
.ct-cell {
    padding: 0.32rem 0.9rem;
    vertical-align: middle;
}

.ct-cell-inner {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* Stacked-value container inside a cell: used when a group has multiple
   entries for the same doc/field (e.g. BR shows one '1' per page). */
.ct-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.ct-val {
    font-weight: 500;
    color: #0f172a;
    font-size: 0.875rem;
}

/* Inline confidence score badge shown beside each extracted value */
.ct-conf-badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0.85;
    white-space: nowrap;
    flex-shrink: 0;
}

.ct-match {
    background: transparent;
}

.ct-mismatch {
    background: #fff1f2;
}

.ct-missing {
    background: #fffbeb;
}

.ct-missing-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #92400e;
    font-size: 0.78rem;
    font-style: italic;
    font-weight: 500;
}

/* Clickable Manquant cell — mirrors ct-val-clickable affordance */
button.ct-missing-clickable {
    background: none;
    border: 1px dashed transparent;
    padding: 2px 6px;
    border-radius: 6px;
    font: inherit;
    color: #92400e;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(217, 119, 6, 0.45);
    text-underline-offset: 2px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

button.ct-missing-clickable:hover,
button.ct-missing-clickable:focus-visible {
    background: #fef3c7;
    border-color: rgba(217, 119, 6, 0.5);
    color: #78350f;
    text-decoration-color: #78350f;
    outline: none;
}

.ct-agg-kv-hint .ct-agg-v {
    color: #94a3b8;
    font-style: italic;
}

/* Shield icon trigger — JS tooltip attached via event delegation */
.ct-icon-wrap {
    display: inline-flex;
    align-items: center;
    cursor: default;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 1px 2px;
    transition: background 0.12s;
}

.ct-icon-wrap:hover {
    background: rgba(59, 130, 246, 0.08);
}

.ct-col-score-wrap {
    display: inline-flex;
    align-items: center;
    cursor: default;
    margin-right: 5px;
    vertical-align: middle;
    opacity: 0.75;
    border-radius: 4px;
    padding: 1px 2px;
    transition: opacity 0.12s, background 0.12s;
}
.ct-col-score-wrap:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.08);
}

/* ── Floating confidence tooltip card ───────────────────────────── */
.ct-tooltip-card {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.07);
    width: auto;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.14s, transform 0.14s;
}

.ct-tooltip-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.ct-tip-header {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.ct-tip-score {
    margin-bottom: 10px;
}

.ct-tip-score:last-of-type {
    margin-bottom: 6px;
}

.ct-tip-score-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.ct-tip-score-hint {
    font-size: 0.66rem;
    font-weight: 400;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 1px;
}

.ct-tip-bar-wrap {
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px;
}

.ct-tip-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s ease;
    background: #10b981;
}

.ct-tip-bar-fill.warn {
    background: #f59e0b;
}

.ct-tip-bar-fill.danger {
    background: #ef4444;
}

.ct-tip-pct {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    margin-top: 4px;
}

.ct-tip-pct.warn {
    color: #b45309;
}

.ct-tip-pct.danger {
    color: #dc2626;
}

/* Shown when a reviewer confirmed the cell. Explains why the shield is green
   even though the per-run attempts below may disagree. */
.ct-tip-confirmed {
    margin-top: 8px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #15803d;
    white-space: normal;
    min-width: 260px;
}

.ct-tip-attempts {
    margin-top: 8px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 260px;
    white-space: normal;
}

.ct-tip-attempt-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
}

.ct-tip-attempt-label {
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
    width: 60px;
    flex-shrink: 0;
}

.ct-tip-attempt-bar {
    height: 5px !important;
    border-radius: 3px !important;
    margin-bottom: 0 !important;
}

.ct-tip-attempt-val {
    font-size: 0.7rem;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
}

.ct-tip-attempt-val.danger {
    color: #dc2626;
}

.ct-tip-attempt-raw {
    font-size: 0.65rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.ct-tip-attempt-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.ct-tip-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Per-row status column — pill badge */
.ct-row-status {
    text-align: center;
    vertical-align: middle;
    padding: 0.32rem 0.75rem;
    border-left: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ct-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ct-status-pill.ok {
    background: #dcfce7;
    color: #15803d;
}

.ct-status-pill.fail {
    background: #fee2e2;
    color: #b91c1c;
}

.ct-status-pill.warn {
    background: #fef9c3;
    color: #a16207;
}

/* ── Group status dot (one per part-number block) ─────────────────── */
.ct-group-status {
    text-align: center;
    vertical-align: middle;
}

.ct-group-status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    padding: 4px;
    border-radius: 999px;
    transition: background 0.12s;
}

.ct-group-status-dot:hover {
    background: rgba(59, 130, 246, 0.08);
}

.ct-group-status-ok    { color: #059669; }
.ct-group-status-fail  { color: #dc2626; }
.ct-group-status-warn  { color: #d97706; }

/* ── Floating tooltip for the group status dot ───────────────────── */
.ct-group-tooltip {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.07);
    min-width: 240px;
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.14s, transform 0.14s;
    font-size: 0.78rem;
    color: #334155;
    line-height: 1.45;
}

.ct-group-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.ct-gt-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    letter-spacing: 0.01em;
}

.ct-gt-block {
    margin-bottom: 8px;
}

.ct-gt-block:last-child {
    margin-bottom: 0;
}

.ct-gt-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.ct-gt-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 1px 0;
    font-size: 0.78rem;
}

.ct-gt-sub {
    color: #94a3b8;
    font-size: 0.72rem;
}

.ct-gt-ok     { color: #059669; font-weight: 700; }
.ct-gt-fail   { color: #dc2626; font-weight: 700; }
.ct-gt-warn   { color: #d97706; font-weight: 700; }
.ct-gt-neutral { color: #94a3b8; font-weight: 600; }

/* ── Aggregated cell (summed Qty / serial range) ─────────────────── */
.ct-val-agg {
    font-weight: 600;
}

.ct-agg-hint {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.78em;
    margin-left: 4px;
}

.ct-val-agg:hover .ct-agg-hint,
.ct-val-agg:focus-visible .ct-agg-hint {
    color: #64748b;
}

/* ── Page dropdown for aggregated cell-detail modal ── */
.cd-page-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.cd-page-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.cd-page-dropdown-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.cd-page-dropdown-arrow {
    flex-shrink: 0;
    color: #64748b;
    transition: transform 0.15s;
}

.cd-page-dropdown-btn[aria-expanded="true"] .cd-page-dropdown-arrow {
    transform: rotate(180deg);
}

.cd-pdo-count {
    color: #64748b;
    font-weight: 500;
    font-size: 0.7rem;
    border-left: 1px solid #cbd5e1;
    padding-left: 6px;
    margin-left: 2px;
}

.cd-page-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    min-width: 180px;
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5px;
}

.cd-pdo-option {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
}

.cd-pdo-option + .cd-pdo-option {
    margin-top: 3px;
}

.cd-pdo-option:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.cd-pdo-option-active {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border-color: #818cf8;
}

.cd-pdo-option-extracted {
    border-left: 3px solid #10b981;
}

.cd-pdo-ext-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    margin-left: auto;
}

.cd-pdo-idx {
    color: #475569;
    font-size: 0.74rem;
    font-weight: 800;
    min-width: 22px;
}

.cd-pdo-page {
    color: #2563eb;
    font-size: 0.73rem;
    font-weight: 700;
    background: #dbeafe;
    padding: 2px 7px;
    border-radius: 5px;
}

.cd-pdo-badge {
    font-size: 0.67rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cd-pdo-badge-br  { color: #1d4ed8; background: #dbeafe; border: 1px solid #93c5fd; }
.cd-pdo-badge-bl  { color: #065f46; background: #d1fae5; border: 1px solid #6ee7b7; }
.cd-pdo-badge-arc { color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; }
.cd-pdo-badge-sr  { color: #4b5563; background: #f3f4f6; border: 1px solid #d1d5db; }

.cell-detail-items-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.cell-detail-items-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.cell-detail-items-count {
    color: #64748b;
    font-size: 0.72rem;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 999px;
}

.cell-detail-items-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    flex: 1 1 auto;
    min-height: 0;
}

.cell-detail-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow: hidden;
}

.ct-agg-item-active {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%) !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 1px #818cf8 inset, 0 4px 12px rgba(99, 102, 241, 0.15);
}

.ct-agg-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ct-agg-item + .ct-agg-item {
    margin-top: 8px;
}

.ct-agg-item:hover,
.ct-agg-item:focus-visible {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
    outline: none;
}

.ct-agg-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e2e8f0;
}

.ct-agg-item-idx {
    font-weight: 800;
    color: #475569;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.ct-agg-item-page {
    font-size: 0.7rem;
    font-weight: 700;
    color: #2563eb;
    background: #dbeafe;
    padding: 2px 9px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.ct-agg-item-page-muted {
    color: #94a3b8;
    background: #f1f5f9;
}

.ct-agg-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ct-agg-kv {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    align-items: baseline;
}

.ct-agg-k {
    flex-shrink: 0;
    width: 32px;
    color: #475569;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    padding-top: 1px;
}

.ct-agg-v {
    color: #0f172a;
    font-weight: 700;
    word-break: break-word;
    letter-spacing: 0.01em;
}

/* SR badge — shown inline next to a serial value extracted from SR pages */
.ct-sr-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #7c3aed;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    border-radius: 4px;
    padding: 0 4px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1.5;
    pointer-events: none;
}

/* Highlight the button itself when its serial came from SR */
.ct-val-sr {
    color: #5b21b6;
}

/* Doc badge inside sidebar breakdown cards (SR / BR / BL / ARC) */
.ct-agg-item-doc-badge {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.ct-agg-item-doc-sr {
    color: #7c3aed;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
}

.ct-agg-item-doc-br {
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
}

.ct-agg-item-doc-bl {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}

.ct-agg-item-doc-arc {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

/* Legacy icon classes kept for safety */
.ct-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ct-icon-ok {
    color: #059669;
}

.ct-icon-fail {
    color: #dc2626;
}

.ct-icon-warn {
    color: #d97706;
}

/* Correction Success Banner */
.correction-success-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    animation: fadeIn 0.4s ease;
}

.success-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #a7f3d0;
    color: #065f46;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.success-text-content {
    display: flex;
    flex-direction: column;
}

.success-title {
    color: #064e3b;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 2px 0;
}

.success-desc {
    color: #065f46;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: slideInRight 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Summary section: full-page top-bar layout ── */
.summary-section .results-header {
    border-radius: 0;
    margin-bottom: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    overflow: visible;
    flex-shrink: 0;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    padding: 0 2.5rem;
}

.summary-section .results-header::before {
    display: none;
}
/* ── LLM unavailability warning banner ── */
.llm-warning-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: #fff7ed;
    border-bottom: 2px solid #f97316;
    color: #7c2d12;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 100;
    flex-shrink: 0;
}

.llm-warn-icon {
    font-size: 1.2rem;
    color: #f97316;
    flex-shrink: 0;
}

.llm-warn-text {
    flex: 1;
}

.llm-warn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9a3412;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
}
.llm-warn-close:hover { opacity: 1; background: rgba(249,115,22,0.1); }

/* ── Upload-screen LLM warning (inline, inside the upload card) ── */
.upload-llm-warning {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1rem 0;
    padding: 0.65rem 1rem;
    background: #fff7ed;
    border: 1.5px solid #f97316;
    border-radius: 8px;
    color: #7c2d12;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
}

.upload-llm-warning .llm-warn-icon {
    font-size: 1.1rem;
    color: #f97316;
    flex-shrink: 0;
}

.upload-llm-warning .llm-warn-text {
    flex: 1;
}

/* Analyze button locked when LLM is down */
#uploadBtn[data-llm-down="1"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.llm-warn-retry {
    flex-shrink: 0;
    background: none;
    border: 1.5px solid #f97316;
    color: #c2410c;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.llm-warn-retry:hover:not(:disabled) { background: rgba(249,115,22,0.1); }
.llm-warn-retry:disabled { opacity: 0.5; cursor: default; }
