:root {
    --fb-primary: #4f5ee6;
    --fb-primary-dark: #3a46c4;
    --fb-primary-soft: #eef1ff;
    --fb-ink: #10183a;
    --fb-text: #1e293b;
    --fb-muted: #64748b;
    --fb-background: #f5f6fb;
    --fb-surface: #ffffff;
    --fb-border: #e4e8f1;
    --fb-radius-sm: 0.5rem;
    --fb-radius-md: 0.875rem;
    --fb-radius-lg: 1.25rem;
    --fb-radius-btn: 0.75rem;
    --fb-shadow-sm: 0 1px 2px rgba(16, 24, 58, 0.05);
    --fb-shadow-md: 0 16px 40px -22px rgba(79, 94, 230, 0.45);
    --fb-success: #0f8a62;
    --fb-success-soft: #e8f7f1;
    --fb-warning: #9a6700;
    --fb-warning-soft: #fff6e5;
    --fb-danger: #c03645;
    --fb-danger-soft: #fdecee;
    --fb-info: #3157c9;
    --fb-info-soft: #eef3ff;
    --bs-primary: #4f5ee6;
    --bs-primary-rgb: 79, 94, 230;
    --bs-body-color: #1e293b;
    --bs-body-font-family: Inter, "Segoe UI", sans-serif;
    --bs-border-radius: 0.75rem;
    --bs-border-color: #e4e8f1;
}

body {
    color: var(--fb-text);
    background: var(--fb-background);
    font-family: Inter, "Segoe UI", sans-serif;
    line-height: 1.5;
}

h1, h2, h3, .page-title {
    color: var(--fb-ink);
    letter-spacing: -0.02em;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 650;
    line-height: 1.15;
    margin: 0 0 0.35rem;
}

.page-lead {
    color: var(--fb-muted);
    margin: 0;
    max-width: 42rem;
}

.admin-body {
    background: var(--fb-background);
    min-height: 100vh;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 248px;
    background: var(--fb-surface);
    border-right: 1px solid var(--fb-border);
    padding: 1.25rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--fb-ink);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-decoration: none;
    padding: 0.35rem 0.55rem 1.15rem;
}

.brand-name {
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--fb-ink);
}

.admin-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    background: linear-gradient(160deg, #6d7cf0, var(--fb-primary-dark));
    box-shadow: var(--fb-shadow-sm);
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #475569;
    text-decoration: none;
    padding: 0.62rem 0.75rem;
    border-radius: 0.75rem;
    font-weight: 550;
    font-size: 0.95rem;
}

.admin-nav a svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}

.admin-nav a:hover,
.admin-nav a:focus-visible {
    background: #f8f9fd;
    color: var(--fb-ink);
}

.admin-nav a[aria-current="page"] {
    background: var(--fb-primary-soft);
    color: var(--fb-primary-dark);
}

.admin-user {
    margin-top: 1.5rem;
    padding: 0.85rem;
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-md);
    background: #fbfbfe;
}

.admin-user .who {
    font-weight: 600;
    color: var(--fb-ink);
}

.admin-user .mail {
    color: var(--fb-muted);
    font-size: 0.82rem;
    word-break: break-all;
    margin-bottom: 0.7rem;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 1.75rem 2rem 3rem;
}

.admin-content {
    max-width: 1120px;
}

.admin-content:has(.builder) {
    max-width: none;
}

.mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--fb-border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.btn {
    border-radius: var(--fb-radius-btn);
    font-weight: 600;
    padding: 0.5rem 1rem;
}

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

.btn-primary {
    background: var(--fb-primary);
    border-color: var(--fb-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--fb-primary-dark);
    border-color: var(--fb-primary-dark);
}

.btn-outline-primary {
    color: var(--fb-primary-dark);
    border-color: #c9d0fb;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--fb-primary-soft);
    color: var(--fb-primary-dark);
    border-color: #c9d0fb;
}

