/* ==========================================================================
   Alpha Styles — live form styler
   ========================================================================== */

:root {
    --agf-bg: #f6f7fb;
    --agf-surface: #ffffff;
    --agf-surface-2: #f8f9fc;
    --agf-surface-3: #f1f2f7;
    --agf-border: #e7e8f0;
    --agf-border-strong: #d9dbe6;
    --agf-text: #12142a;
    --agf-text-2: #2c3048;
    --agf-muted: #6b7088;
    --agf-subtle: #9a9fb5;
    --agf-primary: #6d4aff;
    --agf-primary-600: #5a36f0;
    --agf-primary-50: #f2efff;
    --agf-primary-100: #e5deff;
    --agf-grad: linear-gradient(135deg, #6d4aff 0%, #a14dff 55%, #d14dff 100%);
    --agf-success: #16a34a;
    --agf-warning: #f59e0b;
    --agf-danger: #e5484d;
    --agf-ring: 0 0 0 3px rgba(109, 74, 255, 0.18);
    --agf-shadow-sm: 0 1px 2px rgba(18, 20, 42, 0.06);
    --agf-shadow-md: 0 6px 16px -6px rgba(18, 20, 42, 0.14), 0 2px 6px -2px rgba(18, 20, 42, 0.06);
    --agf-shadow-lg: 0 24px 48px -16px rgba(18, 20, 42, 0.22), 0 8px 16px -8px rgba(18, 20, 42, 0.1);
    --agf-checker: conic-gradient(#e6e8ef 25%, #ffffff 0 50%, #e6e8ef 0 75%, #ffffff 0) 0 0 / 8px 8px;
    --agf-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Alpha Addons dashboard brand (assets/css/alphagf_dashboard.css). */
    --agf-brand: #f08f80;
    --agf-brand-dark: #c8584a;
    --agf-brand-soft: #fdeae6;
    --agf-brand-navy: #152036;
    --agf-topbar: 60px;
    --agf-sidebar: 372px;
}

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

html,
body.agf {
    height: 100%;
}

body.agf {
    margin: 0;
    overflow: hidden;
    background: var(--agf-bg);
    color: var(--agf-text);
    font: 400 13px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.agf button,
.agf input,
.agf select {
    font: inherit;
    color: inherit;
}

.agf button {
    cursor: pointer;
}

.agf button:focus-visible,
.agf a:focus-visible {
    outline: none;
    box-shadow: var(--agf-ring);
}

.agf [hidden] {
    display: none !important;
}

.agf-icon {
    display: block;
    flex-shrink: 0;
}

/* ---------- App shell ---------- */

.agf-app {
    display: grid;
    grid-template-rows: var(--agf-topbar) minmax(0, 1fr);
    height: 100vh;
}

.agf-topbar {
    position: relative;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 0 14px 0 12px;
    background: var(--agf-surface);
    border-bottom: 1px solid var(--agf-border);
}

.agf-topbar__left,
.agf-topbar__center,
.agf-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.agf-topbar__right {
    justify-content: flex-end;
}

.agf-brand {
    flex-shrink: 0;
    padding: 0 14px 0 6px;
    margin-right: 2px;
    border-right: 1px solid var(--agf-border);
    color: var(--agf-brand-navy);
    font-weight: 700;
    font-size: 15px;
    line-height: 30px;
    letter-spacing: -0.015em;
    white-space: nowrap;
}

/* Form switcher trigger */
.agf-formswitch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 300px;
    height: 36px;
    padding: 0 10px 0 5px;
    border: 1px solid var(--agf-border);
    border-radius: 10px;
    background: var(--agf-surface);
    color: var(--agf-text) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.agf-formswitch:hover {
    border-color: var(--agf-border-strong);
    background: var(--agf-surface-2);
}

.agf-formswitch.is-open {
    border-color: var(--agf-brand);
    box-shadow: 0 0 0 3px var(--agf-brand-soft);
}

.agf-formswitch__icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 7px;
    background: var(--agf-brand-soft);
    color: var(--agf-brand-dark);
}

.agf-formswitch__title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-formswitch__id {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--agf-surface-3);
    color: var(--agf-muted);
    font-weight: 600;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.agf-formswitch__chev {
    flex-shrink: 0;
    color: var(--agf-subtle);
    transition: transform 0.2s var(--agf-ease);
}

.agf-formswitch.is-open .agf-formswitch__chev {
    transform: rotate(180deg);
}

.agf-body {
    display: grid;
    grid-template-columns: var(--agf-sidebar) minmax(0, 1fr);
    min-height: 0;
}

/* ---------- Buttons ---------- */

.agf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    font-weight: 600 !important;
    font-size: 13px !important;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

.agf-btn:active {
    transform: translateY(1px);
}

.agf-btn--primary {
    background: var(--agf-grad);
    color: #fff !important;
    box-shadow: 0 8px 18px -8px rgba(109, 74, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.agf-btn--primary:hover {
    filter: brightness(1.06) saturate(1.05);
}

.agf-btn--primary.is-loading {
    cursor: progress;
    filter: saturate(0.7);
}

.agf-btn--primary.is-loading .agf-icon {
    animation: agf-pulse 0.9s ease-in-out infinite;
}

.agf-btn--primary.is-done {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 8px 18px -8px rgba(22, 163, 74, 0.7);
}

/* Save: matches the Alpha Addons dashboard buttons (solid coral, inverts on hover). */
.agf-btn--brand {
    min-width: 92px;
    border-color: var(--agf-brand);
    border-radius: 6px;
    background: var(--agf-brand);
    color: #fff !important;
    box-shadow: 0 6px 16px -8px rgba(240, 143, 128, 0.9);
}

.agf-btn--brand:hover {
    background: #fff;
    color: var(--agf-brand-dark) !important;
    box-shadow: none;
}

.agf-btn--brand:focus-visible {
    box-shadow: 0 0 0 3px var(--agf-brand-soft) !important;
}

.agf-btn--brand.is-loading {
    cursor: progress;
    opacity: 0.85;
}

.agf-btn--brand.is-loading .agf-icon {
    animation: agf-pulse 0.9s ease-in-out infinite;
}

.agf-btn--brand.is-done,
.agf-btn--brand.is-done:hover {
    border-color: #16a34a;
    background: #16a34a;
    color: #fff !important;
}

.agf-btn--ghost {
    background: var(--agf-surface);
    border-color: var(--agf-border);
    color: var(--agf-text-2) !important;
}

.agf-btn--ghost:hover {
    background: var(--agf-surface-2);
    border-color: var(--agf-border-strong);
}

.agf-btn--soft {
    background: var(--agf-primary-50);
    color: var(--agf-primary) !important;
}

.agf-btn--soft:hover {
    background: var(--agf-primary-100);
}

.agf-btn--danger {
    background: var(--agf-danger);
    color: #fff !important;
}

.agf-btn--danger:hover {
    filter: brightness(0.95);
}

.agf-btn--sm {
    height: 30px;
    padding: 0 10px;
    gap: 5px;
    border-radius: 8px;
    font-size: 12px !important;
}

.agf-iconbtn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--agf-muted) !important;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.agf-iconbtn:hover:not(:disabled) {
    background: var(--agf-surface-3);
    color: var(--agf-text) !important;
}

.agf-iconbtn:disabled {
    opacity: 0.35;
    cursor: default;
}

.agf-iconbtn--xs {
    width: 26px;
    height: 26px;
    border-radius: 7px;
}

.agf-btngroup {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 6px;
    margin-right: 2px;
    border-right: 1px solid var(--agf-border);
}

.agf-only-compact {
    display: none !important;
}

/* Tooltips */
[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 60;
    padding: 5px 8px;
    border-radius: 7px;
    background: #12142a;
    color: #fff;
    font: 500 11px/1.2 Inter, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -3px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

[data-tip]:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 0.35s;
}

[data-tip]:disabled::after {
    display: none;
}

/* ---------- Status ---------- */

.agf-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 6px;
    color: var(--agf-muted);
    font-size: 12px;
    white-space: nowrap;
}

.agf-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.agf-status.is-dirty .agf-status__dot {
    background: var(--agf-warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    animation: agf-pulse 1.6s ease-in-out infinite;
}

.agf-status.is-dirty {
    color: #a16207;
}

/* ---------- Segmented ---------- */

.agf-segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 11px;
    background: var(--agf-surface-3);
}

.agf-segmented button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--agf-muted);
    font-weight: 500 !important;
    font-size: 12.5px !important;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.agf-segmented button:hover {
    color: var(--agf-text);
}

.agf-segmented button.is-active {
    background: var(--agf-surface);
    color: var(--agf-text);
    box-shadow: var(--agf-shadow-sm), 0 0 0 1px rgba(18, 20, 42, 0.04);
}

.agf-segmented--icons button {
    width: 36px;
    padding: 0;
}

.agf-segmented--icons button.is-active {
    color: var(--agf-primary);
}

.agf-segmented--sm {
    padding: 2px;
    border-radius: 9px;
}

.agf-segmented--sm button {
    height: 26px;
    min-width: 32px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12px !important;
}

.agf-segmented--sm button.is-active {
    color: var(--agf-primary);
}

/* Full-width option row under the label (e.g. button alignment). */
.agf-segmented--block {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

.agf-segmented--block button {
    flex: 1;
    min-width: 0;
}

/* ---------- Choice layout (per field) ---------- */

.agf-layout__picker {
    width: 170px;
    max-width: 100%;
}

.agf-layout__layout .agf-segmented--block button span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.agf-layout__field {
    margin-top: 2px;
    padding: 2px 12px 8px;
    border-radius: 10px;
    background: var(--agf-surface-2);
}

/* Image Picker option labels ("Columns · Desktop", "Use form setting (…)") need the full width. */
.agf-imgp__field .agf-control.is-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.agf-imgp__field .agf-control.is-inline .agf-control__field,
.agf-imgp__field .agf-control.is-inline .agf-select-wrap,
.agf-imgp__field .agf-control.is-inline .agf-select {
    width: 100%;
    max-width: none;
}

.agf-layout__field .agf-control.is-unused,
.agf-layout__field[data-layout]:not([data-layout="columns"]) .agf-layout__columns,
.agf-layout__field[data-layout]:not([data-layout="columns"]) .agf-layout__flow {
    display: none;
}

.agf-layout__layout .agf-segmented--block button {
    gap: 6px;
}

/* ---------- Responsive editing ---------- */

.agf-devicebar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--agf-brand-soft);
    border-radius: 12px;
    background: #fff7f5;
}

