:root {
    --green: #16714a;
    --green-dark: #0c3d28;
    --green-deeper: #081f15;
    --green-light: #e6f4ec;
    --green-glow: rgba(22,113,74,0.15);
    --red: #c0392b;
    --gold: #d4a843;
    --bg: #f0f2f5;
    --text: #1a1d23;
    --text-mid: #4a5060;
    --text-light: #6b7280;
    --border: #e2e5ea;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --radius: 14px;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════
   HERO BANNER
   ═══════════════════════════════════════════ */
.hero-banner {
    background: linear-gradient(160deg, var(--green-deeper) 0%, var(--green-dark) 40%, var(--green) 100%);
    color: var(--white);
    position: relative;
    overflow: hidden;
    padding-bottom: 3rem;
}

.hero-bg-suits {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    font-size: 6rem;
    opacity: 0.04;
    pointer-events: none;
    letter-spacing: 1rem;
    white-space: nowrap;
}

header {
    position: relative;
    z-index: 1;
    padding: 1.2rem 2rem 0;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}

.brand:hover { color: rgba(255,255,255,0.8); }

.brand-name {
    font-weight: 600;
}

.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 2rem 0;
    max-width: 560px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════ */
main {
    flex: 1;
    width: 100%;
}

.page-container {
    max-width: 480px;
    margin: -1.5rem auto 2rem;
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.card h2 {
    font-size: 1.1rem;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--green-light);
    font-weight: 600;
}

.upload-card {
    border: 1px solid rgba(0,0,0,0.06);
}

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    color: var(--text);
}

input[type="text"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px var(--green-glow);
}

.form-group { margin-bottom: 1.4rem; }

.player-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.player-fields .form-group { margin-bottom: 0.6rem; }

.player-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-mid);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.player-fields input[type="text"] {
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

/* ═══════════════════════════════════════════
   MODEL TOGGLE
   ═══════════════════════════════════════════ */

.model-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.model-toggle input[type="radio"] {
    display: none;
}

.model-toggle .toggle-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.7rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--white);
}

.model-toggle .toggle-option:hover {
    border-color: var(--green);
    background: var(--green-light);
}

.model-toggle input[type="radio"]:checked + .toggle-option {
    border-color: var(--green);
    background: var(--green-light);
    box-shadow: 0 0 0 3px var(--green-glow);
}

.model-toggle .toggle-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.model-toggle .toggle-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}

/* ═══════════════════════════════════════════
   FILE DROP ZONE
   ═══════════════════════════════════════════ */
.file-drop {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2.2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--green);
    background: var(--green-light);
}

.file-drop.has-file {
    border-color: var(--green);
    border-style: solid;
    background: var(--green-light);
}

