/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.5;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.navbar-brand a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.navbar-menu { display: flex; align-items: center; gap: 1.5rem; }
.navbar-menu a { color: #ccc; text-decoration: none; font-size: 0.9rem; }
.navbar-menu a:hover { color: #fff; }
.navbar-user { color: #888; font-size: 0.85rem; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* Typography */
h1 { margin-bottom: 0.5rem; font-size: 1.8rem; }
h2 { margin-bottom: 1rem; font-size: 1.3rem; color: #333; }
.text-muted { color: #666; font-size: 0.9rem; }
.text-error { color: #c0392b; font-size: 0.85rem; }

/* Sections */
.section { margin-bottom: 2.5rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card h3 { margin-bottom: 0.3rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.88rem; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 0.8rem; text-transform: uppercase; }
.table tbody tr:hover { background: #f8fafc; }
.table-wrapper { overflow: auto; margin: 1rem 0; max-height: 75vh; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-uploaded, .badge-parsed, .badge-pending { background: #dbeafe; color: #1e40af; }
.badge-processing, .badge-sending { background: #fef3c7; color: #92400e; }
.badge-completed, .badge-success { background: #dcfce7; color: #166534; }
.badge-failed, .badge-validation_error { background: #fecaca; color: #991b1b; }
.badge-cancelled, .badge-skipped { background: #f1f5f9; color: #64748b; }
.badge-unmatched { background: #fef3c7; color: #92400e; }
.badge-route { background: #dbeafe; color: #1e40af; }
.badge-route-customer { background: #dbeafe; color: #1e40af; }
.badge-route-supplier { background: #fce7f3; color: #9d174d; }
.badge-route-cc { background: #d5f5f6; color: #0e7490; }
.badge-route-bank { background: #fef3c7; color: #92400e; }
.badge-route-refund { background: #fecaca; color: #991b1b; }
.badge-duplicate { background: #fef3c7; color: #92400e; font-size: 0.65rem; margin-left: 0.3rem; }

/* Clickable route badges */
.badge-route-clickable { cursor: pointer; position: relative; }
.badge-route-clickable:hover { opacity: 0.8; box-shadow: 0 0 0 2px rgba(59,130,246,0.3); }
.badge-route-clickable::after { content: ' \25BE'; font-size: 0.65rem; }

/* Grouped lines expand/collapse */
.lines-toggle {
    cursor: pointer;
    color: #2563eb;
    font-weight: 600;
    font-size: 0.8rem;
}
.lines-toggle:hover { text-decoration: underline; }
.lines-toggle::after { content: ' \25B6'; font-size: 0.6rem; }
.lines-toggle.expanded::after { content: ' \25BC'; }
.lines-subtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin-top: 4px;
}
.lines-subtable td {
    padding: 2px 6px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.lines-subtable tr:hover td { background: #f8fafc; }
.cell-lines-summary { min-width: 120px; }

/* Route change dropdown */
.route-dropdown {
    position: fixed;
    z-index: 1100;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 200px;
    max-width: 320px;
    overflow: hidden;
}
.route-dropdown-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
}
.route-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    transition: background 0.1s;
}
.route-dropdown-item:hover { background: #f3f4f6; }
.route-dropdown-item.active { background: #eff6ff; font-weight: 600; }
.route-dropdown-item .route-item-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* Forms */
.form { max-width: 500px; }
.form-upload { max-width: 600px; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}
.form-group small { display: block; color: #666; font-size: 0.8rem; margin-top: 0.2rem; }
.form-error { color: #dc2626; font-size: 0.85rem; }

/* File drop */
.file-drop {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}
.file-drop:hover, .file-drop.dragover { border-color: #2563eb; }
.file-drop p { color: #666; margin-bottom: 0.5rem; }

/* Alerts */
.alert { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #dcfce7; }

/* Login */
.login-container { max-width: 400px; margin: 4rem auto; }

/* Preview — full-width layout */
.preview-page .container { max-width: none; padding: 1rem 1.5rem; }
.preview-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    position: sticky;
    top: 56px;
    background: #f5f7fa;
    padding: 0.8rem 0;
    z-index: 50;
    border-bottom: 1px solid #e2e8f0;
}
.table-preview { font-size: 0.82rem; }
.table-preview th, .table-preview td { padding: 0.35rem 0.5rem; white-space: nowrap; }
.table-preview thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; }
.table-preview td {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-preview .col-check { width: 30px; text-align: center; }
.table-preview .col-row { width: 40px; }
.table-preview .col-status { width: 80px; }
.row-excluded { opacity: 0.4; }
.row-duplicate td { background: #fffbeb; }
.row-duplicate td:first-child { border-left: 3px solid #f59e0b; }
.row-sent td { background: #f0fdf4; color: #6b7280; }
.row-sent td:first-child { color: #16a34a; font-weight: 700; }
.cell-editable { cursor: pointer; position: relative; }
.cell-editable:hover { background: #eff6ff; }
.cell-editing input {
    width: 100%;
    padding: 0.2rem 0.4rem;
    border: 2px solid #2563eb;
    border-radius: 4px;
    font-size: 0.88rem;
    outline: none;
}
.cell-required-missing { background: #fef2f2 !important; border-left: 3px solid #dc2626; }

/* Lookup failed rows */
.row-lookup-failed td { background: #fef2f2; }
.row-lookup-failed td:first-child { border-left: 3px solid #dc2626; }
.cell-lookup-failed { min-width: 160px; }

/* Lookup select button */
.lookup-select-btn {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    color: #92400e !important;
    font-size: 0.78rem !important;
    white-space: nowrap;
}
.lookup-select-btn:hover {
    background: #fde68a !important;
}

/* Lookup cell: relative positioning so dropdown overlays */
.cell-lookup { position: relative; }

/* Searchable lookup dropdown */
.lookup-dropdown {
    position: fixed;
    width: 480px;
    z-index: 1000;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    /* max-height set dynamically by JS based on available viewport space */
}
/* Lookup cache tabs */
.lookup-tabs {
    display: flex;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    flex-shrink: 0;
}
.lookup-tab {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    background: #e2e8f0;
    color: #64748b;
    transition: all 0.15s;
}
.lookup-tab:hover { background: #cbd5e1; }
.lookup-tab.active { color: #fff; }
.lookup-tab[data-type="customer"].active { background: #1e40af; }
.lookup-tab[data-type="supplier"].active { background: #9d174d; }

/* Single cache label (when only one cache) */
.lookup-cache-label {
    padding: 0.4rem 0.8rem;
    background: #1e40af;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 6px 6px 0 0;
    flex-shrink: 0;
}
.lookup-cache-label.cache-suppliers {
    background: #9d174d;
}
.lookup-search {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid #2563eb;
    border-radius: 0;
    font-size: 0.9rem;
    outline: none;
    flex-shrink: 0;
    box-sizing: border-box;
}
.lookup-search:focus { border-color: #1d4ed8; }
.lookup-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 6px 6px;
}
.lookup-item {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}
.lookup-item:hover { background: #eff6ff; }
.lookup-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lookup-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.lookup-item-code { color: #6b7280; font-size: 0.78rem; margin-left: 0.8rem; flex-shrink: 0; }
.lookup-item-sub {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lookup-more { padding: 0.6rem 0.8rem; color: #9ca3af; font-size: 0.82rem; text-align: center; }
.lookup-no-result { padding: 0.8rem; color: #9ca3af; font-size: 0.85rem; text-align: center; }

/* Detail panel inside dropdown (shown to the right) */
.lookup-detail-panel {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 4px;
    width: 320px;
    max-height: 350px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.6rem;
    z-index: 1001;
    font-size: 0.8rem;
}
/* Hover tooltip for matched entries in preview table */
.raw-data-tooltip {
    position: fixed;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    padding: 0.8rem;
    z-index: 200;
    min-width: 280px;
    max-width: 400px;
    max-height: 350px;
    overflow-y: auto;
    font-size: 0.8rem;
    pointer-events: none;
}

/* Shared detail table styles */
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: 0.2rem 0.4rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.detail-key { font-weight: 600; color: #475569; white-space: nowrap; width: 40%; }
.detail-val { color: #1a1a2e; word-break: break-all; }

/* Clickable matched lookup value */
.cell-lookup { cursor: pointer; }
.lookup-matched-value {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    border-bottom: 1px dashed #93c5fd;
    cursor: pointer;
    transition: background 0.15s;
}
.lookup-matched-value:hover {
    background: #eff6ff;
    border-bottom-color: #2563eb;
}

/* Results summary */
.results-summary { display: flex; gap: 1rem; margin: 1.5rem 0; }
.summary-card {
    flex: 1;
    padding: 1.2rem;
    border-radius: 8px;
    text-align: center;
}
.summary-number { display: block; font-size: 2rem; font-weight: 700; }
.summary-label { font-size: 0.85rem; text-transform: uppercase; }
.summary-total { background: #f1f5f9; color: #475569; }
.summary-success { background: #dcfce7; color: #166534; }
.summary-failed { background: #fecaca; color: #991b1b; }
.summary-skipped { background: #f1f5f9; color: #64748b; }
.summary-unmatched { background: #fef3c7; color: #92400e; }

/* Result rows */
.row-success { }
.row-failed td, .row-validation_error td { background: #fef2f2; }
.row-skipped td { opacity: 0.5; }
.row-unmatched td { background: #fefce8; opacity: 0.6; }
.row-unmatched td:first-child { border-left: 3px solid #f59e0b; }

/* Routing summary bar */
.routing-summary-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.2rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}
.routing-detected { color: #475569; }
.routing-stat { color: #1e40af; }
.routing-stat-unmatched { color: #92400e; font-weight: 600; }
.routing-stat-duplicate { color: #b45309; font-weight: 600; }

/* Route filter */
.route-filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.5rem;
}
.route-filter-group label {
    font-size: 0.85rem;
    color: #475569;
    font-weight: 500;
}
.route-filter-select {
    padding: 0.35rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    min-width: 160px;
}
.route-filter-select:focus { outline: none; border-color: #2563eb; }

/* Send confirmation modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 90%;
}
.modal-box h3 {
    margin: 0 0 0.6rem;
    font-size: 1.1rem;
    color: #1e293b;
}
.modal-box p {
    margin: 0 0 0.8rem;
    font-size: 0.9rem;
    color: #475569;
}
.send-modal-routes {
    list-style: none;
    padding: 0;
    margin: 0 0 1.2rem;
}
.send-modal-routes li {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
}
.send-modal-routes li:last-child { border-bottom: none; }
.send-modal-route-name { font-weight: 500; color: #1e293b; }
.send-modal-route-count { color: #64748b; font-size: 0.82rem; }
.modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

/* Warning banner for hidden included rows */
.filter-warning {
    padding: 0.6rem 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.filter-warning .btn-sm {
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
}

/* Hidden row by filter */
tr.row-filtered { display: none; }

/* Route column */
.col-route { width: 120px; }

.actions { margin-top: 2rem; }
.sticky-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    position: sticky;
    top: 56px;
    background: #f5f7fa;
    padding: 0.8rem 0;
    z-index: 50;
    border-bottom: 1px solid #e2e8f0;
}

/* ================================================================
   Template Generator
   ================================================================ */

/* Layout: main + sidebar */
.generator-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}
.generator-main { min-width: 0; }

/* Collapsible sections */
.gen-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.gen-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.gen-section-header h2 { margin: 0; font-size: 1rem; }
.gen-section-toggle { font-size: 0.7rem; color: #999; transition: transform 0.2s; }
.gen-section.collapsed .gen-section-body { display: none; }
.gen-section.collapsed .gen-section-toggle { transform: rotate(-90deg); }
.gen-section-body { padding: 1.2rem; }

/* Form rows (multi-column) */
.gen-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.gen-form-row .form-group { flex: 1; margin-bottom: 0; }

/* Radio group */
.radio-group { display: flex; gap: 1.5rem; margin-top: 0.3rem; }
.radio-label { font-weight: 400; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }

/* Mode toggle (Guided / JSON) */
.mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    width: fit-content;
}
.mode-toggle .btn {
    border: none;
    border-radius: 0;
    padding: 0.3rem 1rem;
    font-size: 0.82rem;
    background: #fff;
    color: #666;
}
.mode-toggle .btn.active {
    background: #2563eb;
    color: #fff;
}

/* JSON editor textarea */
.json-editor {
    width: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    padding: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    line-height: 1.5;
    tab-size: 2;
}
.json-editor:focus { border-color: #2563eb; outline: none; }

/* Mapping rows */
.mapping-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.mapping-row select,
.mapping-row input {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
}
.mapping-type { width: 100px; flex-shrink: 0; }
.mapping-var { width: 120px; }
.mapping-col { width: 90px; }
.mapping-format { width: 130px; }
.mapping-value { width: 180px; }
.mapping-transform { width: 100px; }
.mapping-prefix { width: 100px; }
.mapping-label { width: 90px; }

/* Payload template sections */
.payload-table-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 0.8rem;
    overflow: hidden;
}
.payload-table-header {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}
.payload-field-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid #eee;
}
.payload-field-row:last-child { border-bottom: none; }
.payload-field-name {
    width: 160px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}
.payload-arrow { color: #999; font-weight: 600; padding: 0 0.2rem; }
.payload-field-value {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'SFMono-Regular', Consolas, monospace;
}

/* Fields sidebar */
.fields-panel {
    position: sticky;
    top: 72px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
}
.fields-panel h2 { font-size: 1rem; margin-bottom: 0.8rem; }

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.field-search {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}
.field-search:focus { border-color: #2563eb; outline: none; }

/* Fields accordion */
.fields-table-group { margin-bottom: 0.3rem; }
.fields-table-header {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.5rem;
    background: #f1f5f9;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
}

.field-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem 0.3rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.82rem;
}
.field-item:hover { background: #eff6ff; }
.field-info { flex: 1; min-width: 0; }
.field-name { font-weight: 600; margin-right: 0.4rem; }
.field-type { color: #888; font-size: 0.78rem; }
.field-caption { color: #999; font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-badge { font-size: 0.65rem; padding: 0.05rem 0.3rem; border-radius: 3px; margin-left: 0.3rem; font-weight: 600; text-transform: uppercase; }
.field-badge-req { background: #fecaca; color: #991b1b; }
.field-badge-ro { background: #e2e8f0; color: #64748b; }
.field-add-btn { padding: 0.1rem 0.5rem !important; font-size: 0.9rem !important; line-height: 1; flex-shrink: 0; }

/* Required fields */
.required-fields-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.checkbox-label { font-size: 0.9rem; font-weight: 400; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }

/* Responsive */
@media (max-width: 900px) {
    .generator-layout { grid-template-columns: 1fr; }
    .fields-panel { position: static; max-height: none; }
    .gen-form-row { flex-direction: column; }
}