.agf-devicebar__icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--agf-brand);
    color: #fff;
}

.agf-devicebar__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.agf-devicebar__title {
    color: var(--agf-brand-navy);
    font-size: 13px;
}

.agf-devicebar__hint {
    color: var(--agf-muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.agf-devicebar__back {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--agf-brand-dark) !important;
    white-space: nowrap;
}

.agf-devicebar__back:hover {
    color: var(--agf-brand-navy) !important;
}

.agf-control__device {
    display: none;
    flex-shrink: 0;
    color: var(--agf-brand-dark);
}

.agf-control__device > span {
    display: none;
}

body[data-editing="tablet"] .agf-control__device,
body[data-editing="mobile"] .agf-control__device,
body[data-editing="tablet"] .agf-control__device .is-tablet,
body[data-editing="mobile"] .agf-control__device .is-mobile {
    display: inline-flex;
}

/* Value comes from a larger screen: show it, but quieter than a value set for this device. */
.agf-control.is-inherited .agf-color,
.agf-control.is-inherited .agf-num,
.agf-control.is-inherited .agf-range,
.agf-control.is-inherited .agf-select,
.agf-control.is-inherited .agf-segmented,
.agf-control.is-inherited .agf-switch,
.agf-control.is-inherited .agf-spacing {
    opacity: 0.6;
}

/* ---------- Sidebar ---------- */

.agf-sidebar {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--agf-surface);
    border-right: 1px solid var(--agf-border);
}