.btn-outline-secondary,
.btn-outline-light {
    border-color: var(--fb-border);
    color: #334155;
    background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-light:hover {
    background: #f8f9fd;
    color: var(--fb-ink);
    border-color: #d5dbe8;
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(79, 94, 230, 0.18);
    border-color: #9aa6f5;
}

.form-control,
.form-select {
    border-radius: 0.75rem;
    border-color: var(--fb-border);
    min-height: 44px;
}

.form-control-sm,
.form-select-sm {
    min-height: 36px;
    border-radius: 0.6rem;
}

.form-label {
    font-weight: 600;
    color: var(--fb-ink);
    font-size: 0.9rem;
}

.form-text,
.text-muted {
    color: var(--fb-muted) !important;
}

.card,
.surface {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-lg);
    box-shadow: var(--fb-shadow-sm);
}

.card-body {
    padding: 1.25rem 1.35rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.stat-card {
    display: block;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-lg);
    padding: 1.1rem 1.15rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--fb-shadow-sm);
    height: 100%;
}

a.stat-card:hover {
    border-color: #c9d0fb;
    box-shadow: var(--fb-shadow-md);
    color: inherit;
}

.stat-card span {
    display: block;
    color: var(--fb-muted);
    font-size: 0.86rem;
}

.stat-card strong {
    display: block;
    margin-top: 0.45rem;
    font-size: 1.85rem;
    letter-spacing: -0.04em;
    color: var(--fb-ink);
    font-weight: 680;
}

.table {
    --bs-table-bg: transparent;
    margin: 0;
}

.table thead th {
    color: var(--fb-muted);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom-color: var(--fb-border);
    padding: 0.9rem 1rem;
}

.table td {
    padding: 0.95rem 1rem;
    border-bottom-color: #eef1f6;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #fbfbfe;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.forms-page .page-head {
    align-items: center;
    margin-bottom: 1rem;
}

.forms-page .page-title {
    font-size: 1.625rem;
    margin-bottom: 0.2rem;
}

.forms-page .page-head .btn-primary {
    padding: 0.65rem 1.05rem;
    border-radius: 0.75rem;
    font-weight: 600;
}

.forms-list .table-responsive {
    overflow: visible;
}

.forms-list {
    container-type: inline-size;
}

.forms-table thead th {
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.8rem 1.1rem;
    border-bottom-color: #eef1f6;
}

.forms-table td {
    padding: 1rem 1.1rem;
    border-bottom-color: #eef1f6;
}

.forms-table tbody tr:last-child td {
    border-bottom: 0;
}

.forms-table tbody tr {
    transition: background-color 0.15s ease;
}

.forms-table tbody tr:hover {
    background: #f8fafc;
}

