:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-subtle: #eef2ff;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --info-bg: #eff6ff;
    --info: #3b82f6;
    --border: #e2e8f0;
    --border-focus: #a5b4fc;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

html { font-size: 15.5px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1; }
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* ── Containers ── */
.form-container {
    max-width: 860px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}
.login-container,
.confirmation-container {
    max-width: 640px;
    margin: 3rem auto;
    padding: 0 1.25rem;
}

/* ── Form header ── */
.form-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.form-header h1 {
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}
.form-header h2 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
}
.brand-logo {
    max-height: 48px;
    margin-bottom: 1.25rem;
}

.intro-text {
    background: var(--primary-subtle);
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.7;
}

/* ── Wizard progress ── */
.wizard-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0;
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    z-index: 1;
}
.wizard-step-dot {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.3s;
}
.wizard-step.active .wizard-step-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.wizard-step.completed .wizard-step-dot {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.wizard-step.completed .wizard-step-dot span {
    font-size: 0;
}
.wizard-step.completed .wizard-step-dot::after {
    content: '\2713';
    font-size: 0.9rem;
}
.wizard-step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: color 0.3s;
}
.wizard-step.active .wizard-step-label { color: var(--primary); }
.wizard-step.completed .wizard-step-label { color: var(--success); }

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 40px;
    max-width: 80px;
    margin: 20px 0.25rem 0;
    transition: background 0.3s;
}

/* Navigation */
.wizard-nav {
    display: flex;
    align-items: center;
    margin-top: 1.5rem;
}
.wizard-nav-spacer { flex: 1; }

/* Transition */
.wizard-panel {
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Fieldset ── */
fieldset {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}
legend {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0.5rem;
    width: auto;
}

/* ── Html content blocks between fields ── */
.form-html-block {
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.65;
}

/* ── Form grid layout ── */
.fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
}
.fields-grid .form-group.full-width {
    grid-column: 1 / -1;
}
/* Tablet portrait and below: single column */
@media (max-width: 768px) {
    .fields-grid {
        grid-template-columns: 1fr;
    }
    .form-container {
        padding: 0 1rem;
        margin: 1.5rem auto;
    }
    fieldset {
        padding: 1.25rem 1.25rem;
    }
    .form-header {
        margin-bottom: 1.75rem;
    }
    .form-header h1 {
        font-size: 1.5rem;
    }
    .wizard-progress {
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }
    .wizard-step-line {
        min-width: 20px;
        max-width: 40px;
    }
    .wizard-step-label {
        font-size: 0.7rem;
    }
    .wizard-nav {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .wizard-nav .btn-submit,
    .wizard-nav .btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .wizard-nav-spacer { display: none; }
    .array-instance {
        padding: 0.75rem 0.75rem 0.25rem;
    }
    .array-instance-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .export-options {
        grid-template-columns: 1fr;
    }
}

/* Small phones */
@media (max-width: 400px) {
    html { font-size: 15px; }
    .form-container {
        padding: 0 0.75rem;
    }
    fieldset {
        padding: 1rem;
    }
    .wizard-step-label {
        display: none;
    }
    .wizard-step.active .wizard-step-label {
        display: block;
    }
    .wizard-step-dot {
        width: 38px;
        height: 38px;
    }
}

/* ── Form groups ── */
.form-group {
    margin-bottom: 1rem;
}
.form-group:last-child { margin-bottom: 0; }
.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.required { color: var(--error); margin-left: 1px; }

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 42px;
}
.form-group input:not([type="checkbox"]):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-group input[readonly] {
    background: var(--bg);
    color: var(--text-secondary);
    cursor: not-allowed;
    border-style: dashed;
}
.form-group select:disabled {
    background: var(--bg);
    color: var(--text-secondary);
    border-style: dashed;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    min-height: 42px;
}
.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-label {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
    margin: 0;
    line-height: 1.5;
}