.agf-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 6px 14px 0;
    border-bottom: 1px solid var(--agf-border);
}

.agf-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    border: 0;
    background: none;
    color: var(--agf-muted);
    font-weight: 600 !important;
    font-size: 13px !important;
    transition: color 0.15s ease;
}

.agf-tabs button:hover {
    color: var(--agf-text);
}

.agf-tabs button.is-active {
    color: var(--agf-primary);
}

.agf-tabs__ink {
    position: absolute;
    bottom: -1px;
    left: 14px;
    width: calc(50% - 14px);
    height: 2px;
    border-radius: 2px;
    background: var(--agf-grad);
    transition: transform 0.3s var(--agf-ease);
}

.agf-tabs[data-active="themes"] .agf-tabs__ink {
    transform: translateX(100%);
}

.agf-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 14px 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--agf-border-strong) transparent;
}

.agf-sidebar__foot {
    padding: 10px 16px;
    border-top: 1px solid var(--agf-border);
    color: var(--agf-subtle);
    font-size: 11.5px;
    text-align: center;
}

.agf-search {
    position: relative;
    margin-bottom: 12px;
}

.agf-search .agf-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    color: var(--agf-subtle);
    transform: translateY(-50%);
    pointer-events: none;
}

.agf-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--agf-border);
    border-radius: 10px;
    background: var(--agf-surface-2);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.agf-search input:focus {
    border-color: var(--agf-primary);
    background: var(--agf-surface);
    box-shadow: var(--agf-ring);
}

.agf-empty {
    margin: 24px 0;
    color: var(--agf-muted);
    text-align: center;
}

/* ---------- Sections (accordion) ---------- */

.agf-section {
    --agf-tint: var(--agf-primary);
    --agf-tint-bg: var(--agf-primary-50);
    margin-bottom: 10px;
    border: 1px solid var(--agf-border);
    border-radius: 14px;
    background: var(--agf-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agf-section[data-section="heading"] {
    --agf-tint: #2563eb;
    --agf-tint-bg: #eaf1ff;
}

.agf-section[data-section="progressbar"] {
    --agf-tint: #7c3aed;
    --agf-tint-bg: #f1ecfe;
}

.agf-section[data-section="steps"] {
    --agf-tint: #0284c7;
    --agf-tint-bg: #e3f2fb;
}

.agf-section[data-section="labels"] {
    --agf-tint: #0891b2;
    --agf-tint-bg: #e3f6fa;
}

.agf-section[data-section="sublabels"] {
    --agf-tint: #4f46e5;
    --agf-tint-bg: #eef0ff;
}

.agf-section[data-section="descriptions"] {
    --agf-tint: #ca8a04;
    --agf-tint-bg: #fdf6e1;
}

.agf-section[data-section="inputs"] {
    --agf-tint: #059669;
    --agf-tint-bg: #e6f7f0;
}

.agf-section[data-section="dropdowns"] {
    --agf-tint: #9333ea;
    --agf-tint-bg: #f5ebfe;
}

.agf-section[data-section="checkboxes"] {
    --agf-tint: #db2777;
    --agf-tint-bg: #fdebf3;
}

.agf-section[data-section="radios"] {
    --agf-tint: #65a30d;
    --agf-tint-bg: #f0f7e4;
}

.agf-section[data-section="sectionbreak"] {
    --agf-tint: #0d9488;
    --agf-tint-bg: #e3f5f3;
}

.agf-section[data-section="errors"] {
    --agf-tint: #dc2626;
    --agf-tint-bg: #fdecec;
}

.agf-section[data-section="confirmation"] {
    --agf-tint: #16a34a;
    --agf-tint-bg: #e8f7ee;
}

.agf-section[data-section="buttons"] {
    --agf-tint: #ea580c;
    --agf-tint-bg: #fff1e8;
}

.agf-section:hover {
    border-color: var(--agf-border-strong);
}

.agf-section.is-open {
    border-color: var(--agf-border-strong);
    box-shadow: var(--agf-shadow-md);
}

.agf-section.is-flash {
    animation: agf-flash 1.1s ease;
}

.agf-section,
.agf-group {
    scroll-margin-top: 8px;
}

.agf-group.is-flash {
    animation: agf-group-flash 1.4s ease;
}

@keyframes agf-group-flash {
    0%,
    35% {
        background: var(--agf-tint-bg);
        box-shadow: -14px 0 0 var(--agf-tint-bg), 14px 0 0 var(--agf-tint-bg);
    }

    100% {
        background: transparent;
        box-shadow: -14px 0 0 transparent, 14px 0 0 transparent;
    }
}

.agf-section__head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px 12px 12px;
    border: 0;
    border-radius: 14px;
    background: none;
    text-align: left;
}

.agf-section__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--agf-tint-bg);
    color: var(--agf-tint);
    transition: transform 0.25s var(--agf-ease);
}