.forms-name {
    color: var(--fb-ink);
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.forms-source {
    margin-top: 0.18rem;
    color: var(--fb-muted);
    font-size: 0.84rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.forms-slug {
    font-size: 0.9rem;
    font-weight: 550;
}

.forms-table .fb-badge {
    padding: 0.12rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.forms-updated {
    color: #475569;
    font-size: 0.86rem;
    line-height: 1.35;
    white-space: nowrap;
}

.forms-time {
    display: block;
    color: var(--fb-muted);
    font-size: 0.8rem;
}

.forms-actions-cell {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.forms-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    vertical-align: middle;
}

.forms-actions form {
    display: contents;
}

.forms-actions .btn {
    min-height: 32px;
    white-space: nowrap;
}

.forms-actions .btn-outline-primary {
    min-width: 4.1rem;
    font-weight: 600;
}

.forms-actions .btn-outline-secondary {
    min-width: 5.5rem;
    color: #64748b;
    border-color: #e2e8f0;
    background: #fff;
    font-weight: 500;
}

.forms-actions .forms-submissions {
    min-width: 7.15rem;
}

.forms-actions .btn-outline-secondary:hover,
.forms-actions .btn-outline-secondary:focus {
    color: var(--fb-ink);
    background: #f8fafc;
    border-color: #d5dbe8;
}

.forms-actions .forms-status {
    min-width: 6.7rem;
}

.forms-delete {
    position: relative;
    flex: 0 0 28px;
}

.forms-delete::after {
    content: "Delete form";
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 2;
    padding: 0.32rem 0.45rem;
    border-radius: 0.4rem;
    background: #0f172a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.forms-delete:hover::after,
.forms-delete:focus-visible::after {
    opacity: 1;
}

@container (max-width: 640px) {
    .forms-list .forms-table thead {
        display: none;
    }

    .forms-list .forms-table,
    .forms-list .forms-table tbody,
    .forms-list .forms-table tr,
    .forms-list .forms-table td {
        display: block;
        width: auto;
    }

    .forms-list .forms-table tr {
        padding: 0.95rem 1rem 1rem;
        border-bottom: 1px solid #eef1f6;
    }

    .forms-list .forms-table tbody tr:last-child {
        border-bottom: 0;
    }

    .forms-list .forms-table td {
        border: 0;
        padding: 0.15rem 0;
    }

    .forms-list .forms-updated {
        white-space: normal;
    }

    .forms-list .forms-time {
        display: inline;
    }

    .forms-list .forms-time::before {
        content: " · ";
    }

    .forms-list .forms-actions-cell {
        white-space: normal;
        text-align: left;
    }

    .forms-list .forms-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 0.7rem;
    }
}

.ghl-list {
    min-width: 0;
}

.ghl-item {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #eef1f6;
}

.ghl-item:last-child {
    border-bottom: 0;
}

.ghl-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ghl-item-top strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ghl-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
    margin: 0.45rem 0 0.8rem;
}

.ghl-location {
    min-width: 0;
    color: var(--fb-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.ghl-item .row-actions form {
    margin: 0;
}

.fb-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.18rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 650;
    background: #f1f4f8;
    color: #334155;
}

.fb-badge::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

.fb-badge-active,
.fb-badge-success {
    background: var(--fb-success-soft);
    color: var(--fb-success);
}

.fb-badge-inactive,
.fb-badge-pending {
    background: #f1f4f8;
    color: #475569;
}

.fb-badge-failed,
.fb-badge-danger {
    background: var(--fb-danger-soft);
    color: var(--fb-danger);
}

.fb-badge-warning {
    background: var(--fb-warning-soft);
    color: var(--fb-warning);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state h2 {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.empty-state p {
    color: var(--fb-muted);
    margin-bottom: 1rem;
}

.alert {
    border: 0;
    border-radius: var(--fb-radius-md);
    padding: 0.85rem 1rem;
}

.alert-success {
    background: var(--fb-success-soft);
    color: #0c6b4c;
}

.alert-danger {
    background: var(--fb-danger-soft);
    color: #9f2232;
}

.alert-warning {
    background: var(--fb-warning-soft);
    color: #7a5200;
}

.alert-info {
    background: var(--fb-info-soft);
    color: #243f9a;
}

.modal-content {
    border: 0;
    border-radius: var(--fb-radius-lg);
    box-shadow: var(--fb-shadow-md);
}

.modal-header,
.modal-footer {
    border-color: var(--fb-border);
}

.pagination .page-link {
    border-radius: 0.6rem;
    margin: 0 0.15rem;
    color: var(--fb-primary-dark);
    border-color: var(--fb-border);
}

.pagination .page-item.active .page-link {
    background: var(--fb-primary);
    border-color: var(--fb-primary);
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(79, 94, 230, 0.16), transparent 32%),
        var(--fb-background);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border: 1px solid var(--fb-border);
    border-radius: 1.4rem;
    box-shadow: var(--fb-shadow-md);
}

.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 0 1.15rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--fb-radius-btn);
    font-size: 0.92rem;
    line-height: 1.4;
}

.auth-note-icon {
    display: inline-flex;
    flex: 0 0 auto;
    margin-top: 0.05rem;
}

.auth-note-success {
    background: #e7f8f1;
    color: #0c6b4c;
}

.auth-note-danger {
    background: var(--fb-danger-soft);
    color: #9f2232;
}

.auth-note-warning {
    background: var(--fb-warning-soft);
    color: #7a5200;
}

.auth-note-info {
    background: var(--fb-info-soft);
    color: #243f9a;
}

.builder {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 330px;
    gap: 1rem;
    align-items: start;
}

.builder-library,
.builder-canvas,
.builder-settings {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-lg);
    padding: 1rem;
    box-shadow: var(--fb-shadow-sm);
}

.builder-canvas {
    background: #f8fafc;
}

.builder-library,
.builder-settings {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 7.5rem);
}

.builder-settings {
    overflow-x: hidden;
    overflow-y: auto;
}

.builder-library {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.builder-library .panel-label {
    flex: 0 0 auto;
}

.fb-library-search {
    flex: 0 0 auto;
    margin-bottom: 0.75rem;
    background: var(--fb-surface);
}

#fb-library {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.panel-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fb-muted);
    margin-bottom: 0.75rem;
}

