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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

header {
    background: #1a1a2e;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

header h1 {
    font-size: 1.2rem;
    white-space: nowrap;
}

.env-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    font-family: 'Menlo', 'Consolas', monospace;
    white-space: nowrap;
}

#stage-nav {
    display: flex;
    gap: 0.5rem;
}

.stage-btn {
    background: rgb(156, 156, 156);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.stage-btn.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.stage-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.stage-btn:not(:disabled):hover {
    background: #4362eec1;
}

main {
    max-width: 1530px;
    margin: 0 auto;
    padding: 2rem;
}

.stage {
    display: none;
}

.stage.active {
    display: block;
}

/* File Selector (Stage 1) */
.file-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.file-list-header h2 {
    font-size: 1.1rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.file-item:hover {
    background: #f9f9f9;
}

.file-item label {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    cursor: pointer;
}

.file-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.file-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-mapped {
    background: #d4edda;
    color: #155724;
}

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

.file-actions {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-primary {
    background: #4361ee;
    color: white;
}

.btn-primary:not(:disabled):hover {
    background: #3651d4;
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:not(:disabled):hover {
    background: #dee2e6;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Column Mapper (Stage 2) */
.mapper-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.mapper-tab {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.8rem;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mapper-tab.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.mapper-tab.saved {
    border-color: #28a745;
    color: #28a745;
}

.mapper-tab.saved.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.mapper-panel {
    background: white;
    border-radius: 0 8px 8px 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mapper-panel h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.mapping-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.mapping-table th,
.mapping-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.mapping-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}

.mapping-table select,
.mapping-table input[type="text"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.85rem;
}

.mapping-table select:focus,
.mapping-table input[type="text"]:focus {
    outline: none;
    border-color: #4361ee;
}

.multi-value-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.multi-value-toggle input[type="checkbox"] {
    cursor: pointer;
}

.multi-value-toggle input[type="text"] {
    width: 50px !important;
}

.preview-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.preview-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #666;
}

.preview-table-wrap {
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.preview-table th,
.preview-table td {
    padding: 0.3rem 0.5rem;
    border: 1px solid #eee;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table th {
    background: #f8f9fa;
}

.mapper-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 0.5rem;
}

.validation-msg {
    font-size: 0.8rem;
    color: #dc3545;
}

.validation-msg.valid {
    color: #28a745;
}

/* Processing View (Stage 3) */
.processing-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.process-step {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.process-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.process-step-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.step-status {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.step-status.waiting {
    background: #e9ecef;
    color: #6c757d;
}

.step-status.running {
    background: #cce5ff;
    color: #004085;
}

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

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

.progress-bar-wrap {
    background: #e9ecef;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: #4361ee;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar.completed {
    background: #28a745;
}

.progress-bar.error {
    background: #dc3545;
}

.step-message {
    font-size: 0.8rem;
    color: #666;
}

.log-area {
    background: #1a1a2e;
    color: #a8e6cf;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.log-area .log-entry {
    padding: 1px 0;
}

.log-area .log-entry.error {
    color: #ff6b6b;
}

.log-area .log-entry.completed {
    color: #51cf66;
}

.processing-summary {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.processing-summary h3 {
    margin-bottom: 0.5rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #888;
}

/* Profile Selector (Stage 0) */
.profile-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.profile-list-header h2 {
    font-size: 1.1rem;
}

.profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    gap: 1rem;
}

.profile-card:hover {
    background: #f9f9f9;
}

.profile-card.selected {
    background: #eef2ff;
    border-left: 3px solid #4361ee;
}

.profile-card-info {
    flex: 1;
    min-width: 0;
}

.profile-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.profile-card-meta {
    font-size: 0.78rem;
    color: #888;
    line-height: 1.5;
}

.profile-card-meta code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.75rem;
}

.profile-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.profile-actions {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:not(:disabled):hover {
    background: #c82333;
}

/* Profile Editor */
.profile-editor {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-editor h2 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.editor-section {
    margin-bottom: 1.25rem;
}

.editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

.editor-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.editor-input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

.editor-input:focus {
    outline: none;
    border-color: #4361ee;
}

.editor-input[readonly] {
    background: #f5f5f5;
    color: #888;
}

.editor-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

.editor-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.8rem;
    resize: vertical;
}

.editor-textarea:focus {
    outline: none;
    border-color: #4361ee;
}

/* Template Builder */
.template-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.template-preview-wrap {
    display: flex;
    flex-direction: column;
}

.template-preview {
    flex: 1;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
    background: #fafafa;
    overflow: auto;
    min-height: 100px;
}

.template-placeholder {
    background: #e8f0fe;
    color: #4361ee;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Escape Rules */
.escape-rule-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.escape-rule-row input {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.85rem;
    width: 120px;
}

.escape-rule-row input:focus {
    outline: none;
    border-color: #4361ee;
}

.escape-arrow {
    color: #999;
    font-size: 0.9rem;
}

/* Steps Checkboxes */
.steps-checkboxes {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.step-check-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.step-check-label input {
    cursor: pointer;
}

/* Editor Actions */
.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* --- Jyrsin additions --- */

.hidden { display: none !important; }

.auth-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
}
.auth-card {
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 380px;
}
.auth-card h1 { margin-bottom: 0.5rem; font-size: 1.8rem; }
.auth-subtitle { color: #666; margin-bottom: 1.5rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.auth-card label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: #444; }
.auth-card input {
    padding: 0.6rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}
.auth-card #auth-pin { letter-spacing: 8px; text-align: center; font-size: 1.4rem; }
.auth-msg { font-size: 0.9rem; color: #555; }
.auth-error {
    color: #c00;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: #fee;
    border-radius: 4px;
}
.btn-link {
    background: transparent;
    color: #06c;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    align-self: flex-start;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #1a1a2e;
    color: #fff;
}
.top-bar h1 { font-size: 1.1rem; margin: 0; }
.top-nav { display: flex; gap: 0.5rem; }
.nav-btn {
    background: transparent;
    color: #ddd;
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.35rem 0.9rem;
    border-radius: 5px;
    cursor: pointer;
}
.nav-btn.active { background: #fff; color: #1a1a2e; border-color: #fff; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
#conn-picker-slot { display: flex; align-items: center; gap: 0.4rem; }
#conn-picker-slot select { padding: 0.3rem 0.5rem; border-radius: 4px; }
.user-label { color: #ddd; font-size: 0.85rem; }

#main-view { padding: 1.5rem 2rem; }

.conn-manager { max-width: 720px; margin: 0 auto; }
.cm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cm-actions { display: flex; gap: 0.5rem; }
.conn-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.conn-item { background: #fff; border: 1px solid #e2e2e2; border-radius: 6px; padding: 0.75rem 1rem; display: flex; justify-content: space-between; align-items: center; }
.conn-info { display: flex; flex-direction: column; gap: 0.15rem; }
.conn-url { color: #888; font-size: 0.85rem; font-family: monospace; }
.conn-item-actions { display: flex; gap: 0.4rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
#conn-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
#conn-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: #444; }
#conn-form input { padding: 0.5rem 0.7rem; border: 1px solid #ccc; border-radius: 4px; }
#conn-form .form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 0.5rem; }

.file-selector { max-width: 720px; margin: 0 auto; }
.uploaded-files { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.uploaded-files li { background: #fff; border: 1px solid #e2e2e2; border-radius: 5px; padding: 0.5rem 0.9rem; }
.upload-error { background: #fee; color: #c00; padding: 0.5rem; border-radius: 4px; margin-top: 0.5rem; }

.jobs-view { max-width: 100%; }
.jobs-table { width: 100%; border-collapse: collapse; background: #fff; }
.jobs-table th, .jobs-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
.status { padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; text-transform: uppercase; }
.status-completed { background: #d4edda; color: #155724; }
.status-failed { background: #f8d7da; color: #721c24; }
.status-running { background: #fff3cd; color: #856404; }
.status-queued { background: #e2e3e5; color: #383d41; }

.dev-view { max-width: 900px; margin: 0 auto; }
.dev-tool { background: #fff; border: 1px solid #e2e2e2; border-radius: 6px; padding: 1rem 1.25rem; margin: 1rem 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.dev-tool h3 { margin: 0 0 0.25rem 0; font-size: 1rem; }
.dev-tool-desc { color: #666; font-size: 0.85rem; margin: 0; max-width: 640px; }
.dev-output { background: #1a1a2e; color: #cde; padding: 1rem; border-radius: 6px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.8rem; min-height: 1rem; }
.dev-output.ok { border-left: 3px solid #28a745; }
.dev-output.err { border-left: 3px solid #dc3545; color: #fcc; }

/* --- Column mapper wide layout + sub-config --- */
.mapping-table-wide td { vertical-align: top; }
.mapping-table-wide .sub-config { padding: 0.5rem 0.75rem; }

.sc { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8rem; }
.sc-mode { display: flex; gap: 1rem; flex-wrap: wrap; padding: 0.35rem 0.55rem; background: #f6f7fb; border-radius: 4px; border: 1px solid #e6e8ef; }
.sc-mode label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 0.78rem; color: #333; }
.sc-mode input[type="radio"] { margin: 0; }
.sc-pick input[type="text"] { width: 100%; padding: 0.35rem 0.55rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.85rem; }
.sc-pick input[type="text"]:focus { outline: none; border-color: #4361ee; box-shadow: 0 0 0 2px rgba(67,97,238,0.15); }
.sc-hint { color: #777; font-size: 0.72rem; margin-top: 3px; }
.sc-hint code { background: #eef; padding: 1px 4px; border-radius: 2px; font-family: ui-monospace, monospace; }
.sc-property-numeric { display: flex; flex-direction: column; gap: 0.35rem; padding-top: 0.35rem; border-top: 1px dashed #e2e2e2; }
.sc-property-numeric > label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #333; cursor: pointer; }
.sc-sublabel { color: #666; font-size: 0.72rem; margin-bottom: 2px; display: block; }
.property-unit-wrap select { width: 100%; padding: 0.3rem 0.5rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.8rem; }
.sc.custom { flex-direction: column; gap: 0.35rem; }
.sc.custom label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #333; cursor: pointer; }

/* --- Combobox (searchable select) --- */
.combo { position: relative; }
.combo-field { display: flex; align-items: stretch; }
.combo-input {
    flex: 1;
    padding: 0.35rem 0.55rem;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    font-size: 0.85rem;
    background: #fff;
}
.combo-input:focus { outline: none; border-color: #4361ee; box-shadow: 0 0 0 2px rgba(67,97,238,0.15); }
.combo-toggle {
    padding: 0 0.6rem;
    border: 1px solid #ccc;
    border-left: none;
    background: #f6f7fb;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    color: #555;
    font-size: 0.85rem;
}
.combo-toggle:hover { background: #eef; }
.combo.open .combo-input { border-color: #4361ee; }
.combo.open .combo-toggle { border-color: #4361ee; background: #eef; }
.combo-list {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d0d3dc;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    z-index: 100;
}
.combo-list[hidden] { display: none; }
.combo-option {
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f4f4f6;
}
.combo-option:last-child { border-bottom: none; }
.combo-option:hover, .combo-option.active { background: #eef4ff; }
.combo-option-label { color: #222; }
.combo-option-meta { color: #999; font-size: 0.72rem; align-self: center; }
.combo-empty { padding: 0.55rem 0.6rem; color: #999; font-size: 0.8rem; font-style: italic; }

.sc-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #333;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    background: #f6f7fb;
    border: 1px solid #e6e8ef;
    border-radius: 4px;
    align-self: flex-start;
}
.sc-inline-check input[type="checkbox"] { margin: 0; }
.sc-hint-sub { padding-left: 0.15rem; }

.sc-check-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sc-check-row .sc-inline-check { flex: 0 0 auto; }
.property-defining-check + span, .sc-inline-check strong { font-weight: 500; }

.sc-role-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.sc-role-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #333; padding: 0.3rem 0.55rem; background: #f6f7fb; border: 1px solid #e6e8ef; border-radius: 4px; }
.sc-role-label select { padding: 0.15rem 0.35rem; border: 1px solid #ccc; border-radius: 3px; font-size: 0.78rem; background: #fff; }

.dev-tool-actions { display: flex; gap: 0.75rem; align-items: flex-end; }
.dev-tool-input { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: #444; }
.dev-tool-input input { padding: 0.35rem 0.55rem; border: 1px solid #ccc; border-radius: 4px; width: 6rem; font-size: 0.9rem; }

/* --- Media uploader --- */
.media-uploader { max-width: 900px; margin: 0 auto; }
.section-desc { color: #666; margin-bottom: 1rem; }

.mu-drop {
    border: 2px dashed #cfd4dd;
    border-radius: 8px;
    padding: 2rem;
    background: #fafbff;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.mu-drop.active { border-color: #4361ee; background: #eef4ff; }
.mu-drop.busy { border-style: solid; border-color: #4361ee; background: #fff; text-align: left; }
.mu-drop-inner { display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
.mu-drop.busy .mu-drop-inner { align-items: stretch; }
.mu-drop-hint { color: #666; margin: 0; }
.mu-hint { color: #999; font-size: 0.85rem; }
.mu-actions { display: flex; gap: 0.5rem; }
.mu-drop.busy .mu-actions { justify-content: flex-end; }

.mu-progress { height: 12px; background: #e6e8ef; border-radius: 6px; overflow: hidden; margin: 0.35rem 0; }
.mu-progress-bar { height: 100%; background: linear-gradient(90deg, #4361ee, #6b8bff); transition: width 0.2s; }
.mu-progress-label { color: #555; font-size: 0.85rem; margin: 0; }

.mu-summary { display: flex; gap: 0.75rem; margin: 1.25rem 0; flex-wrap: wrap; align-items: center; }
.mu-stat {
    display: flex; flex-direction: column; gap: 0.15rem;
    background: #fff; border: 1px solid #e2e2e2; border-radius: 6px;
    padding: 0.5rem 0.9rem; min-width: 120px;
}
.mu-stat-label { color: #888; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; }
.mu-stat-val { font-size: 1.4rem; font-weight: 600; color: #222; }

.mu-log { margin-top: 1rem; background: #fff; border: 1px solid #e2e2e2; border-radius: 6px; }
.mu-log h3 { padding: 0.6rem 1rem; margin: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.4px; color: #666; border-bottom: 1px solid #eee; }
.mu-log ul { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.mu-log li {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f2f2f4;
}
.mu-log li:last-child { border-bottom: none; }
.mu-log-icon { font-family: ui-monospace, monospace; text-align: center; }
.mu-log-uploaded .mu-log-icon { color: #28a745; }
.mu-log-duplicate .mu-log-icon { color: #6c757d; }
.mu-log-failed .mu-log-icon, .mu-log-error .mu-log-icon { color: #dc3545; }
.mu-log-skipped .mu-log-icon { color: #999; }
.mu-log-status .mu-log-icon { color: #4361ee; }
.mu-log-name { color: #333; }
.mu-log-detail { color: #999; font-size: 0.78rem; text-align: right; }

/* --- Mapper header row --- */
.mapper-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.15rem; }
.mapper-header h3 { margin: 0; }

/* --- Manual drawer --- */
.manual-backdrop {
    position: fixed; inset: 0;
    background: rgba(20, 22, 40, 0.35);
    opacity: 0; transition: opacity 0.2s ease;
    z-index: 900;
}
.manual-backdrop.open { opacity: 1; }
.manual-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(520px, 95vw);
    background: #fff;
    box-shadow: -8px 0 30px rgba(0,0,0,0.18);
    transform: translateX(100%); transition: transform 0.22s ease;
    z-index: 1000;
    display: flex; flex-direction: column;
}
.manual-drawer.open { transform: translateX(0); }
.manual-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.9rem 1.25rem; border-bottom: 1px solid #eee;
    background: #f7f8fb;
}
.manual-head h2 { margin: 0; font-size: 1.05rem; }
.manual-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.6rem; line-height: 1; color: #666; padding: 0 0.35rem;
}
.manual-close:hover { color: #000; }
.manual-body { overflow-y: auto; padding: 1rem 1.25rem 2rem; }
.manual-body section { margin-bottom: 1.4rem; }
.manual-body h3 { font-size: 0.95rem; margin: 0 0 0.5rem; color: #1a1a2e; }
.manual-body p, .manual-body ul, .manual-body ol { font-size: 0.85rem; color: #333; line-height: 1.5; margin: 0 0 0.5rem; }
.manual-body ul, .manual-body ol { padding-left: 1.25rem; }
.manual-body code { background: #f0f2f7; padding: 1px 5px; border-radius: 3px; font-size: 0.8em; }
.manual-list { display: block; }
.manual-list dt { font-weight: 600; color: #4361ee; margin-top: 0.85rem; font-size: 0.9rem; }
.manual-list dd { margin: 0.15rem 0 0.5rem; font-size: 0.85rem; color: #333; line-height: 1.55; }
.manual-list dd ul { margin-top: 0.25rem; }

/* --- Preprocess prompt --- */
.preprocess-prompt { max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 1.5rem 1.75rem; }
.preprocess-prompt h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.preprocess-lead { color: #333; margin: 0 0 0.75rem; line-height: 1.55; }
.preprocess-steps { margin: 0 0 1rem 1.25rem; padding: 0; color: #333; line-height: 1.55; }
.preprocess-steps li { margin-bottom: 0.5rem; }
.preprocess-note { color: #666; font-size: 0.9rem; margin: 0 0 0.5rem; line-height: 1.5; }
.preprocess-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.preprocess-error { color: #c00; background: #fee; padding: 0.5rem 0.75rem; border-radius: 4px; margin-top: 0.75rem; }
.preprocess-progress { color: #4361ee; margin-top: 0.75rem; font-weight: 500; }

.pp-badge { display: inline-block; background: #d4edda; color: #155724; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; margin-left: 0.5rem; vertical-align: middle; }
.pp-summaries { background: #f7f8fb; border: 1px solid #eee; border-radius: 4px; padding: 0.5rem 0.9rem; margin: 0.5rem 0 1rem; font-size: 0.85rem; }
.pp-summaries summary { cursor: pointer; color: #444; }
.pp-summaries ul { margin: 0.5rem 0 0.25rem; padding-left: 1.25rem; color: #444; }
.pp-summaries li { margin-bottom: 0.25rem; }
.pp-fail { color: #c00; margin-left: 0.5rem; }

.preprocess-scope { background: #f7f8fb; border: 1px solid #e6e8ef; border-radius: 6px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.preprocess-scope-lead { margin: 0 0 0.5rem; color: #333; font-size: 0.9rem; }
.preprocess-scope-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.preprocess-scope-list li { padding: 0.15rem 0; }
.pp-scope-yes { color: #155724; }
.pp-scope-no { color: #666; }

.file-select-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; margin: 0.5rem 0;
    background: #f6f7fb; border: 1px solid #e6e8ef; border-radius: 4px;
    font-size: 0.85rem;
}
.file-select-all { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.file-select-count { color: #666; }
.file-check-row {
    display: flex; align-items: center; gap: 0.75rem;
    cursor: pointer; padding: 0.25rem 0;
}
.file-check-row input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
.file-check-info { display: flex; flex-direction: column; gap: 0.15rem; }
.file-check-info .file-meta { color: #888; font-size: 0.82rem; }
.uploaded-files li { padding: 0.35rem 0; border-bottom: 1px solid #f2f2f4; }
.uploaded-files li:last-child { border-bottom: none; }