.agf-section.is-open .agf-section__icon {
    transform: scale(1.05) rotate(-4deg);
}

.agf-section__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.agf-section__title {
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: -0.005em;
}

.agf-section__desc {
    overflow: hidden;
    color: var(--agf-muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-section__badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--agf-tint);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
}

.agf-section__chev {
    color: var(--agf-subtle);
    transition: transform 0.25s var(--agf-ease), color 0.15s ease;
}

.agf-section.is-open .agf-section__chev {
    color: var(--agf-text);
    transform: rotate(180deg);
}

.agf-section__body {
    display: grid;
    /* minmax(0, 1fr): wide controls must not stretch the section past the sidebar. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s var(--agf-ease);
}

.agf-section.is-open .agf-section__body,
.agf-section.is-searching .agf-section__body {
    grid-template-rows: 1fr;
}

.agf-section__inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 14px;
}

.agf-section.is-open .agf-section__inner,
.agf-section.is-searching .agf-section__inner {
    overflow: visible;
}

.agf-group {
    padding: 2px 0 12px;
    border-top: 1px dashed var(--agf-border);
}

.agf-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 4px;
}

.agf-group__title {
    color: var(--agf-subtle);
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.agf-group__hint {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 6px 0 4px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--agf-surface-2);
    color: var(--agf-muted);
    font-size: 12px;
}

.agf-group__hint .agf-icon {
    margin-top: 2px;
    color: var(--agf-tint);
}

.agf-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--agf-muted);
    font-weight: 500 !important;
    font-size: 11.5px !important;
}

.agf-link:hover {
    color: var(--agf-danger);
}

/* ---------- Controls ---------- */

.agf-control {
    padding: 7px 0;
}

.agf-control.is-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.agf-control__head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.agf-control:not(.is-inline) .agf-control__head .agf-control__label {
    flex: 1;
}

.agf-control__label {
    position: relative;
    overflow: hidden;
    color: var(--agf-text-2);
    font-weight: 500;
    font-size: 12.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-control.is-set .agf-control__label {
    padding-left: 11px;
    color: var(--agf-text);
}

.agf-control.is-set .agf-control__label::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--agf-tint);
    transform: translateY(-50%);
}

.agf-control__reset {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--agf-subtle);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.agf-control.is-set .agf-control__reset {
    opacity: 1;
    pointer-events: auto;
}

.agf-control__reset:hover {
    background: var(--agf-surface-3);
    color: var(--agf-tint);
}

.agf-control__field {
    display: flex;
    flex-shrink: 0;
    align-items: center;
}

.agf-input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--agf-border);
    border-radius: 9px;
    background: var(--agf-surface);
    color: var(--agf-text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agf-input:focus {
    border-color: var(--agf-primary);
    box-shadow: var(--agf-ring);
}

.agf-input--lg {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
}

.agf-input.is-invalid {
    border-color: var(--agf-danger);
    box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.15);
}

/* Color */
.agf-color {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 156px;
    padding: 3px;
    border: 1px solid var(--agf-border);
    border-radius: 10px;
    background: var(--agf-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agf-color:hover {
    border-color: var(--agf-border-strong);
}

.agf-color:focus-within {
    border-color: var(--agf-primary);
    box-shadow: var(--agf-ring);
}

.agf-swatch {
    position: relative;
    width: 30px;
    height: 26px;
    flex-shrink: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 7px;
    background: var(--agf-checker);
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.1);
}

.agf-swatch span {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.08);
}

.agf-swatch.is-empty {
    background: var(--agf-surface-2);
}

