/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #252830;
    --bg-card: #1e2028;
    --text-primary: #e4e6eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --border: #2d3140;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

h1, h2, h3 { font-weight: 600; }
h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
h3 { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; color: var(--text-secondary); }

/* ── Header ────────────────────────────────────────────────── */
#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.health-dot.healthy { background: var(--success); box-shadow: 0 0 6px var(--success); }
.health-dot.unhealthy { background: var(--warning); }
.health-dot.offline { background: var(--text-muted); }

.api-key-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-group input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.3rem 2rem 0.3rem 0.5rem;
    font-size: 0.8rem;
    width: 140px;
    outline: none;
}
.api-key-group input:focus { border-color: var(--accent); }
.api-key-group input.error { border-color: var(--danger); }

#toggle-key-vis {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px;
}

/* ── Main Layout ───────────────────────────────────────────── */
#app-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
}

#upload-panel { grid-column: 1; grid-row: 1; }
#results-panel { grid-column: 2; grid-row: 1; }
#stats-panel { grid-column: 1 / -1; grid-row: 2; }
#history-panel { grid-column: 1 / -1; grid-row: 3; }

@media (max-width: 900px) {
    #app-main {
        grid-template-columns: 1fr;
    }
    #upload-panel, #results-panel, #stats-panel, #history-panel {
        grid-column: 1;
        grid-row: auto;
    }
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    padding: 0.45rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

/* ── Document Type Selector ────────────────────────────────── */
.doc-type-selector {
    margin-bottom: 1rem;
}
.doc-type-selector label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.doc-type-selector select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}
.doc-type-selector select:focus { border-color: var(--accent); }

/* ── Upload Groups ────────────────────────────────────────── */
.upload-group {
    margin-bottom: 0.75rem;
}
.upload-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.upload-label .required { color: var(--danger); }

.btn-full { width: 100%; margin-top: 0.5rem; }

/* ── Drop Zone ─────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.drop-zone:hover, .drop-zone:focus-visible {
    border-color: var(--accent);
    outline: none;
}
.drop-zone.drag-active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}
.drop-zone-small { padding: 1rem; }
.drop-zone-small .drop-icon { font-size: 1.2rem; margin-bottom: 0.25rem; }

.drop-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.drop-zone-content p { margin: 0.2rem 0; }

/* Drop zone preview (after file selected) */
.drop-zone-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem;
}
.preview-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}
.preview-name {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}
.btn-remove:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.75rem;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ── Results ───────────────────────────────────────────────── */
#results-content { min-height: 200px; }

#image-preview-container {
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-tertiary);
    text-align: center;
}
#image-preview {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

#fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
#fields-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
#fields-table td:first-child {
    color: var(--text-muted);
    width: 140px;
    font-size: 0.8rem;
    text-transform: uppercase;
}
#fields-table td:last-child {
    font-family: var(--font-mono);
    color: var(--text-primary);
}
.field-missing { color: var(--text-muted) !important; font-style: italic; }

/* ── Overall Result Banner ─────────────────────────────────── */
.overall-result-banner {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}
.overall-result-banner .result-icon { margin-right: 0.4rem; }
.result-pass { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.result-fail { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.result-inconclusive { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }

/* ── Extraction Info ──────────────────────────────────────── */
.extraction-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.info-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.info-tag.method { color: var(--accent); border-color: rgba(59, 130, 246, 0.3); }

/* ── Checks ───────────────────────────────────────────────── */
#checks-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.validation-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}
.validation-check.pass { background: var(--success-bg); color: var(--success); }
.validation-check.fail { background: var(--danger-bg); color: var(--danger); }
.validation-check.na { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); }

/* ── Confidence Bars ───────────────────────────────────────── */
#confidence-section { display: flex; flex-direction: column; gap: 0.4rem; }

.confidence-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.confidence-label {
    width: 110px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.confidence-bar {
    flex: 1;
    height: 18px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.confidence-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    min-width: 30px;
}
.confidence-fill.high { background: var(--success); }
.confidence-fill.medium { background: var(--warning); }
.confidence-fill.low { background: var(--danger); }

/* ── Raw Text & Machine Data ──────────────────────────────── */
#raw-text-section,
#machine-data-section {
    margin-top: 1rem;
    font-size: 0.8rem;
}
#raw-text-section summary,
#machine-data-section summary {
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.3rem 0;
}
#raw-text-content,
#machine-data-content {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
#machine-data-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error State ───────────────────────────────────────────── */
.error-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--danger);
}

#results-error {
    text-align: center;
    padding: 2rem 1rem;
}
#results-error p { color: var(--danger); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* ── Statistics ────────────────────────────────────────────── */
#stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    text-align: center;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.15rem;
}