.help-text {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ── Validation errors ── */
.has-error input,
.has-error select {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.error-text {
    display: block;
    font-size: 0.88rem;
    color: var(--error);
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ── Alert boxes ── */
.error-box {
    background: var(--error-bg);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    color: #991b1b;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}
.info-box {
    background: var(--info-bg);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    color: #1e40af;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}
.success-box {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}
.success-box h2 {
    color: #065f46;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.success-box p { color: #047857; font-size: 1rem; line-height: 1.65; }

/* ── Buttons ── */
.form-actions {
    text-align: center;
    margin-top: 1.75rem;
}
.btn-submit {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.85rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    display: inline-block;
}
.btn-submit:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.btn-submit:active { transform: translateY(0); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.15s;
}
.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}
.btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
    padding: 0.7rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger:hover { background: #dc2626; }

/* ── Login ── */
.login-container {
    text-align: center;
    margin-top: 6rem;
}
.login-container h1 {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}
.login-intro {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}
.login-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: left;
    max-width: 380px;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}
.login-form .form-actions {
    text-align: center;
    margin-top: 1.25rem;
}
.login-form .btn-submit { width: 100%; }
.login-remember { display: flex; align-items: center; gap: 0.5rem; }
.login-remember label { margin: 0; font-weight: normal; }
.login-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.login-success p { margin: 0; }
.login-subtext {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}
.login-footer {
    text-align: center;
    margin-top: 1rem;
}
.login-footer a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.login-btn-block {
    text-align: center;
    text-decoration: none;
    display: block;
    max-width: 380px;
    margin: 0 auto;
}

/* ── Confirmation ── */
.confirmation-container {
    text-align: center;
    margin-top: 5rem;
}
.confirmation-container h1 {
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 2rem;
}

/* ── Admin ── */
.admin-container {
    max-width: 1000px;
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}
.admin-container h1 {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}
.admin-header { margin-bottom: 1.75rem; }
.admin-header .meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 0.75rem;
    transition: color 0.15s;
}
.back-link:hover { color: var(--primary); }

.admin-actions {
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.admin-actions form {
    display: contents;
}
.admin-actions .btn-submit,
.admin-actions .btn-secondary,
.admin-actions .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.4;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    box-sizing: border-box;
    height: 2.5rem;
}
.admin-actions .btn-secondary {
    border-color: var(--border);
    font-weight: 500;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    vertical-align: middle;
}
.admin-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg); }
.admin-table code {
    background: var(--primary-subtle);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.action-links { white-space: nowrap; }
.action-links form { display: inline; }
.action-links a,
.action-links .link-btn {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.15s;
    margin-right: 0.75rem;
}
.action-links a:hover { color: var(--primary-hover); text-decoration: underline; }
.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--error); }
.link-danger:hover { color: #dc2626; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}
.status-active, .status-completed { background: var(--success-bg); color: #065f46; }
.status-draft, .status-pending { background: var(--warning-bg); color: #92400e; }
.status-closed, .status-expired { background: var(--bg); color: var(--text-muted); }

.admin-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 480px;
    box-shadow: var(--shadow-sm);
}

.form-editor-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.form-editor-toggle {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    user-select: none;
}
.form-editor-toggle:hover { color: var(--primary); }
.form-editor {
    margin-top: 1rem;
}
.form-editor textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    resize: vertical;
    line-height: 1.5;
}
.form-editor textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.export-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.export-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-focus);
}
.export-card h3 {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.export-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* ── Campaign create flow ── */
.create-section {
    margin-bottom: 1.75rem;
}
.create-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}
.create-section-title.clickable {
    cursor: pointer;
    user-select: none;
}
.create-section-title.clickable:hover {
    color: var(--primary);
}
.json-editor-hint {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.create-fields {
    max-width: 480px;
}

/* Template cards */
.template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.template-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.template-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow);
}
.template-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.template-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.template-card.selected h3 {
    color: var(--primary);
}
.template-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.template-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.6rem;
}
.template-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.template-group-tag {
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}
.template-card-empty {
    border-style: dashed;
}
.template-card-empty .template-meta {
    color: var(--text-muted);
}

/* JSON editor in create flow */
.json-editor-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}
.json-editor-body {
    margin-top: 1rem;
}
.json-editor-body textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    resize: vertical;
    line-height: 1.5;
}
.json-editor-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ── Upload dropzone ── */
.upload-intro {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
}
.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-subtle);
}
.upload-dropzone-content p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin: 0.5rem 0 0.25rem;
}
.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}
.upload-dropzone:hover .upload-icon,
.upload-dropzone.drag-over .upload-icon {
    color: var(--primary);
}
.upload-constraints {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ── Upload file list ── */
.upload-file-list {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 0.85rem;
}
.upload-file-list th,
.upload-file-list td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.upload-file-list th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.upload-file-list tbody tr:last-child td {
    border-bottom: none;
}
.upload-file-list .file-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.upload-file-list .file-link:hover {
    text-decoration: underline;
}

/* ── Schema reference ── */
.schema-reference {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.schema-reference summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
}
.schema-reference summary:hover {
    color: var(--primary);
}
.schema-content {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.schema-content code {
    background: var(--primary-subtle);
    color: var(--primary);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.8rem;
}
.schema-content ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}
.schema-content li {
    margin-bottom: 0.2rem;
}

/* ── Template buttons ── */
.template-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

/* ── Editor template bar ── */
.editor-template-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.editor-template-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.source-select {
    padding: 0.35rem 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    max-width: 220px;
}
.source-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Example download link ── */
.example-download-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.example-download-link:hover {
    text-decoration: underline;
}

/* ── Template selector (admin) ── */
.admin-form select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.admin-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Array groups */
.array-group {
    margin-top: 1.25rem;
    padding: 0;
}
.array-group-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.array-instance {
    padding: 1rem 1.25rem 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.array-instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.array-instance-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-secondary);
}
.btn-add-instance {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.btn-remove-instance {
    font-size: 0.82rem;
}

/* ── Sort headers ── */
.sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.sort-link:hover {
    color: var(--primary);
}
.sort-link.active {
    color: var(--primary);
}
.sort-arrow {
    font-size: 0.6rem;
    line-height: 1;
}

/* ── Pager ── */
.pager {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    min-width: 2.2rem;
    transition: all 0.15s;
}
.pager-link:hover:not(.current):not(.disabled) {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}
.pager-link.current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}
.pager-link.disabled {
    color: var(--text-muted);
    pointer-events: none;
    border-color: var(--border);
    opacity: 0.5;
}
.pager-ellipsis {
    padding: 0 0.25rem;
    color: var(--text-muted);
}
.pager-info {
    margin-left: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