.agf-swatch.is-empty span {
    background: linear-gradient(135deg, transparent calc(50% - 0.75px), #e5484d calc(50% - 0.75px), #e5484d calc(50% + 0.75px), transparent calc(50% + 0.75px)) !important;
    opacity: 0.55;
}

.agf-input--color {
    flex: 1;
    min-width: 0;
    height: 26px;
    padding: 0 4px;
    border: 0;
    background: none;
    font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    box-shadow: none !important;
}

.agf-input--color::placeholder {
    color: var(--agf-subtle);
    font-family: Inter, sans-serif;
}

/* Range */
.agf-num {
    display: flex;
    align-items: center;
    width: 72px;
    height: 28px;
    padding: 0 8px 0 4px;
    border: 1px solid var(--agf-border);
    border-radius: 8px;
    background: var(--agf-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agf-num:focus-within {
    border-color: var(--agf-primary);
    box-shadow: var(--agf-ring);
}

.agf-input--num {
    width: 100%;
    min-width: 0;
    height: 24px;
    padding: 0 2px;
    border: 0;
    background: none;
    font-weight: 600;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    box-shadow: none !important;
    -moz-appearance: textfield;
}

.agf-input--num::-webkit-outer-spin-button,
.agf-input--num::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.agf-num__unit {
    margin-left: 2px;
    color: var(--agf-subtle);
    font-size: 11px;
}

.agf-range {
    --agf-fill: 0%;
    width: 100%;
    height: 6px;
    margin: 10px 0 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--agf-tint, var(--agf-primary)) 0 var(--agf-fill), #e6e8f0 var(--agf-fill) 100%);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.agf-range::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid var(--agf-tint, var(--agf-primary));
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(18, 20, 42, 0.18);
    transition: transform 0.15s ease;
    -webkit-appearance: none;
}

.agf-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--agf-tint, var(--agf-primary));
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(18, 20, 42, 0.18);
}

.agf-range:hover::-webkit-slider-thumb,
.agf-range:focus-visible::-webkit-slider-thumb {
    transform: scale(1.12);
}

.agf-range:focus-visible::-webkit-slider-thumb {
    box-shadow: var(--agf-ring);
}

.agf-range.is-empty::-webkit-slider-thumb {
    border-color: var(--agf-border-strong);
}

.agf-range.is-empty::-moz-range-thumb {
    border-color: var(--agf-border-strong);
}

/* Select */
.agf-select-wrap {
    position: relative;
}

.agf-select {
    width: 156px;
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--agf-border);
    border-radius: 9px;
    background: var(--agf-surface);
    font-size: 12.5px !important;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agf-select:hover {
    border-color: var(--agf-border-strong);
}

.agf-select:focus {
    border-color: var(--agf-primary);
    box-shadow: var(--agf-ring);
}

.agf-select-wrap > span {
    position: absolute;
    top: 50%;
    right: 9px;
    color: var(--agf-subtle);
    transform: translateY(-50%);
    pointer-events: none;
}

/* Text style toggles (multi-select) */
.agf-segmented--multi button {
    width: 32px;
    min-width: 0;
    padding: 0;
}

/* Spacing: top / right / bottom / left */
.agf-spacing {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) 30px;
    align-items: start;
    gap: 6px;
    margin-top: 8px;
}

.agf-spacing__side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.agf-spacing__side .agf-input--num {
    width: 100%;
    height: 30px;
    padding: 0 4px;
    border: 1px solid var(--agf-border);
    border-radius: 8px;
    background: var(--agf-surface);
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agf-spacing__side .agf-input--num:focus {
    border-color: var(--agf-tint, var(--agf-primary));
    box-shadow: var(--agf-ring) !important;
}

.agf-spacing__side span {
    color: var(--agf-subtle);
    font-size: 10.5px;
}

.agf-spacing__link {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--agf-border);
    border-radius: 8px;
    background: var(--agf-surface);
    color: var(--agf-subtle);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.agf-spacing__link:hover {
    color: var(--agf-text);
}

.agf-spacing__link.is-active {
    border-color: transparent;
    background: var(--agf-tint-bg, var(--agf-primary-50));
    color: var(--agf-tint, var(--agf-primary));
}

/* Switch */
.agf-switch {
    position: relative;
    width: 38px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #d8dbe6;
    transition: background 0.2s ease;
}

.agf-switch span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(18, 20, 42, 0.25);
    transition: transform 0.25s var(--agf-ease);
}

.agf-switch[aria-checked="true"] {
    background: var(--agf-tint, var(--agf-primary));
}

.agf-switch[aria-checked="true"] span {
    transform: translateX(16px);
}

/* ---------- Themes ---------- */

.agf-themes__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 2px 12px;
}

.agf-themes__head h3 {
    margin: 0;
    font-weight: 650;
    font-size: 13px;
}

.agf-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    margin-bottom: 26px;
}

