/* HLBK Form Digitizer styles */

:root {
    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

    /* Colors — Forest Palette */
    --color-bg: #ece8df;
    --color-surface: #faf8f5;
    --color-surface-alt: #f4f1eb;
    --color-surface-hover: #eceae3;

    --color-text: #2a2824;
    --color-text-secondary: #5c5850;
    --color-text-muted: #8c8880;

    --color-accent: #2d6a4f;
    --color-accent-hover: #1b5038;
    --color-accent-light: #dceee4;

    --color-amber: #b8860b;
    --color-amber-light: #faf0d8;

    --color-border: #dad5cb;
    --color-border-hover: #c2bcb0;

    --color-header-bg: #1a1f1c;
    --color-header-text: #f2f0eb;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(44, 42, 36, 0.05);
    --shadow-sm: 0 2px 4px rgba(44, 42, 36, 0.05), 0 1px 2px rgba(44, 42, 36, 0.03);
    --shadow-md: 0 4px 14px rgba(44, 42, 36, 0.07), 0 2px 4px rgba(44, 42, 36, 0.04);
    --shadow-lg: 0 8px 28px rgba(44, 42, 36, 0.1), 0 4px 8px rgba(44, 42, 36, 0.05);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 20px;
    background-color: var(--color-bg);
    min-height: 100vh;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 1.8rem;
    margin: 0;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Drop Zone Styles */
#drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    text-align: center;
    background: var(--color-surface-alt);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#drop-zone .drop-zone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    background: var(--color-accent-light);
    border-radius: 50%;
    color: var(--color-accent);
    margin-bottom: 20px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#drop-zone p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    pointer-events: none;
}

#drop-zone .hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
    font-weight: 400;
}

#drop-zone.drag-over {
    border-color: var(--color-accent);
    border-style: solid;
    background: var(--color-accent-light);
    transform: scale(1.01);
}

#drop-zone.drag-over .drop-zone-icon {
    background: var(--color-accent);
    color: white;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.3);
}

#drop-zone:hover {
    border-color: var(--color-border-hover);
    background: var(--color-surface-hover);
}

#drop-zone:hover .drop-zone-icon {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.15);
}

/* Progress Indicator */
#progress {
    text-align: center;
    padding: 60px 40px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#progress span {
    display: block;
    color: #666;
    font-size: 1.2rem;
    margin-top: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #4a90d9;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

.progress-bar {
    width: 200px;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin: 20px auto 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #4a90d9;
    border-radius: 4px;
    width: 0%;
    transition: width 0.2s ease;
}

.progress-percent {
    font-size: 0.9rem;
    color: #999;
    margin-top: 5px;
}

/* Error Styles */
#error {
    background-color: #fff0f0;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    padding: 20px;
    color: #c0392b;
    text-align: center;
    margin-bottom: 20px;
}

/* Image Viewer */
#image-viewer {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-image-panel .zoom-controls button {
    width: 30px;
    height: 30px;
    border: 1px solid #444;
    border-radius: 5px;
    background: #2a2f2c;
    color: #a8a49c;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.review-image-panel .zoom-controls button:hover {
    background: #3a3f3c;
    border-color: #555;
    color: #ddd;
}

.review-image-panel .zoom-controls button:active {
    background: #1a1f1c;
}

.review-image-panel #zoom-reset {
    width: auto;
    padding: 0 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.review-image-panel #zoom-level {
    font-size: 0.75rem;
    color: #777;
    min-width: 44px;
    text-align: center;
}

/* Non-review zoom controls (upload page) */
#image-viewer .zoom-controls {
    padding: 15px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    justify-content: center;
}

#image-viewer .zoom-controls button {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

#zoom-level {
    font-size: 0.9rem;
    color: #666;
    min-width: 50px;
    text-align: center;
}

#image-container {
    position: relative;
    overflow: hidden;
    height: 70vh;
    background-color: #e8e8e8;
    cursor: grab;
}

#image-container.panning {
    cursor: grabbing;
}

/* Upload page: image inside #image-container */
#image-container #form-image {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none;
    max-height: none;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

/* Review page: image inside .image-viewport */
.image-viewport #form-image {
    height: 100%;
    width: auto;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
}

/* New Upload Button (shown after image loaded) */
#new-upload {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    background-color: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    z-index: 10;
}