.fb-lib-group {
    margin-top: 1rem;
}

.fb-lib-group h3 {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fb-muted);
    margin-bottom: 0.45rem;
}

.fb-lib-item,
.builder .fb-field {
    border: 1px solid var(--fb-border);
    background: #fff;
    border-radius: 0.85rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.45rem;
}

.fb-lib-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
    cursor: grab;
    color: var(--fb-ink);
    font-weight: 600;
}

.fb-lib-item:hover:not(:disabled) {
    border-color: #c9d0fb;
    background: #fbfbfe;
}

.fb-lib-item.is-added,
.fb-lib-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.fb-mark {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fb-primary-soft);
    color: var(--fb-primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.builder .fb-field {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fff;
    box-shadow: none;
}

.builder .fb-field:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.builder .fb-field.is-selected {
    border-color: #4f5ee6;
    background: #f7f8ff;
    box-shadow: 0 0 0 3px rgba(79, 94, 230, 0.12);
}

.builder .fb-field-row {
    display: grid;
    grid-template-columns: 16px 28px minmax(0, 1fr) auto 28px;
    column-gap: 0.75rem;
    align-items: center;
}

.fb-field-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fb-ink);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.fb-field-key {
    margin-top: 0.1rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-field-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.fb-req {
    color: var(--fb-danger);
}

.fb-type-badge {
    justify-self: end;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.fb-drag,
.page-handle,
.fb-trash {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #5ba4d6;
    cursor: grab;
}

.fb-trash {
    width: 28px;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 0.4rem;
}

.builder .fb-field:hover .fb-drag,
.fb-page-head:hover .page-handle {
    color: #3d8fc4;
}

.builder .fb-field:hover .fb-trash,
.fb-page-head:hover .fb-trash {
    color: #64748b;
}

.fb-trash:hover,
.fb-trash:focus-visible {
    color: var(--fb-danger) !important;
    background: var(--fb-danger-soft);
}

.fb-drag:focus-visible,
.page-handle:focus-visible,
.fb-trash:focus-visible {
    outline: 2px solid #4f5ee6;
    outline-offset: 2px;
}

.fb-page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.fb-page-target {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    color: #64748b;
}

.fb-page-target strong {
    color: var(--fb-ink);
    font-weight: 650;
}

.fb-page-chip {
    border: 1px solid var(--fb-border);
    background: #fff;
    border-radius: var(--fb-radius-btn);
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

.fb-page-chip:hover,
.fb-page-chip:focus-visible {
    border-color: #c9d0fb;
    color: var(--fb-primary-dark);
}

.fb-page-chip.is-active,
.fb-page-chip.is-active:hover,
.fb-page-chip.is-active:focus-visible {
    background: #4f5ee6;
    border-color: #4f5ee6;
    color: #fff;
}

.fb-page-chip.is-active:focus-visible {
    outline: 2px solid #4f5ee6;
    outline-offset: 2px;
}

.builder .fb-page {
    display: block;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0.15rem;
    margin-bottom: 1rem;
    background: transparent;
}

.builder .fb-page.is-target {
    border-color: #c9d0fb;
    background: #f7f8ff;
    padding: 0.85rem;
}

.fb-adding-pill {
    justify-self: end;
    background: #4f5ee6;
    color: #fff;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 650;
    white-space: nowrap;
}

.fb-drop-hint {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.fb-page-head {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto 28px;
    column-gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.85rem;
}

.fb-page-title {
    width: 100%;
    min-width: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--fb-ink);
    box-shadow: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-page-title:focus {
    outline: none;
    box-shadow: 0 1px 0 #4f5ee6;
}

.fb-field-copy {
    min-width: 0;
    overflow: hidden;
}

.fb-section-title {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fb-muted);
    margin: 1rem 0 0.55rem;
}

.fb-rule {
    border: 1px solid var(--fb-border);
    border-radius: 0.85rem;
    padding: 0.75rem;
    margin-bottom: 0.55rem;
    background: #fbfbfe;
}

.fb-preview-sample {
    border: 1px solid var(--fb-border);
    border-radius: 0.9rem;
    padding: 0.85rem;
    margin-bottom: 0.9rem;
}

.fb-color {
    display: block;
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius-btn);
    background: #fff;
    cursor: pointer;
}

.fb-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.fb-color::-webkit-color-swatch,
.fb-color::-moz-color-swatch {
    border: 0;
    border-radius: 0.4rem;
}

.fb-lib-loading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--fb-muted);
    font-size: 0.85rem;
    padding: 0.15rem 0 0.8rem;
}