.agf-theme {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.agf-theme__preview {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3.3;
    padding: 12px;
    border: 1px solid var(--agf-border);
    border-radius: 13px;
    background: #eef0f6 radial-gradient(rgba(18, 20, 42, 0.07) 1px, transparent 1.2px) 0 0 / 10px 10px;
    transition: transform 0.2s var(--agf-ease), box-shadow 0.2s ease, border-color 0.2s ease;
}

.agf-theme__preview:hover {
    border-color: var(--agf-border-strong);
    box-shadow: var(--agf-shadow-md);
    transform: translateY(-2px);
}

.agf-theme.is-active .agf-theme__preview {
    border-color: var(--agf-primary);
    box-shadow: 0 0 0 3px var(--agf-primary-100);
}

.agf-theme__check {
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--agf-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(109, 74, 255, 0.5);
    transform: scale(0);
    transition: transform 0.25s var(--agf-ease);
}

.agf-theme.is-active .agf-theme__check {
    transform: scale(1);
}

.agf-mock {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 100%;
    padding: 10px;
    border: 1px solid rgba(18, 20, 42, 0.06);
    box-shadow: 0 4px 12px -6px rgba(18, 20, 42, 0.2);
    overflow: hidden;
}

.agf-mock > span {
    display: block;
    flex-shrink: 0;
}

.agf-mock__title {
    width: 62%;
    height: 7px;
    margin-bottom: 3px;
    border-radius: 3px;
}

.agf-mock__label {
    width: 34%;
    height: 4px;
    border-radius: 2px;
    opacity: 0.65;
}

.agf-mock__input {
    height: 13px;
    border: 1px solid;
}

.agf-mock__button {
    width: 46%;
    height: 13px;
    margin-top: auto;
}

.agf-mock__button.is-full {
    width: 100%;
}

.agf-theme__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 26px;
    padding: 0 2px;
}

.agf-theme__name {
    overflow: hidden;
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-empty-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 26px;
    padding: 22px 18px;
    border: 1.5px dashed var(--agf-border-strong);
    border-radius: 14px;
    color: var(--agf-muted);
    font-size: 12.5px;
    text-align: center;
}

.agf-empty-card p {
    max-width: 240px;
    margin: 0;
}

.agf-empty-card__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--agf-primary-50);
    color: var(--agf-primary);
}

/* ---------- Canvas & device ---------- */

.agf-canvas {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    padding: 24px;
    overflow: hidden;
    background: #eceef5 radial-gradient(rgba(18, 20, 42, 0.085) 1px, transparent 1.3px) 0 0 / 20px 20px;
}

.agf-stage {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    min-height: 0;
}

.agf-device {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    border: 0 solid #14161f;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--agf-shadow-lg), 0 0 0 1px rgba(18, 20, 42, 0.05);
    transition: width 0.5s var(--agf-ease), height 0.5s var(--agf-ease), border-width 0.3s ease, border-radius 0.4s ease;
}

.agf-device[data-device="tablet"] {
    width: 788px;
    border-width: 10px;
    border-radius: 30px;
}

.agf-device[data-device="mobile"] {
    width: 410px;
    height: min(100%, 880px);
    border-width: 10px;
    border-radius: 42px;
}

.agf-device__chrome {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid #eef0f5;
    background: #fafbfd;
}

.agf-device__dots {
    display: flex;
    gap: 6px;
    width: 80px;
}

.agf-device__dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
}

.agf-device__dots i:nth-child(2) {
    background: #febc2e;
}

.agf-device__dots i:nth-child(3) {
    background: #28c840;
}

.agf-device__url {
    flex: 1;
    max-width: 380px;
    height: 24px;
    margin: 0 auto;
    padding: 0 12px;
    overflow: hidden;
    border-radius: 7px;
    background: #f0f2f7;
    color: var(--agf-muted);
    font-size: 11.5px;
    line-height: 24px;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Page switcher for multi-page forms (replaces the URL pill). */
.agf-device__chrome.has-pager .agf-device__url {
    display: none;
}

.agf-pager {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 auto;
    padding: 2px;
    border: 1px solid var(--agf-border);
    border-radius: 9px;
    background: var(--agf-surface);
    box-shadow: var(--agf-shadow-sm);
}

.agf-pager__btn {
    display: grid;
    place-items: center;
    width: 26px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--agf-text-2);
    transition: background 0.15s ease, color 0.15s ease;
}

.agf-pager__btn:hover:not(:disabled) {
    background: var(--agf-brand-soft);
    color: var(--agf-brand-dark);
}

.agf-pager__btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.agf-pager__label {
    min-width: 92px;
    padding: 0 6px;
    color: var(--agf-text-2);
    font-weight: 600;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}

.agf-device__size {
    width: 80px;
    color: var(--agf-subtle);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.agf-device[data-device="mobile"] .agf-device__dots,
.agf-device[data-device="mobile"] .agf-device__size {
    display: none;
}

.agf-device[data-device="mobile"] .agf-device__chrome {
    height: 34px;
    background: #fff;
}

.agf-device__screen {
    position: relative;
    flex: 1;
    min-height: 0;
}

.agf-device__screen iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.agf-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--agf-muted);
    font-size: 12.5px;
    backdrop-filter: blur(3px);
    transition: opacity 0.3s ease;
}

.agf-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.agf-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--agf-primary-100);
    border-top-color: var(--agf-primary);
    border-radius: 50%;
    animation: agf-spin 0.8s linear infinite;
}

/* ---------- Color picker ---------- */