#new-upload:hover {
    background-color: #357abd;
}

/* Species Autocomplete */
.species-input-container {
    position: relative;
    width: 100%;
}

.species-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-surface);
}

.species-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.15);
}

.species-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.species-dropdown.visible {
    display: block;
}

.species-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.species-option:last-child {
    border-bottom: none;
}

.species-option:hover,
.species-option.highlighted {
    background: #f5f5f5;
}

.species-option .scientific {
    font-style: italic;
    color: #333;
}

.species-option .german {
    color: #666;
    font-size: 12px;
    margin-left: 8px;
}

.species-option .match-type {
    float: right;
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
}

.species-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #2196F3;
    border-radius: 4px;
}

.species-selected .name {
    flex: 1;
    font-style: italic;
}

.species-selected .clear-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.species-selected .clear-btn:hover {
    color: #f44336;
}

.species-no-results {
    padding: 12px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* Species Test Section */
.species-test {
    margin-top: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.species-test h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
}

/* ============================================
   REVIEW LAYOUT
   ============================================ */

body:has(.review-container) {
    padding: 0;
    background: var(--color-bg);
}

.review-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-body);
}

.review-image-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    background: #1a1f1c;
    overflow: hidden;
}

.review-data-panel {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--color-bg);
}

/* Unified header bar */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.review-image-panel .panel-header {
    background: #232826;
    border-bottom: 1px solid #333;
}

.review-image-panel .panel-header h2 {
    color: #a8a49c;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 500;
}

.review-data-panel .panel-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}

.panel-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.3px;
}

.image-viewport {
    flex: 1;
    overflow: hidden;
    cursor: grab;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewport:active {
    cursor: grabbing;
}

/* Data Sections */
.data-sections {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    align-content: start;
}

.data-sections::-webkit-scrollbar {
    width: 6px;
}

.data-sections::-webkit-scrollbar-track {
    background: transparent;
}

.data-sections::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.data-sections::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

.data-section {
    margin-bottom: 0;
    align-self: start;
}

.section-header {
    background: linear-gradient(to right, var(--color-surface-alt), var(--color-surface));
    padding: 7px 12px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header-label {
    flex: 0 0 auto;
}

.section-header-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--color-accent);
}

.section-header-text {
    flex: 1;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    font-family: var(--font-body);
    font-size: 0.82rem;
    max-width: 300px;
    transition: border-color var(--transition);
}

.section-header-text:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.section-content {
    padding: 0;
}

/* Field Rows */
.field-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.field-row:last-child {
    border-bottom: none;
}

.field-label {
    flex: 0 0 140px;
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    padding-top: 6px;
}

.field-value {
    flex: 1;
    padding: 5px 10px;
    border-radius: 4px;
    min-height: 30px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--color-text);
    transition: all var(--transition);
}

/* Confidence Highlighting — refined, no !important */
.confidence-high {
    background: #edf7ef;
    border-color: #b8d8be;
    border-left: 3px solid var(--color-accent);
}

.confidence-medium {
    background: var(--color-amber-light);
    border-color: #e0cc9a;
    border-left: 3px solid var(--color-amber);
}

.confidence-low {
    background: #fdf0f0;
    border-color: #e8bcbc;
    border-left: 3px solid #c0392b;
}

/* Confidence on field-area containers → style their inputs */
.field-area.confidence-high input,
.field-area.confidence-high textarea {
    background: #edf7ef;
    border-color: #b8d8be;
    border-left: 3px solid var(--color-accent);
}

.field-area.confidence-medium input,
.field-area.confidence-medium textarea {
    background: var(--color-amber-light);
    border-color: #e0cc9a;
    border-left: 3px solid var(--color-amber);
}

.field-area.confidence-low input,
.field-area.confidence-low textarea {
    background: #fdf0f0;
    border-color: #e8bcbc;
    border-left: 3px solid #c0392b;
}

/* Validation Errors (REV-3) */
.field-error {
    color: #d32f2f;
    font-size: 12px;
    margin-top: 4px;
}

.validation-summary {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    background: #fff3e0;
    border-bottom: 1px solid #ddd;
}
.validation-summary .error-count {
    color: #d32f2f;
}

.validation-summary .warning-count {
    color: #f57c00;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px;
    padding: 6px;
}