.fb-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--fb-border);
    border-top-color: var(--fb-primary);
    border-radius: 50%;
    animation: fb-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

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

.page-head:has(+ .public-link) {
    margin-bottom: 0.75rem;
}

.public-link {
    margin: 0 0 1.25rem;
}

.public-link-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    width: 100%;
}

.public-link-row input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    color: #4f5ee6;
    font-weight: 600;
}

a.fb-link,
a.fb-link:visited {
    color: #4f5ee6;
    font-weight: 650;
    text-decoration: none;
}

.fb-link:hover,
.fb-link:focus-visible {
    color: var(--fb-primary-dark);
}

.fb-preview-sample button {
    border: 0;
    color: #fff;
    border-radius: var(--fb-radius-btn);
    padding: 0.4rem 0.9rem;
    font-weight: 650;
}

.builder-settings .nav-tabs {
    display: flex;
    justify-content: space-evenly;
    align-items: flex-end;
    flex-wrap: nowrap;
    overflow: visible;
    border-bottom: 1px solid var(--fb-border);
    width: 100%;
}

.builder-settings .nav-item {
    flex: 0 0 auto;
}

.builder-settings .nav-link {
    display: block;
    width: auto;
    border: 0;
    border-radius: 0.6rem 0.6rem 0 0;
    color: var(--fb-muted);
    font-weight: 650;
    font-size: 0.86rem;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    padding: 0.55rem 0.15rem;
}

.builder-settings .nav-link.active {
    color: var(--fb-primary-dark);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--fb-primary);
}

.sortable-ghost {
    opacity: 0.45;
}

.fb-body {
    min-height: 100vh;
    padding: 2.5rem 1rem;
}

.fb-shell {
    margin: 0 auto;
    background: #fff;
    border-radius: 1.4rem;
    padding: 2rem 1.6rem 1.6rem;
    box-shadow: 0 24px 60px -32px rgba(16, 24, 58, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.7);
    container-type: inline-size;
}

.fb-logo {
    max-height: 64px;
    max-width: 220px;
    margin-bottom: 1rem;
}

.fb-form-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.35rem;
}

.fb-form-head-copy {
    min-width: 0;
}

.fb-shell h1 {
    font-size: 1.625rem;
    font-weight: 600;
    line-height: 1.25;
    margin: 0;
}

.fb-lead {
    color: #526074;
    margin: 0.45rem 0 0;
}

.fb-progress {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #f4f6fb;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 650;
    padding: 0.25rem 0.7rem;
    margin-bottom: 1rem;
}

.fb-shell .fb-steps {
    margin: 0 0 1.35rem;
}

.fb-shell .fb-step-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.35rem;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fb-shell .fb-step {
    flex: 0 0 auto;
    max-width: 100%;
}

.fb-shell .fb-step-track {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: #e6eaf2;
    overflow: hidden;
}

.fb-shell .fb-step-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--fb-form-accent, var(--fb-primary));
}

.fb-shell .fb-step-label {
    display: inline-block;
    max-width: 11rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.fb-shell .fb-step.is-current .fb-step-label {
    color: var(--fb-form-accent, var(--fb-primary));
    border-bottom-color: var(--fb-form-accent, var(--fb-primary));
}

.fb-shell .fb-step-count {
    flex: 0 0 auto;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.fb-shell .fb-step-slash {
    display: none;
}

.fb-shell .fb-steps-compact {
    align-items: center;
}

.fb-shell .fb-steps-compact .fb-step-track {
    flex: 1 1 auto;
}

.fb-shell .fb-page-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fb-ink);
    margin: 0 0 1.1rem;
}

.fb-shell .fb-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    row-gap: 0.95rem;
}

.fb-shell .fb-field {
    min-width: 0;
}

.fb-shell .fb-field.is-full,
.fb-shell .fb-field[data-layout="wide"] {
    grid-column: 1 / -1;
}

.fb-shell .fb-field.is-half {
    grid-column: auto;
}