.agf-picker {
    position: fixed;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 256px;
    padding: 12px;
    border: 1px solid var(--agf-border);
    border-radius: 16px;
    background: var(--agf-surface);
    box-shadow: var(--agf-shadow-lg);
    opacity: 0;
    transform: scale(0.97);
    transform-origin: top left;
}

.agf-picker.is-open {
    animation: agf-pop 0.18s var(--agf-ease) forwards;
}

.agf-picker__sv {
    position: relative;
    height: 150px;
    border-radius: 11px;
    background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
    cursor: crosshair;
    touch-action: none;
}

.agf-picker__sv-thumb {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.agf-picker__row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agf-picker__bars {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 9px;
}

.agf-picker__bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    cursor: pointer;
    touch-action: none;
}

.agf-picker__hue {
    background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}

.agf-picker__alpha {
    background: var(--agf-checker);
}

.agf-picker__alpha-fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.08);
}

.agf-picker__bar-thumb {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 5px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.agf-picker__preview {
    position: relative;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border-radius: 9px;
    background: var(--agf-checker);
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.1);
}

.agf-picker__preview span {
    position: absolute;
    inset: 0;
}

.agf-picker__fields {
    display: flex;
    gap: 8px;
}

.agf-picker__hex {
    flex: 1;
    min-width: 0;
    height: 32px;
    font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.agf-picker__alpha-wrap {
    display: flex;
    align-items: center;
    width: 66px;
    height: 32px;
    padding-right: 8px;
    border: 1px solid var(--agf-border);
    border-radius: 9px;
    color: var(--agf-subtle);
    font-size: 11px;
}

.agf-picker__alpha-wrap:focus-within {
    border-color: var(--agf-primary);
    box-shadow: var(--agf-ring);
}

.agf-picker__alpha-input {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 0 2px 0 6px;
    border: 0;
    background: none;
    font-size: 12px;
    text-align: right;
    box-shadow: none !important;
    -moz-appearance: textfield;
}

.agf-picker__alpha-input::-webkit-outer-spin-button,
.agf-picker__alpha-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.agf-picker__swatches {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 5px;
    padding-top: 10px;
    border-top: 1px solid var(--agf-border);
}

.agf-swatch-chip {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    background: var(--agf-checker);
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.12);
    transition: transform 0.12s ease;
}

.agf-swatch-chip::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--chip);
    box-shadow: inset 0 0 0 1px rgba(18, 20, 42, 0.1);
}

.agf-swatch-chip.is-transparent::before {
    background: linear-gradient(135deg, transparent calc(50% - 0.75px), #e5484d calc(50% - 0.75px), #e5484d calc(50% + 0.75px), transparent calc(50% + 0.75px));
}

.agf-swatch-chip:hover {
    transform: scale(1.15);
    z-index: 1;
}

.agf-picker__label {
    display: block;
    margin-bottom: 6px;
    color: var(--agf-subtle);
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.agf-picker__gradient-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.agf-swatch-chip--wide {
    aspect-ratio: 2.2;
    border-radius: 7px;
}

/* ---------- Menu ---------- */

.agf-menu {
    position: fixed;
    z-index: 1000;
    min-width: 210px;
    max-width: 320px;
    padding: 6px;
    border: 1px solid var(--agf-border);
    border-radius: 13px;
    background: var(--agf-surface);
    box-shadow: var(--agf-shadow-lg);
    animation: agf-pop 0.16s var(--agf-ease);
}

/* ---------- Form switcher dropdown ---------- */

.agf-forms {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: 340px;
    max-width: calc(100vw - 24px);
    overflow: hidden;
    border: 1px solid var(--agf-border);
    border-radius: 14px;
    background: var(--agf-surface);
    box-shadow: var(--agf-shadow-lg);
    animation: agf-pop 0.16s var(--agf-ease);
    transform-origin: top left;
}

.agf-forms__search {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid var(--agf-border);
}

.agf-forms__search > span {
    position: absolute;
    top: 50%;
    left: 22px;
    color: var(--agf-subtle);
    transform: translateY(-50%);
    pointer-events: none;
}

.agf-forms__input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--agf-border);
    border-radius: 9px;
    background: var(--agf-surface-2);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.agf-forms__input:focus {
    border-color: var(--agf-brand);
    background: var(--agf-surface);
    box-shadow: 0 0 0 3px var(--agf-brand-soft);
}

.agf-forms__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 4px;
    color: var(--agf-subtle);
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.agf-forms__count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--agf-surface-3);
    color: var(--agf-muted);
    font-size: 10.5px;
    text-align: center;
    letter-spacing: 0;
}

.agf-forms__list {
    max-height: min(340px, 60vh);
    padding: 4px 6px 8px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.agf-forms__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 6px 8px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--agf-text-2);
    font-size: 13px !important;
    text-align: left;
    transition: background 0.12s ease;
}

.agf-forms__item:hover,
.agf-forms__item.is-highlighted {
    background: var(--agf-surface-3);
}

.agf-forms__item-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 7px;
    background: var(--agf-surface-3);
    color: var(--agf-subtle);
}

.agf-forms__item:hover .agf-forms__item-icon,
.agf-forms__item.is-highlighted .agf-forms__item-icon {
    background: var(--agf-surface);
}