/* Dynamic grid dimensions via data attributes */
.checkbox-grid[data-columns] {
    grid-template-columns: repeat(var(--cols, 3), 1fr);
}

.checkbox-grid[data-rows] {
    grid-auto-flow: column;
    grid-template-rows: repeat(var(--rows, auto), auto);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--color-text);
    transition: background var(--transition);
}

/* Empty checkbox slot for grid positioning */
.checkbox-empty {
    padding: 0;
    min-height: 1px;
}

.checkbox-item.checked {
    background: var(--color-accent-light);
}

.checkbox-item label {
    flex: 1;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    accent-color: var(--color-accent);
}

/* Score/percentage text input within checkbox grid */
.checkbox-item.checkbox-value-input label {
    flex: 1;
    white-space: nowrap;
}

.checkbox-value-field {
    width: 36px;
    height: 16px;
    text-align: center;
    padding: 0 3px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: 0.75rem;
    line-height: 16px;
    box-sizing: border-box;
}

.value-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 1px 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Species List */
.species-table {
    width: 100%;
    border-collapse: collapse;
}

.species-table th,
.species-table td {
    padding: 6px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.82rem;
}

.species-table th {
    background: var(--color-surface-alt);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-secondary);
}

/* Empty add-row at bottom of species tables */
.species-table tr.add-row {
    border-top: 1px dashed var(--color-border);
}

.species-table tr.add-row td {
    opacity: 0.6;
    transition: opacity var(--transition);
}

.species-table tr.add-row:hover td,
.species-table tr.add-row:focus-within td {
    opacity: 1;
}

.species-table tr.add-row .species-input::placeholder {
    font-style: italic;
    color: var(--color-text-muted);
}

/* Waldbild Strukturen - 3x3 grid */
/* Compass rose for Exposition */
.compass-wrapper {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.compass-rose {
    width: 160px;
    height: 160px;
    cursor: pointer;
}

.compass-segment {
    fill: var(--color-surface);
    stroke: var(--color-border);
    stroke-width: 1.5;
    transition: fill 0.15s;
}

.compass-segment:hover {
    fill: var(--color-surface-alt);
}

.compass-segment.active {
    fill: var(--color-accent);
    stroke: var(--color-accent-dark, #1a5c3a);
}

.compass-segment.active:hover {
    fill: var(--color-accent-dark, #1a5c3a);
}

.compass-label {
    font-size: 11px;
    font-family: var(--font-body);
    font-weight: 600;
    fill: var(--color-text);
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}


.compass-center {
    fill: var(--color-surface);
    stroke: var(--color-border);
    stroke-width: 1;
}

/* Vegetation autocomplete */
.vegetation-autocomplete-wrapper {
    flex: 1;
    position: relative;
}

.vegetation-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--color-surface);
    box-sizing: border-box;
}

.vegetation-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(39, 103, 73, 0.15);
}

.vegetation-dropdown {
    position: fixed;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    z-index: 10000;
    max-height: 240px;
    overflow-y: auto;
}

.vegetation-option {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--color-border-light, #eee);
}

.vegetation-option:last-child {
    border-bottom: none;
}

.vegetation-option:hover {
    background: var(--color-surface-alt);
}

.veg-latin {
    font-style: italic;
    font-weight: 500;
    color: var(--color-text);
}