.fb-shell .fb-field[data-layout="skip"] {
    display: none;
}

.fb-shell .form-label,
.fb-shell legend.form-label {
    font-weight: 650;
    margin-bottom: 0.4rem;
}

.fb-shell .form-control,
.fb-shell .form-select {
    min-height: 48px;
    border-radius: 0.8rem;
    border-color: #dbe1ea;
    padding: 0.65rem 0.85rem;
}

.fb-shell .form-control::placeholder {
    color: #94a3b8;
}

.fb-shell .fb-field.has-error .form-control,
.fb-shell .fb-field.has-error .form-select,
.fb-shell .form-control[aria-invalid="true"],
.fb-shell .form-select[aria-invalid="true"] {
    border-color: var(--fb-danger);
    background: #fff8f8;
}

.fb-shell .invalid-feedback {
    color: var(--fb-danger);
    font-size: 0.84rem;
    margin-top: 0.35rem;
}

.fb-shell .invalid-feedback:empty {
    display: none;
}

.fb-shell .fb-choice {
    border: 1px solid #dbe1ea;
    border-radius: 0.8rem;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.45rem;
    min-height: 44px;
}

.fb-shell .fb-choice:has(input:checked) {
    border-color: var(--fb-form-accent, var(--fb-primary));
    background: color-mix(in srgb, var(--fb-form-accent, var(--fb-primary)) 10%, white);
}

.fb-actions {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    margin-top: 1.5rem;
}

.fb-shell .fb-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 0;
    border-radius: var(--fb-radius-btn);
    line-height: 1.2;
}

.fb-shell .fb-submit,
.fb-shell .fb-next {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.7rem 1.2rem;
    font-weight: 700;
}

.fb-shell .fb-prev {
    flex: 0 0 7.5rem;
    padding: 0.7rem 1rem;
    background: #fff;
    border: 1px solid #d5dbe6;
    color: #334155;
    font-weight: 650;
}

.fb-shell .fb-prev:hover,
.fb-shell .fb-prev:focus {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.fb-shell .fb-submit:disabled,
.fb-shell .fb-next:disabled {
    opacity: 0.7;
}

.fb-success {
    text-align: center;
    padding: 1.5rem 0.5rem 0.5rem;
}

.fb-success-mark {
    width: 3.2rem;
    height: 3.2rem;
    margin: 0 auto 0.9rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fb-success-soft);
    color: var(--fb-success);
    font-size: 1.4rem;
    font-weight: 700;
}

.fb-success-title {
    font-size: 1.45rem;
    margin-bottom: 0.4rem;
}

.fb-page {
    display: none;
}

.fb-page.is-active {
    display: block;
}

.fb-hp {
    position: absolute !important;
    left: -10000px !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .builder {
        grid-template-columns: 1fr;
    }

    .builder-library,
    .builder-settings {
        position: static;
        max-height: none;
    }

    .builder-library {
        max-height: 22rem;
    }
}

@media (max-width: 767px) {
    .mobile-bar {
        display: flex;
    }

    .admin-sidebar {
        display: none !important;
    }

    .admin-main {
        padding: 1.1rem 1rem 2.5rem;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .forms-page .page-head {
        align-items: flex-start;
    }

    .forms-page .page-head .btn-primary {
        align-self: flex-start;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .fb-body {
        padding: 1rem 0.75rem 2rem;
    }

    .fb-shell {
        padding: 1.25rem 1rem;
        border-radius: 1rem;
    }

    .fb-shell .fb-step-prefix,
    .fb-shell .fb-step-of {
        display: none;
    }

    .fb-shell .fb-step-slash {
        display: inline;
    }
}

@container (max-width: 520px) {
    .fb-shell .fb-field.is-half {
        grid-column: 1 / -1;
    }

    .fb-shell .fb-steps {
        flex-direction: column;
        align-items: stretch;
    }
}

.builder-canvas {
    container-type: inline-size;
}

@container (max-width: 420px) {
    .builder .fb-field-row {
        grid-template-columns: 16px 28px minmax(0, 1fr) 28px;
        row-gap: 0.3rem;
    }

    .builder .fb-type-badge {
        grid-column: 3;
        grid-row: 2;
        justify-self: start;
    }

    .builder .fb-field-row .fb-trash {
        grid-column: 4;
        grid-row: 1;
    }
}