#field-rates {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* ── History ───────────────────────────────────────────────── */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.history-header h2 { margin-bottom: 0; }
.history-actions { display: flex; gap: 0.5rem; }

#history-table-wrapper { overflow-x: auto; }

#history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
#history-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
#history-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}
#history-table tr:hover td { background: var(--bg-tertiary); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

.btn-view {
    background: none;
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    cursor: pointer;
}
.btn-view:hover { background: var(--bg-tertiary); }

/* ── Toast Notifications ───────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
}
.toast {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.25s ease;
    max-width: 340px;
}
.toast.info { background: var(--bg-tertiary); color: var(--text-primary); border-left: 3px solid var(--accent); }
.toast.success { background: var(--bg-tertiary); color: var(--success); border-left: 3px solid var(--success); }
.toast.error { background: var(--bg-tertiary); color: var(--danger); border-left: 3px solid var(--danger); }
.toast.warning { background: var(--bg-tertiary); color: var(--warning); border-left: 3px solid var(--warning); }

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

/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.75rem; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Camera Modal ─────────────────────────────────────────── */
.camera-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.camera-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.camera-modal-container {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.camera-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.camera-modal-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.camera-modal-body {
    padding: 0;
    background: #000;
}

.camera-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    overflow: hidden;
}

#camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.camera-modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.btn-camera {
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Scan status bar */
.camera-scan-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.8rem;
    color: var(--accent);
}

.scan-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: scanPulse 1.2s ease-in-out infinite;
}

@keyframes scanPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

#camera-video.scanning {
    box-shadow: inset 0 0 0 3px var(--accent);
}

/* ── Camera scan guide overlay ──────────────────────────────── */
.camera-scan-guide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    background:
        linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.45) 30%,
            transparent 30%, transparent 70%,
            rgba(0,0,0,0.45) 70%, rgba(0,0,0,0.45) 100%);
}

.scan-guide-rect {
    position: relative;
    width: 60%;
    height: 40%;
    border: 2px solid rgba(59, 130, 246, 0.6);
    border-radius: 8px;
}

.scan-guide-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--accent);
    border-style: solid;
    border-width: 0;
}
.scan-guide-corner.tl { top: -2px; left: -2px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 8px; }
.scan-guide-corner.tr { top: -2px; right: -2px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 8px; }
.scan-guide-corner.bl { bottom: -2px; left: -2px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 8px; }
.scan-guide-corner.br { bottom: -2px; right: -2px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 8px; }

.scan-guide-label {
    margin-top: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    text-align: center;
}

@keyframes scanLine {
    0% { top: 0; }
    100% { top: calc(100% - 2px); }
}
.scan-guide-rect::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    height: 2px;
    background: var(--accent);
    opacity: 0.5;
    border-radius: 1px;
    animation: scanLine 2s ease-in-out infinite alternate;
}

.btn-scanning {
    background: var(--danger) !important;
}
.btn-scanning:hover:not(:disabled) {
    background: #dc2626 !important;
}

@media (max-width: 640px) {
    .camera-modal {
        padding: 0;
    }
    .camera-modal-container {
        max-width: 100%;
        border-radius: 0;
        height: 100%;
        max-height: 100vh;
    }
    .camera-video-wrapper {
        aspect-ratio: auto;
        flex: 1;
    }
    .camera-modal-body {
        flex: 1;
        display: flex;
    }
    .camera-modal-footer {
        padding: 1rem;
    }
    .camera-modal-footer .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* ── Serial Number Results ─────────────────────────────────── */
#serial-crop-container {
    margin-bottom: 1rem;
    text-align: center;
}

#serial-crop-preview {
    max-width: 100%;
    max-height: 120px;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

#serial-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#serial-fields-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

#serial-fields-table td:first-child {
    color: var(--text-muted);
    width: 140px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

#serial-fields-table td:last-child {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

#serial-validation-section {
    margin-top: 1rem;
}

#serial-validation-content {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.6rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Failure guidance box */
.serial-fail-guidance {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.serial-fail-guidance ul {
    margin: 0;
    padding-left: 1.2rem;
}
.serial-fail-guidance li {
    margin-bottom: 0.25rem;
}
.serial-fail-guidance li:last-child {
    margin-bottom: 0;
}

/* Validation pills */
.validation-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
}
.pill-pass {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.pill-fail {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}
.pill-info {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}
.pill-warn {
    background: rgba(234, 179, 8, 0.15);
    color: #b45309;
}

/* Confidence color coding */
.confidence-high {
    color: #16a34a;
    font-weight: 600;
}
.confidence-medium {
    color: #b45309;
    font-weight: 600;
}
.confidence-low {
    color: #dc2626;
    font-weight: 600;
}