.veg-german {
    font-size: 0.8rem;
    color: var(--color-text-muted, #666);
}

.waldbild-grid {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.waldbild-grid td {
    border: 1px solid var(--color-border);
    padding: 6px 8px;
    text-align: center;
    background: var(--color-surface);
    min-width: 55px;
    font-size: 0.82rem;
}

.waldbild-grid td:focus {
    background: #fff;
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

/* Unknown waldbild code indicator */
.waldbild-grid td.waldbild-unknown,
.waldbild-grid td.confidence-low {
    background: #fff3cd !important;
    border-color: #e0a800 !important;
    color: #856404;
}

/* Habitat code tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 400;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--color-border);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    color: var(--color-text);
}

/* ============================================
   INLINE EDITING (REV-2)
   ============================================ */

.field-value.editable {
    cursor: text;
    transition: all var(--transition);
}

.field-value.editable:hover {
    border-color: var(--color-border-hover);
    background: var(--color-surface);
}

.field-value.editing {
    outline: none;
    background: #fff;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

/* Checkbox editing */
.checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-item:hover {
    background-color: rgba(45, 106, 79, 0.04);
}

/* Species row editing */
.species-table td.editable {
    cursor: text;
}

.species-table td:focus {
    outline: none;
    background-color: #fff;
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

/* Species autocomplete in table cells */
.species-name-cell {
    position: relative;
    min-width: 250px;
}

/* Editable species name that was auto-corrected */
.species-name-cell.corrected {
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
}

.species-name-cell.corrected:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.species-autocomplete-wrapper {
    width: 100%;
}

.species-autocomplete-wrapper .species-input-container {
    width: 100%;
}

.species-autocomplete-wrapper .species-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 13px;
    font-style: italic;
}

.species-autocomplete-wrapper .species-dropdown {
    min-width: 300px;
    max-height: 200px;
    left: 0;
    z-index: 1000;
    position: fixed;
}

.species-autocomplete-wrapper .species-selected {
    padding: 4px 8px;
    font-size: 13px;
}

.species-autocomplete-wrapper .species-selected .name {
    font-style: italic;
}

/* ============================================
   BATCH NAVIGATION (BAT-2, BAT-3)
   ============================================ */

.batch-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

#progress-indicator {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-text);
}

.btn-nav {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.btn-nav:hover:not(:disabled) {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    color: var(--color-text);
}

.btn-nav:disabled {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border-color: var(--color-border);
    cursor: not-allowed;
}

/* ============================================
   TOAST NOTIFICATIONS (EXP-4)
   ============================================ */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

/* ============================================
   MATCH STATISTICS (11-01)
   ============================================ */

.match-statistics {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 0 16px 1rem 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid #ddd;
}
.match-statistics .stat-matched {
    font-weight: 600;
}

.match-statistics .stat-breakdown {
    display: flex;
    gap: 0.75rem;
}

/* Match confidence colors */
.match-statistics .high { color: #28a745; }
.match-statistics .medium { color: #f57c00; }
.match-statistics .low { color: #dc3545; }

/* ============================================
   DATABASE SAVE CONTROLS (11-01)
   ============================================ */

.save-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #e9ecef;
    border-radius: 4px;
    margin: 0 16px 1rem 16px;
    flex-wrap: wrap;
}
.save-controls .select-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-controls select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    min-width: 150px;
}

.save-controls label {
    font-size: 0.875rem;
    color: #495057;
}

.save-result {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 0 16px 1rem 16px;
    border: 1px solid;
}

.save-result.success,
.match-badge.exact {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.save-result.error,
.match-badge.low {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ============================================
   SPECIES MATCH INDICATORS (11-01)
   ============================================ */

/* Row confidence styling */
.species-table tr.match-high { border-left: 3px solid #28a745; }
.species-table tr.match-medium { border-left: 3px solid #f57c00; }
.species-table tr.match-low { border-left: 3px solid #dc3545; }


/* Match indicator badge */
.match-indicator-cell {
    text-align: center;
    vertical-align: middle;
}

.match-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.match-badge.fuzzy {
    background: #fff3cd;
    color: #856404;
}

.match-badge.none {
    background: #e2e3e5;
    color: #383d41;
}
/* Text input styling */
input[type="text"],
input[type="date"],
input[type="number"],
textarea {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--color-text);
    transition: all var(--transition);
    width: 100%;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

input[type="text"]:hover,
input[type="date"]:hover,
input[type="number"]:hover,
textarea:hover {
    border-color: var(--color-border-hover);
}

textarea {
    resize: vertical;
}

/* Grid layout styles */
.page-grid,
.area-row,
.grid-content {
    display: grid;
    grid-auto-rows: min-content;
}

.area-stack {
    display: flex;
    flex-direction: column;
}

.area-row-stretch .area-stack > * {
    flex: 1;
}

.area-row-stretch > * {
    align-self: stretch;
}

/* Field area - vertical label + input */
.field-area {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-area .field-label {
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    flex: 0 0 auto;
}

.field-area input,
.field-area textarea {
    padding: 4px 6px;
    font-size: 0.82rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    box-sizing: border-box;
}

/* Compact field: label and input on same row (score/percent fields) */
.field-area-compact {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.field-area-compact .field-label {
    flex: 1;
    white-space: nowrap;
}

.field-area-compact input {
    width: 48px;
    flex: 0 0 auto;
    text-align: center;
}

/* Shared area box styling */
.data-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* Compact fields group (e.g. Beeinträchtigungen i/% pairs) */
.fields-group-compact {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-alt);
}

.fields-group-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fields-group-inputs {
    display: flex;
    gap: 8px;
}

.fields-group-pair {
    display: flex;
    align-items: center;
    border-radius: 3px;
}

.fields-group-input {
    width: 32px;
    height: 16px;
    padding: 0 3px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: 0.75rem;
    line-height: 16px;
    text-align: center;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-surface);
    box-sizing: border-box;
}

.fields-group-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.4;
}

.fields-group-input:focus {
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.15);
}

/* Auto-gap stacks that contain compact field groups */
.area-stack:has(.fields-group-compact) {
    gap: 6px !important;
}


/* Label-only items in checkbox grid (value_type: label) */
.checkbox-label-only {
    font-weight: 600;
    font-size: 12px;
    background: transparent !important;
    border: none !important;
}

/* Prevent grid overflow */
.grid-content > *,
.area-stack > * {
    min-width: 0;
}

/* ============================================
   TEMPLATE EDITOR STYLES
   ============================================ */

/* Template List */
.template-list-header {
    margin-bottom: 20px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    display: block;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.template-card:hover {
    border-color: #4a90d9;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.15);
    transform: translateY(-2px);
}

.template-type {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 8px;
}

.template-name {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.4;
}

.no-templates {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px;
}

/* Pending Template Card */
.template-card-pending {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    cursor: default;
}

.template-card-pending:hover {
    transform: none;
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pending-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pending-status {
    margin-top: 12px;
}

.pending-status .status-text {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 8px;
}

.progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90d9 0%, #667eea 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Failed Template Card */
.template-card-failed {
    background: #fef2f2;
    border-color: #fecaca;
}

.template-card-failed:hover {
    transform: none;
    border-color: #fecaca;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-top: 10px;
}

/* Template Management Link */
.template-management {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   CREATE TEMPLATE MODAL (14-02)
   ============================================ */

.template-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.create-template-btn {
    font-size: 14px;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #666;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.upload-area.drag-over {
    border-color: #2563eb;
    background: #dbeafe;
    border-style: solid;
}

.upload-placeholder p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

.upload-placeholder .hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 8px;
}

.upload-preview {
    width: 100%;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Processing State */
.processing-state {
    text-align: center;
    padding: 40px 20px;
}

.processing-state .spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
}

.processing-state p {
    color: #666;
    margin: 10px 0;
    font-size: 1rem;
}

.processing-state .hint {
    font-size: 0.85rem;
    color: #999;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 40px 20px;
}

.error-message {
    color: #d32f2f;
    font-size: 1rem;
    margin-bottom: 20px;
    padding: 16px;
    background: #ffebee;
    border-radius: 8px;
    border: 1px solid #ef9a9a;
}

/* Editor Layout */
.editor-main {
    max-width: 1400px;
    margin: 0 auto;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.editor-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Field Editor */
.field-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: #fafafa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.field-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-label-text {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.field-preview-input {
    background: #f0f0f0 !important;
    cursor: not-allowed;
}

/* Editable Elements */
.editable {
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.15s ease;
    cursor: text;
}

.editable:hover {
    border-color: #ccc;
    background: #fff;
}

.editable:focus {
    outline: none;
    border-color: #4a90d9;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

/* Hint Input */
.hint-input-wrapper {
    margin-top: 4px;
}

.hint-label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
    font-weight: 500;
}

.hint-input {
    width: 100%;
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 40px;
    background: #fff;
    transition: border-color 0.15s ease;
}

.hint-input:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.hint-input::placeholder {
    color: #bbb;
    font-style: italic;
}

/* Section Header Editable */
.section-label-text {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex: 1;
}

/* Checkbox Editor */
.checkbox-field {
    background: transparent;
    padding: 4px;
}

.checkbox-label-text {
    font-weight: normal;
    font-size: 13px;
}

/* Inline checkbox label (for forms) */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
}

/* Status Messages */
.status-msg {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    margin-left: auto;
}

.status-info {
    color: #666;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

/* Save Button */
#save-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#save-btn:hover:not(:disabled) {
    background: #218838;
}

#save-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ============================================
   PAGE TABS FOR MULTI-PAGE FORMS (13.2-02)
   ============================================ */

.page-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    background: #232826;
    border-bottom: 1px solid #333;
}

.page-tab {
    padding: 6px 14px;
    border: 1px solid #444;
    border-radius: 5px;
    background: #2a2f2c;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: #888;
    transition: all var(--transition);
}

.page-tab:hover {
    background: #3a3f3c;
    color: #bbb;
    border-color: #555;
}

.page-tab.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.page-tab.active:hover {
    background: var(--color-accent-hover);
}

/* ============================================
   SESSION PERSISTENCE (15-02)
   ============================================ */

/* Session Controls */
.session-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.session-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 4px;
    font-size: 13px;
    color: #2e7d32;
}

.session-indicator .session-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-indicator .btn-clear-session {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}

.session-indicator .btn-clear-session:hover {
    color: #c62828;
}

/* Session Modal */
.session-modal {
    max-width: 600px;
    width: 90%;
}

.save-session-modal {
    max-width: 400px;
    width: 90%;
}

/* Session List */
.session-list {
    max-height: 400px;
    overflow-y: auto;
}

.session-list .loading,
.session-list .empty-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    gap: 15px;
}

.session-item:last-child {
    border-bottom: none;
}

.session-item:hover {
    background: #f8f9fa;
}

.session-item .session-info {
    flex: 1;
    min-width: 0;
}

.session-item .session-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-item .session-meta {
    font-size: 12px;
    color: #666;
}

.session-item .session-meta span {
    margin-right: 12px;
}

.session-item .session-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.session-item .btn-load {
    background: #4299e1;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.session-item .btn-load:hover {
    background: #3182ce;
}

.session-item .btn-delete {
    background: none;
    border: 1px solid #e53e3e;
    color: #e53e3e;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.session-item .btn-delete:hover {
    background: #fed7d7;
}

/* ============================================
   HOME PAGE HEADER
   ============================================ */

.home-header {
    background: var(--color-header-bg);
    padding: 0 32px;
    border-bottom: none;
    position: relative;
}

.home-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent) 0%, rgba(45, 106, 79, 0.3) 100%);
}

.home-header-inner {
    max-width: 1060px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    color: var(--color-accent);
    display: flex;
    align-items: center;
    opacity: 0.8;
}

.home-brand h1 {
    color: var(--color-header-text);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
    font-optical-sizing: auto;
}

.brand-subtitle {
    color: #6b6860;
    font-size: 0.68rem;
    margin: 1px 0 0 0;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    font-weight: 500;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    color: #9e9890;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-header-text);
}

/* Home page body overrides */
body.home-page {
    font-family: var(--font-body);
    padding: 0;
    background: var(--color-bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(45, 106, 79, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(184, 134, 11, 0.03) 0%, transparent 50%);
}

.home-page main {
    max-width: 1060px;
    margin: 0 auto;
    padding: 44px 32px 72px;
}

/* ============================================
   HOME PAGE LAYOUT
   ============================================ */

.home-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 32px;
}

.home-option {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    animation: homeFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.home-option-upload {
    animation-delay: 0.05s;
}

.home-option-sessions {
    animation-delay: 0.15s;
}

.home-option:hover {
    box-shadow: var(--shadow-md);
}

.option-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.option-number {
    width: 30px;
    height: 30px;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(45, 106, 79, 0.25);
}

.option-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.3px;
}

/* Template Select */
.template-select-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
}

.template-select-wrapper label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.template-select-wrapper select {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-body);
    background: var(--color-surface-alt);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition);
}