.file-drop input[type="file"] {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.file-drop-icon {
    color: var(--text-light);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.file-drop:hover .file-drop-icon,
.file-drop.dragover .file-drop-icon { color: var(--green); }

.file-drop-ok { color: var(--green) !important; }

.file-drop-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.file-drop-formats {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    text-align: center;
}

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

.btn-primary {
    background: var(--green);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--green-dark);
    box-shadow: 0 4px 14px rgba(22,113,74,0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 500;
}
.btn-secondary:hover { background: #d0ecd8; }

.btn-download {
    background: var(--green);
    color: var(--white);
    font-size: 1.05rem;
    padding: 1rem 2.5rem;
    font-weight: 600;
    border-radius: 12px;
}

.btn-download:hover {
    background: var(--green-dark);
    box-shadow: 0 4px 14px rgba(22,113,74,0.35);
    transform: translateY(-1px);
}

.btn-full {
    display: flex;
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
}

/* ═══════════════════════════════════════════
   FEATURES
   ═══════════════════════════════════════════ */
.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    padding: 0 0.5rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green);
}

.feature strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.feature span {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ═══════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════ */
.flash-messages { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.flash.error {
    background: #fef2f2;
    color: var(--red);
    border: 1px solid #fecaca;
}

.flash.success {
    background: var(--green-light);
    color: var(--green-dark);
    border: 1px solid #b8dfc6;
}

/* ═══════════════════════════════════════════
   BETA NOTE
   ═══════════════════════════════════════════ */
.beta-note {
    margin-top: 1.5rem;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    font-size: 0.76rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════
   PROCESSING OVERLAY
   ═══════════════════════════════════════════ */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--green-light);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.processing-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.processing-overlay.active { display: flex; }

.processing-card {
    background: var(--white);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-width: 380px;
    width: 90%;
}

.processing-overlay .message {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.5rem;
}

.processing-overlay .sub {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.progress-bar {
    margin-top: 1.5rem;
    height: 3px;
    background: var(--green-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    animation: progress-indeterminate 2s ease-in-out infinite;
    width: 30%;
}

@keyframes progress-indeterminate {
    0% { margin-left: 0; }
    50% { margin-left: 70%; }
    100% { margin-left: 0; }
}

/* ═══════════════════════════════════════════
   PDF PREVIEW
   ═══════════════════════════════════════════ */
.page-container--wide {
    max-width: 1100px;
}

.preview-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.pdf-viewer {
    width: 100%;
    height: 85vh;
    border: none;
    border-radius: var(--radius);
    display: block;
}

/* PDF canvas rendering (pdf.js) */
.pdf-page-wrapper {
    position: relative;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    gap: 1rem;
    color: var(--text-light);
}

/* Selection overlay */
.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.selection-rect {
    position: absolute;
    border: 2px solid var(--red);
    background: rgba(192, 57, 43, 0.15);
    pointer-events: none;
    z-index: 5;
}

.selection-hint {
    padding: 0.5rem 0.8rem;
    background: #fff8e6;
    border: 1px solid var(--gold);
    border-radius: 8px;
    font-size: 0.82rem;
    color: #92700c;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* Screenshot preview in feedback panel */
.screenshot-preview {
    margin-top: 0.75rem;
    position: relative;
    display: none;
}

.screenshot-preview.has-screenshot {
    display: inline-block;
}

.screenshot-preview img {
    max-width: 100%;
    max-height: 150px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.screenshot-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.btn-outline-warn {
    background: #fef9ee;
    color: #92700c;
    border: 1.5px solid var(--gold);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.65rem 1.2rem;
}

.btn-outline-warn:hover {
    background: #fdf0d5;
    color: #6b5009;
}

/* Feedback panel */
.feedback-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.feedback-panel.open {
    max-height: 600px;
    margin-top: 1.2rem;
}

.feedback-panel .card {
    padding: 1.5rem;
}

.feedback-panel textarea {
    resize: vertical;
    min-height: 80px;
}

.feedback-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.feedback-confirm {
    display: none;
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: var(--green-light);
    color: var(--green-dark);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   RESULT / ERROR PAGES
   ═══════════════════════════════════════════ */
.success-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.15em;
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.error-detail {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    background: var(--white);
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.footer-brand {
    font-weight: 600;
    color: var(--text-mid);
    font-size: 0.85rem;
}

.footer-suits {
    letter-spacing: 0.2em;
    opacity: 0.35;
    margin-right: 0.4rem;
}

.footer-links {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════
   KEPT FOR EPBOT/DDS (hidden)
   ═══════════════════════════════════════════ */
.suit-red { color: #ff8a80; }
.suit-black { color: rgba(255,255,255,0.75); }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.htmx-indicator { display: none; text-align: center; padding: 2rem; color: var(--green-dark); }
.htmx-request .htmx-indicator { display: block; }
.htmx-request.htmx-indicator { display: block; }

.compass-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto auto; gap: 1rem; margin-bottom: 1.5rem; }
.compass-north { grid-column: 2; grid-row: 1; }
.compass-west { grid-column: 1; grid-row: 2; }
.compass-center { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; }
.compass-east { grid-column: 3; grid-row: 2; }
.compass-south { grid-column: 2; grid-row: 3; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.7rem; }
    .hero p { font-size: 0.95rem; }
    .hero { padding: 1.5rem 1.5rem 0; }
    .hero-banner { padding-bottom: 2rem; }
    .card { padding: 1.5rem; }
    .features { flex-direction: column; gap: 1rem; align-items: center; }
    .two-col { grid-template-columns: 1fr; }
    .compass-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
    .compass-north, .compass-south, .compass-west, .compass-east { grid-column: 1; grid-row: auto; }
    .compass-center { display: none; }
    .processing-card { padding: 2rem; }
    .pdf-viewer { height: 60vh; }
    .preview-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
    header { padding: 0.8rem 1rem 0; }
    .hero h1 { font-size: 1.4rem; }
    .hero-bg-suits { font-size: 4rem; gap: 1.5rem; }
    .page-container { padding: 0 0.5rem; }
    .card { padding: 1.2rem; border-radius: 12px; }
    .features { gap: 0.75rem; }
}

/* ═══════════════════════════════════════════
   EDIT MODE
   ═══════════════════════════════════════════ */
.btn-edit {
    background: #f0f7ff;
    color: #1a56db;
    border: 1.5px solid #93b4f0;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.65rem 1.2rem;
}
.btn-edit:hover { background: #dbeafe; color: #1e40af; }
.btn-edit.active { background: #1a56db; color: #fff; border-color: #1a56db; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

.edit-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.edit-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f0f7ff;
    border-bottom: 1px solid #93b4f0;
    flex-wrap: wrap;
}

.edit-status {
    flex: 1;
    font-size: 0.85rem;
    color: #1a56db;
    font-weight: 500;
    min-width: 200px;
}

.edit-iframe {
    width: 100%;
    height: 82vh;
    border: none;
    display: block;
}

/* Edit popup overlay */
.edit-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-popup {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
}

.edit-popup h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--green-dark);
    font-weight: 600;
}

.edit-popup-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* Lead character editor */
.lead-chars {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.lead-char-btn {
    width: 38px;
    height: 38px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background: var(--white);
}
.lead-char-btn:hover { border-color: var(--green); }
.lead-char-btn.bold {
    font-weight: bold;
    background: #e8f5e9;
    border-color: #4caf50;
}
.lead-char-btn.underline {
    text-decoration: underline;
    background: #fff3e0;
    border-color: #ff9800;
}

.lead-legend {
    font-size: 0.78rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.edit-saving .edit-status::after {
    content: " Enregistrement...";
    animation: pulse 1s ease infinite;
}
@keyframes pulse { 50% { opacity: 0.5; } }

/* Click-to-edit hint on PDF */
.click-to-edit-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s;
    z-index: 5;
}
.preview-container { position: relative; }
.preview-container:hover .click-to-edit-hint { opacity: 1; }

/* Contenteditable field editor */
.field-editor {
    width: 100%;
    min-height: 3.5em;
    max-height: 12em;
    overflow-y: auto;
    font-size: 0.95rem;
    padding: 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text);
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}
.field-editor:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 2px var(--green-glow);
}

/* Symbol insertion buttons */
.field-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}
.field-symbols button {
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s;
}
.field-symbols button:hover {
    background: var(--green-light);
    border-color: var(--green);
}

/* ═══════════════════════════════════════════
   DIAGNOSTIC POPUP
   ═══════════════════════════════════════════ */
.diag-context {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.diag-field-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--green-dark);
    margin-bottom: 0.75rem;
    text-align: center;
}

.diag-comparison {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.diag-before, .diag-after {
    flex: 1;
    min-width: 0;
}

.diag-before small, .diag-after small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.diag-value {
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
    min-height: 2em;
}

.diag-before .diag-value {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.diag-after .diag-value {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.diag-arrow {
    display: flex;
    align-items: center;
    font-size: 1.3rem;
    color: var(--text-light);
    padding-top: 1.2rem;
    flex-shrink: 0;
}

.diag-question {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    margin-bottom: 1rem;
}

.diag-screenshot-preview {
    position: relative;
    display: none;
    text-align: center;
    margin-bottom: 0.75rem;
}

.diag-screenshot-preview.has-screenshot {
    display: block;
}

.diag-screenshot-preview img {
    max-width: 100%;
    max-height: 160px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* ═══════════════════════════════════════════
   TWO-COLUMN EDIT POPUP (editor + source PDF)
   ═══════════════════════════════════════════ */
.edit-popup--wide {
    max-width: 1100px;
    width: 95%;
}

.edit-popup-split {
    display: flex;
    gap: 1.5rem;
}

.edit-popup-left {
    flex: 1;
    min-width: 0;
}

.edit-popup-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.source-popup-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 0.25rem;
}

.source-in-popup {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    background: #fafbfc;
}

.source-popup-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.source-thumb {
    position: relative;
    display: inline-block;
}

.source-thumb img {
    max-height: 80px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.source-thumb .screenshot-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 18px;
    padding: 0;
}

.field-editor-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    text-align: right;
}

.field-editor-hint kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.7rem;
    font-family: inherit;
}

@media (max-width: 768px) {
    .edit-popup--wide {
        width: 95%;
        max-width: none;
    }
    .edit-popup-split {
        flex-direction: column;
        gap: 1rem;
    }
    .source-in-popup {
        max-height: 30vh;
    }
}