.agf-forms__item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-forms__item-id {
    flex-shrink: 0;
    color: var(--agf-subtle);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.agf-forms__item.is-current {
    color: var(--agf-text);
    font-weight: 600 !important;
}

.agf-forms__item.is-current .agf-forms__item-icon {
    background: var(--agf-brand);
    color: #fff;
}

.agf-forms__badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--agf-brand-soft);
    color: var(--agf-brand-dark);
    font-weight: 600;
    font-size: 10.5px;
}

.agf-forms__empty {
    margin: 0;
    padding: 18px 16px 22px;
    color: var(--agf-muted);
    font-size: 12.5px;
    text-align: center;
}

.agf-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--agf-text-2);
    font-size: 13px !important;
    text-align: left;
}

.agf-menu__item span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.agf-menu__item .agf-icon {
    color: var(--agf-subtle);
}

.agf-menu__item:hover,
.agf-menu__item:focus-visible {
    background: var(--agf-surface-3);
    box-shadow: none !important;
}

.agf-menu__item.is-active {
    color: var(--agf-primary);
    font-weight: 600 !important;
}

.agf-menu__item.is-active .agf-icon {
    color: var(--agf-primary);
}

.agf-menu__item.is-danger,
.agf-menu__item.is-danger .agf-icon {
    color: var(--agf-danger);
}

.agf-menu__item.is-danger:hover {
    background: #fff1f1;
}

/* ---------- Toasts ---------- */

.agf-toasts {
    position: fixed;
    bottom: 24px;
    left: calc(50% + var(--agf-sidebar) / 2);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

.agf-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(460px, calc(100vw - 32px));
    padding: 9px 10px 9px 10px;
    border-radius: 12px;
    background: #14162b;
    color: #fff;
    font-weight: 500;
    font-size: 13px;
    box-shadow: 0 16px 32px -12px rgba(18, 20, 42, 0.45);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.25s var(--agf-ease);
    pointer-events: auto;
}

.agf-toast.is-in {
    opacity: 1;
    transform: none;
}

.agf-toast__icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.agf-toast--success .agf-toast__icon {
    background: #22c55e;
}

.agf-toast--error .agf-toast__icon {
    background: var(--agf-danger);
}

.agf-toast__text {
    padding-right: 4px;
}

.agf-toast__action {
    flex-shrink: 0;
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.13);
    color: #fff !important;
    font-weight: 600 !important;
    font-size: 12px !important;
}

.agf-toast__action:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ---------- Modal ---------- */

.agf-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(18, 20, 42, 0.42);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.agf-overlay.is-in {
    opacity: 1;
}

.agf-modal {
    width: min(420px, 100%);
    padding: 22px;
    border-radius: 18px;
    background: var(--agf-surface);
    box-shadow: var(--agf-shadow-lg);
    transform: translateY(10px) scale(0.98);
    transition: transform 0.25s var(--agf-ease);
}

.agf-overlay.is-in .agf-modal {
    transform: none;
}

.agf-modal__title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.agf-modal__desc {
    margin: 0;
    color: var(--agf-muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.agf-modal__label {
    display: block;
    margin: 16px 0 6px;
    color: var(--agf-text-2);
    font-weight: 600;
    font-size: 12.5px;
}

.agf-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 22px;
}

/* ---------- Animations ---------- */

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

@keyframes agf-pulse {
    50% {
        opacity: 0.45;
    }
}

@keyframes agf-pop {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes agf-flash {
    0% {
        box-shadow: 0 0 0 0 rgba(109, 74, 255, 0);
    }

    30% {
        box-shadow: 0 0 0 4px var(--agf-primary-100), var(--agf-shadow-md);
        border-color: var(--agf-primary);
    }

    100% {
        box-shadow: var(--agf-shadow-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    .agf *,
    .agf *::before,
    .agf *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
    .agf-hide-sm {
        display: none;
    }

    #agf-save-theme {
        width: 36px;
        padding: 0;
    }
}

@media (max-width: 1100px) {
    .agf-status__text {
        display: none;
    }
}

@media (max-width: 960px) {
    .agf-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .agf-only-compact {
        display: inline-grid !important;
    }

    .agf-sidebar {
        position: fixed;
        top: var(--agf-topbar);
        bottom: 0;
        left: 0;
        width: min(var(--agf-sidebar), 92vw);
        box-shadow: var(--agf-shadow-lg);
        transform: translateX(-102%);
        transition: transform 0.3s var(--agf-ease);
    }

    .agf-sidebar-open .agf-sidebar {
        transform: none;
    }

    .agf-toasts {
        left: 50%;
    }

    .agf-topbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .agf-topbar__center {
        justify-content: center;
    }

    .agf-formswitch {
        max-width: 220px;
    }
}

@media (max-width: 760px) {
    .agf-brand {
        display: none;
    }

    .agf-topbar {
        gap: 8px;
        padding: 0 8px;
    }

    #agf-devices,
    .agf-btngroup #agf-reset,
    .agf-status {
        display: none;
    }

    .agf-canvas {
        padding: 12px;
    }

    .agf-device[data-device] {
        width: 100%;
        height: 100%;
        border-width: 0;
        border-radius: 12px;
    }
}