.template-select-wrapper select:hover {
    border-color: var(--color-border-hover);
}

.template-select-wrapper select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

/* Saved Sessions List */
#saved-sessions {
    min-height: 180px;
}

.sessions-empty {
    text-align: center;
    padding: 40px 20px;
}

.sessions-empty p {
    margin: 0 0 4px 0;
    color: var(--color-text-secondary);
    font-size: 0.88rem;
}

.sessions-empty .hint {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: min(600px, calc(100vh - 340px));
    overflow-y: auto;
    padding-right: 6px;
}

.sessions-list::-webkit-scrollbar {
    width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
    background: var(--color-surface-alt);
    border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: 3px;
}

.session-card {
    padding: 14px 18px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.session-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent);
    border-radius: 3px 0 0 3px;
    opacity: 0;
    transition: opacity var(--transition);
}

.session-card:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
    transform: translateX(3px);
}

.session-card:hover::before {
    opacity: 1;
}

.session-card:active {
    transform: translateX(3px) scale(0.99);
}

.session-card-name {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
    font-size: 0.88rem;
    letter-spacing: -0.1px;
}

.session-card-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    align-items: center;
}

.session-card-type {
    background: var(--color-accent-light);
    color: var(--color-accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.4px;
}

/* Session toolbar (sort + count) */
.sessions-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    margin-bottom: 4px;
}

.sessions-count {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.sessions-sort {
    font-size: 0.72rem;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
}

.sessions-sort:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Validated session card — muted to signal "done" */
.session-validated {
    opacity: 0.55;
    border-color: var(--color-border);
}

.session-validated::before {
    background: #34a853;
    opacity: 1;
}

.session-validated:hover {
    opacity: 0.85;
}

.session-validated .session-card-name {
    color: var(--color-text-muted);
}

/* Status badges in session cards */
.validated-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #34a853;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--color-border-hover);
    color: var(--color-text-muted);
    font-size: 0.6rem;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Validated button state on review page */
.btn-validated {
    background: #34a853 !important;
    color: #fff !important;
    border-color: #34a853 !important;
    opacity: 0.85;
    cursor: default !important;
}

/* ============================================
   FOLDER PICKER (Phase 16)
   ============================================ */

.folder-picker {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    background: var(--color-surface-alt);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.folder-picker .drop-zone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--color-accent-light);
    border-radius: 50%;
    color: var(--color-accent);
    margin-bottom: 16px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.folder-picker:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.folder-picker:hover .drop-zone-icon {
    background: var(--color-accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(45, 106, 79, 0.25);
}

.folder-picker p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
}

.folder-picker .hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 8px;
    font-weight: 400;
}

.folder-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-accent-light);
    border: 1px solid #b8d8c5;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-accent);
}

.folder-indicator svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.folder-indicator .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-indicator .btn-change-folder {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-body);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition);
}

.folder-indicator .btn-change-folder:hover {
    color: var(--color-text);
}

.browser-warning {
    background: var(--color-amber-light);
    border: 1px solid #e0cc9a;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 0.82rem;
    color: #78621a;
    text-align: center;
}

/* ============================================
   BATCH EXTRACTION (Phase 17)
   ============================================ */

.batch-extract-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.btn-batch-extract {
    width: 100%;
    padding: 11px 18px;
    background: transparent;
    border: 1.5px solid var(--color-accent);
    color: var(--color-accent);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.2px;
}

.btn-batch-extract:hover:not(:disabled) {
    background: var(--color-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.25);
    transform: translateY(-1px);
}

.btn-batch-extract:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-batch-extract:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.batch-progress {
    margin-top: 14px;
}

.batch-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.batch-progress .progress-bar {
    height: 6px;
    background: var(--color-surface-hover);
    border-radius: 3px;
}

.batch-progress .progress-fill {
    background: linear-gradient(90deg, var(--color-accent) 0%, #40916c 100%);
    border-radius: 3px;
}

.batch-progress-current {
    font-size: 0.73rem;
    color: var(--color-text-muted);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

.batch-result {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-accent-light);
    font-size: 0.82rem;
    color: var(--color-accent);
    font-weight: 500;
    animation: homeFadeIn 0.3s ease both;
}

.batch-result.batch-result-error {
    background: #fdf0f0;
    color: #9b2c2c;
}

.batch-fail-item {
    margin-top: 6px;
    padding: 4px 0;
    font-size: 0.78rem;
    border-top: 1px solid rgba(155, 44, 44, 0.12);
}

.batch-fail-item:first-child {
    margin-top: 8px;
}

/* ============================================
   HOME PAGE ANIMATIONS
   ============================================ */

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

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .home-options {
        grid-template-columns: 1fr;
    }
    .home-page main {
        padding: 24px 16px 48px;
    }
    .home-option {
        padding: 24px;
    }
    .home-header {
        padding: 0 16px;
    }
}

/* Reviewer comment at bottom of review page */
.reviewer-comment-section {
    grid-column: 1 / -1;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reviewer-comment-section label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
}

.reviewer-comment {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.82rem;
    resize: vertical;
    box-sizing: border-box;
    background: var(--color-surface);
}
