/* ----------------------------------------------------------------------------
 * Questionful - Cloud Form Management
 * Squarespace-inspired design system
 * ---------------------------------------------------------------------------- */

:root, [data-bs-theme=light] {
    /* ── Color palette ── */
    --bs-blue: #2780e3;
    --bs-indigo: #6610f2;
    --bs-purple: #613d7c;
    --bs-pink: #e83e8c;
    --bs-red: #ff0039;
    --bs-orange: #f0ad4e;
    --bs-yellow: #ff7518;
    --bs-green: #3fb618;
    --bs-teal: #20c997;
    --bs-cyan: #9954bb;
    --bs-black: #000;
    --bs-white: #fff;
    --bs-gray: #888;
    --bs-gray-dark: #333;
    --bs-gray-100: #f5f5f5;
    --bs-gray-200: #ebebeb;
    --bs-gray-300: #e1e1e1;
    --bs-gray-400: #ccc;
    --bs-gray-500: #aaa;
    --bs-gray-600: #888;
    --bs-gray-700: #666;
    --bs-gray-800: #333;
    --bs-gray-900: #111;

    /* ── Semantic colors (keep functional) ── */
    --bs-primary: #2780e3;
    --bs-secondary: #666;
    --bs-success: #3fb618;
    --bs-info: #9954bb;
    --bs-warning: #ff7518;
    --bs-danger: #ff0039;
    --bs-light: #f5f5f5;
    --bs-dark: #000;

    --bs-primary-rgb: 39,128,227;
    --bs-secondary-rgb: 102,102,102;
    --bs-success-rgb: 63,182,24;
    --bs-info-rgb: 153,84,187;
    --bs-warning-rgb: 255,117,24;
    --bs-danger-rgb: 255,0,57;
    --bs-light-rgb: 245,245,245;
    --bs-dark-rgb: 0,0,0;

    --bs-primary-text-emphasis: #10335b;
    --bs-secondary-text-emphasis: #333;
    --bs-success-text-emphasis: #19490a;
    --bs-info-text-emphasis: #3d224b;
    --bs-warning-text-emphasis: #662f0a;
    --bs-danger-text-emphasis: #660017;
    --bs-light-text-emphasis: #555;
    --bs-dark-text-emphasis: #555;

    --bs-primary-bg-subtle: #d4e6f9;
    --bs-secondary-bg-subtle: #f5f5f5;
    --bs-success-bg-subtle: #d9f0d1;
    --bs-info-bg-subtle: #ebddf1;
    --bs-warning-bg-subtle: #ffe3d1;
    --bs-danger-bg-subtle: #ffccd7;
    --bs-light-bg-subtle: #fafafa;
    --bs-dark-bg-subtle: #e1e1e1;

    --bs-primary-border-subtle: #a9ccf4;
    --bs-secondary-border-subtle: #ccc;
    --bs-success-border-subtle: #b2e2a3;
    --bs-info-border-subtle: #d6bbe4;
    --bs-warning-border-subtle: #ffc8a3;
    --bs-danger-border-subtle: #ff99b0;
    --bs-light-border-subtle: #e1e1e1;
    --bs-dark-border-subtle: #ccc;

    --bs-white-rgb: 255,255,255;
    --bs-black-rgb: 0,0,0;

    /* ── Typography ── */
    --bs-font-sans-serif: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --bs-gradient: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0));

    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: 0.9375rem;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.6;
    --bs-body-color: #000;
    --bs-body-color-rgb: 0,0,0;
    --bs-body-bg: #fff;
    --bs-body-bg-rgb: 255,255,255;

    --bs-emphasis-color: #000;
    --bs-emphasis-color-rgb: 0,0,0;
    --bs-secondary-color: #666;
    --bs-secondary-color-rgb: 102,102,102;
    --bs-secondary-bg: #f5f5f5;
    --bs-secondary-bg-rgb: 245,245,245;
    --bs-tertiary-color: #888;
    --bs-tertiary-color-rgb: 136,136,136;
    --bs-tertiary-bg: #fafafa;
    --bs-tertiary-bg-rgb: 250,250,250;

    --bs-heading-color: #000;
    --bs-link-color: #2780e3;
    --bs-link-color-rgb: 39,128,227;
    --bs-link-decoration: none;
    --bs-link-hover-color: #1f66b6;
    --bs-link-hover-color-rgb: 31,102,182;
    --bs-link-hover-decoration: underline;
    --bs-code-color: #e83e8c;
    --bs-highlight-color: #000;
    --bs-highlight-bg: #ffe3d1;

    /* ── Borders ── */
    --bs-border-width: 1px;
    --bs-border-style: solid;
    --bs-border-color: #e1e1e1;
    --bs-border-color-translucent: rgba(0,0,0,0.08);

    /* ── Border radius: 0 everywhere (Squarespace is fully sharp) ── */
    --bs-border-radius: 0;
    --bs-border-radius-sm: 0;
    --bs-border-radius-lg: 0;
    --bs-border-radius-xl: 0;
    --bs-border-radius-xxl: 0;
    --bs-border-radius-2xl: 0;
    --bs-border-radius-pill: 50rem;

    /* ── Shadows (very subtle) ── */
    --bs-box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    --bs-box-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --bs-box-shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --bs-box-shadow-inset: inset 0 1px 2px rgba(0,0,0,0.04);

    /* ── Focus ring ── */
    --bs-focus-ring-width: 0.2rem;
    --bs-focus-ring-opacity: 0.12;
    --bs-focus-ring-color: rgba(0,0,0,0.12);

    /* ── Form validation ── */
    --bs-form-valid-color: #3fb618;
    --bs-form-valid-border-color: #3fb618;
    --bs-form-invalid-color: #ff0039;
    --bs-form-invalid-border-color: #ff0039;

    /* ── Squarespace tokens ── */
    --sqsp-nav-height: 56px;
    --sqsp-nav-bg: #fff;
    --sqsp-nav-border: #e1e1e1;
    --sqsp-surface: #fff;
    --sqsp-surface-secondary: #fafafa;

    /* ── Control sizing (inputs, buttons, selects share same height) ── */
    --qf-control-height: 44px;
    --qf-control-padding-y: 0.625rem;
    --qf-control-padding-x: 0.875rem;

    /* ── Card spacing ── */
    --qf-card-padding-y: 1.5rem;
    --qf-card-padding-x: 1.5rem;

    /* Bootstrap component variable overrides */
    --bs-btn-padding-y: var(--qf-control-padding-y);
    --bs-btn-padding-x: var(--qf-control-padding-x);
    --bs-card-spacer-y: var(--qf-card-padding-y);
    --bs-card-spacer-x: var(--qf-card-padding-x);
    --bs-card-cap-padding-y: calc(var(--qf-card-padding-y) * 0.75);
    --bs-card-cap-padding-x: var(--qf-card-padding-x);
}

[data-bs-theme=dark] {
    color-scheme: dark;
    --bs-body-color: #e0e0e0;
    --bs-body-color-rgb: 224,224,224;
    --bs-body-bg: #111;
    --bs-body-bg-rgb: 17,17,17;
    --bs-emphasis-color: #fff;
    --bs-emphasis-color-rgb: 255,255,255;
    --bs-secondary-color: #999;
    --bs-secondary-color-rgb: 153,153,153;
    --bs-secondary-bg: #222;
    --bs-secondary-bg-rgb: 34,34,34;
    --bs-tertiary-color: #777;
    --bs-tertiary-color-rgb: 119,119,119;
    --bs-tertiary-bg: #1a1a1a;
    --bs-tertiary-bg-rgb: 26,26,26;
    --bs-border-color: #2a2a2a;
    --bs-border-color-translucent: rgba(255,255,255,0.1);
    --bs-heading-color: #fff;
    --bs-link-color: #7db3ee;
    --bs-link-hover-color: #97c2f1;
    --bs-link-color-rgb: 125,179,238;
    --bs-link-hover-color-rgb: 151,194,241;
    --bs-code-color: #f18bba;
    --bs-highlight-color: #e0e0e0;
    --bs-highlight-bg: #662f0a;
    --bs-form-valid-color: #8cd374;
    --bs-form-valid-border-color: #8cd374;
    --bs-form-invalid-color: #ff6688;
    --bs-form-invalid-border-color: #ff6688;
    --sqsp-nav-bg: #111;
    --sqsp-nav-border: #2a2a2a;
    --sqsp-surface: #181818;
    --sqsp-surface-secondary: #1e1e1e;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: none;
    color: var(--bs-heading-color);
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn:hover,
.nav-link:hover,
.dropdown-item:hover,
.dropdown-toggle:hover,
.navbar-brand:hover {
    text-decoration: none;
}

/* ── Top Navigation ───────────────────────────────────────────────────────── */

.main-nav {
    background: var(--sqsp-nav-bg);
    border-bottom: 1px solid var(--sqsp-nav-border);
    min-height: var(--sqsp-nav-height);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.main-nav .navbar {
    padding-top: 0;
    padding-bottom: 0;
    min-height: var(--sqsp-nav-height);
    align-items: stretch;
    position: relative;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.main-nav .navbar > .container,
.main-nav .navbar > .container-fluid {
    align-items: stretch;
}

.main-nav .navbar-collapse {
    flex-grow: 0;
}

.main-nav .navbar-nav {
    align-items: center;
}

.main-nav .navbar-nav .nav-item {
    display: flex;
    align-items: stretch;
    margin-right: 0;
}

.main-nav .navbar-brand {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #000 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    text-decoration: none;
}

.main-nav .navbar-brand img {
    height: 26px;
}

.main-nav .nav-link,
.main-nav .dropdown-toggle {
    color: #333 !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.65rem 0.75rem !important;
    border-radius: 0;
    text-decoration: none;
    line-height: 1;
    position: relative;
    transition: background-color 150ms ease;
}

.main-nav .nav-link:hover,
.main-nav .dropdown-toggle:hover {
    color: #000 !important;
    text-decoration: none;
    background-color: rgba(0, 0, 0, 0.05);
}

.main-nav .nav-link.active,
.main-nav .nav-link.active:hover {
    color: #000 !important;
    font-weight: 600;
    background-color: #FFD700;
}

.main-nav .nav-link,
.main-nav .dropdown-toggle {
    display: inline-flex;
    align-items: center;
}

.main-nav .qf-upgrade-btn {
    display: inline-flex;
    align-items: center;
    min-height: unset;
    padding: 0.65rem 0.875rem !important;
}

.main-nav .qf-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ccc;
    color: #333;
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.main-nav .dropdown-toggle:hover .qf-avatar,
.main-nav .dropdown-toggle:focus .qf-avatar,
.main-nav .dropdown-toggle.show .qf-avatar {
    background: #FFD700;
    color: #000;
}

.main-nav .qf-avatar-toggle::after {
    display: none !important;
}

.qf-upgrade-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: var(--qf-control-height);
    padding: 0 0.875rem !important;
    font-size: 0.875rem !important;
    line-height: 1 !important;
    border-radius: 0 !important;
    border: 1px solid #e05c00 !important;
    background-color: #f97316 !important;
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
}

.qf-upgrade-btn:hover,
.qf-upgrade-btn:focus,
.qf-upgrade-btn:active {
    background-color: #ea6c00 !important;
    border-color: #c85c00 !important;
    color: #fff !important;
}

.main-nav .dropdown-toggle:not(.qf-avatar-toggle)::after {
    display: none !important;
}

.main-nav .navbar-toggler {
    border: none;
    border-radius: 0;
    padding: 0.35rem 0.6rem;
    color: #333;
    box-shadow: none;
}

.main-nav .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ── Page subheader ───────────────────────────────────────────────────────── */

.page-subheader {
    background: var(--sqsp-nav-bg);
    border-bottom: 1px solid var(--sqsp-nav-border);
    position: sticky;
    top: var(--sqsp-nav-height);
    z-index: 1020;
}

.page-subheader .navbar {
    align-items: stretch;
    padding-top: 0;
    padding-bottom: 0;
    position: relative;
}

.page-subheader .navbar-nav {
    align-items: stretch;
}

.page-subheader .navbar-nav .nav-item {
    display: flex;
    align-items: stretch;
}

.page-subheader .navbar-brand {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.02em;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
}

.page-subheader .navbar-nav .nav-link {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bs-body-color) !important;
    padding: 1rem 0.75rem;
    transition: color 0.15s;
    position: relative;
}

.page-subheader .navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: #FFD700;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.68, 0.06);
}

.page-subheader .navbar-nav .nav-link:hover {
    color: var(--bs-body-color) !important;
}

.page-subheader .navbar-nav .nav-link:hover::after {
    transform: scaleX(1);
}

.page-subheader .navbar-nav .nav-link.active,
.page-subheader .navbar-nav .nav-link.active:hover {
    color: var(--bs-body-color) !important;
}

.page-subheader .navbar-nav .nav-link.active::after,
.page-subheader .navbar-nav .nav-link.active:hover::after {
    transform: scaleX(1);
}

.page-subheader .navbar-toggler {
    border: none;
    border-radius: 0;
    padding: 0.35rem 0.5rem;
    color: #333;
    box-shadow: none;
}

.page-subheader .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: var(--qf-control-padding-y) var(--qf-control-padding-x);
    min-height: var(--qf-control-height);
    border-radius: 0;
    min-width: 0;
    max-height: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-lg {
    padding: calc(var(--qf-control-padding-y) * 1.2) calc(var(--qf-control-padding-x) * 1.5);
    font-size: 0.9375rem;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

/* Primary = black (Squarespace style) */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #000;
    --bs-btn-border-color: #000;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #333;
    --bs-btn-hover-border-color: #333;
    --bs-btn-focus-shadow-rgb: 0,0,0;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #000;
    --bs-btn-active-border-color: #000;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #aaa;
    --bs-btn-disabled-border-color: #aaa;
}

.btn-outline-primary {
    --bs-btn-color: #000;
    --bs-btn-border-color: #000;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #000;
    --bs-btn-hover-border-color: #000;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #000;
    --bs-btn-active-border-color: #000;
    --bs-btn-disabled-color: #000;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: #000;
}

.btn-outline-secondary {
    --bs-btn-color: #555;
    --bs-btn-border-color: #ddd;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #000;
    --bs-btn-hover-border-color: #000;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #000;
    --bs-btn-active-border-color: #000;
}

[class*=btn-outline-] {
    border-width: 1px !important;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
    border: 1px solid #e1e1e1;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    background: #fafafa;
    border-bottom: 1px solid #e1e1e1;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    padding: 0.875rem 1.25rem;
    border-radius: 0;
}

.card-footer {
    background: #fafafa;
    border-top: 1px solid #e1e1e1;
    border-radius: 0;
}

.card-hover-move {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.card-hover-move:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

.qf-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    border-radius: inherit;
    pointer-events: none;
}

.qf-list-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

body.main-layout:not(:has(#qf-editor)) .card .card-body {
    position: relative;
    z-index: 1;
}

body.main-layout:not(:has(#qf-editor)) .card .card-footer {
    position: relative;
    z-index: 1;
    a, form {
        position: relative;
        z-index: 1;
    }
}

.qf-card-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #666;
    font-size: 1rem;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    min-height: 36px;
    min-width: 36px;
}

.qf-card-action:hover,
.qf-card-action:focus {
    color: #000;
    background: rgba(0, 0, 0, 0.06) !important;
}

.qf-card-action.text-danger:hover,
.qf-card-action.text-danger:focus {
    color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.08) !important;
}

/* Keep the wrapping <form> from breaking flex alignment */
.qf-card-action-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qf-card-action-group form {
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

/* ── List-view icon buttons ──────────────────────────────────────────────── */
.qf-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    line-height: 1;
    font-size: 1rem;
    border-radius: 0 !important;
}

/* ── View-mode toggle (grid / list) ──────────────────────────────────────── */
.qf-view-toggle-group {
    display: flex;
    gap: 0.5rem;
}

.qf-view-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: var(--qf-control-height);
    min-height: var(--qf-control-height);
    width: var(--qf-control-height);
    height: var(--qf-control-height);
    padding: 0 !important;
    border-radius: 0 !important;
}

.qf-dashboard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: center;
}

.qf-dashboard-filters .input-group {
    display: flex;
    align-items: stretch;
    min-height: var(--qf-control-height);
    border: 1px solid #ccc;
    background: #fff;
}

.qf-dashboard-filters .input-group > .form-control,
.qf-dashboard-filters .input-group > .form-select,
.qf-dashboard-filters .input-group > .input-group-text {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    height: var(--qf-control-height);
    min-height: unset;
    padding-top: 0;
    padding-bottom: 0;
}

.qf-dashboard-filters .input-group > .input-group-text {
    color: #555;
    border-right: 1px solid #e1e1e1 !important;
}

.qf-dashboard-filters .input-group:focus-within {
    border-color: #FFD700;
}

.qf-dashboard-filter-clear {
    width: var(--qf-control-height);
    height: var(--qf-control-height);
    padding: 0 !important;
    line-height: 1;
}

.qf-dashboard-filter-clear .bi {
    font-size: 0.75rem;
}

/* Tag filter button — stable compact width */
.qf-tag-filter-btn {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card footer date — always single line */
#forms-grid-view .card-footer .text-muted.small {
    white-space: nowrap;
    flex-shrink: 0;
}

/* List view row spacing — restore top border that Bootstrap collapses */
.qf-dashboard-list-item + .qf-dashboard-list-item {
    margin-top: 0.5rem;
    border-top-width: 1px !important;
}

.qf-dashboard-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.qf-dashboard-list-main {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qf-dashboard-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.qf-dashboard-list-title {
    min-width: 0;
    flex: 1 1 auto;
}

.qf-dashboard-list-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.375rem;
    flex-shrink: 0;
}

.qf-dashboard-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.qf-dashboard-list-description::before {
    content: "—";
    margin-right: 0.5rem;
}

.qf-dashboard-list-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.qf-dashboard-list-actions form {
    display: flex;
}

.qf-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Old structure: heading + primary action inline (no search in toolbar) */
.qf-page-toolbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: auto;
    min-width: 0;
}

/* New structure: search + primary action grouped right of heading */
.qf-page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.qf-page-toolbar-actions .qf-search-form {
    flex: 0 1 320px;
    width: auto;
    min-width: 0;
}

.qf-page-toolbar-actions .qf-search-form .input-group {
    max-width: 100%;
}

.qf-page-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Heading inside toolbar-main still grows to push button right */
.qf-page-toolbar-main .qf-page-heading {
    flex: 1 1 auto;
}

/* Normalize edit-page heading across all pages */
.qf-edit-page-header h1 {
    font-size: 1.5rem !important;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0;
}

.qf-search-form {
    width: 100%;
    flex: 1 1 320px;
}

.qf-page-toolbar > .qf-search-form {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
}

.qf-search-form .input-group {
    width: 100%;
    max-width: min(100%, 320px);
}

.qf-admin-nav {
    width: 100%;
}

.toast-container {
    width: min(100vw - 2rem, 360px);
}

.toast-container .toast {
    width: 100%;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-control,
.form-select {
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: var(--qf-control-padding-y) var(--qf-control-padding-x);
    min-height: var(--qf-control-height);
    background-color: #fff;
    box-shadow: none !important;
    transition: border-color 0.15s, background-color 0.15s;
    color: #000;
}

.form-control:focus,
.form-select:focus {
    border-color: #FFD700;
    border-radius: 0;
    background-color: #fff;
    box-shadow: none !important;
    color: #000;
    outline: none;
}

input.form-control,
select.form-control,
.form-select {
    height: 44px;
}

textarea.form-control {
    height: auto;
    min-height: 88px;
}

.form-control-lg {
    min-height: 50px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 0;
}

.form-control-sm,
.form-select-sm {
    min-height: 36px;
    height: 36px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    color: #555;
    margin-bottom: 0.35rem;
}

.input-group-text {
    background: #fff;
    border-color: #ccc;
    border-radius: 0;
    font-size: 0.9375rem;
    color: #555;
}

.form-check-input {
    border-radius: 0;
}

/* ── Squarespace-style toggle switch ─────────────────────────────────────── */
.form-switch {
    padding-left: 2.25rem;
}

.form-switch .form-check-input {
    width: 28px;
    height: 16px;
    border-radius: 8px !important;
    background-color: #666;
    border: none;
    background-image: none;
    position: relative;
    cursor: pointer;
    transition: background-color 300ms cubic-bezier(0.32, 0.94, 0.6, 1);
    appearance: none;
    margin-left: -2.25rem;
    flex-shrink: 0;
}

.form-switch .form-check-input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transition: transform 300ms cubic-bezier(0.32, 0.94, 0.6, 1);
}

.form-switch .form-check-input:checked {
    background-color: #FFD700;
    background-image: none;
    border-color: #FFD700;
}

.form-switch .form-check-input:checked::after {
    transform: translateX(12px);
}

.form-switch .form-check-input:focus {
    box-shadow: none;
    border-color: transparent;
}

/* ── Dropdowns ────────────────────────────────────────────────────────────── */

.dropdown-menu {
    border: 1px solid #e1e1e1;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 0.375rem 0;
    min-width: 180px;
}

.dropdown-item {
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
    color: #000;
    border-radius: 0;
}

.dropdown-item:hover, .dropdown-item:focus {
    background: #f5f5f5;
    color: #000;
}

.dropdown-item.active, .dropdown-item:active {
    background: #000;
    color: #fff;
}

.dropdown-divider {
    border-color: #e1e1e1;
    margin: 0.25rem 0;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table {
    width: 100%;
    table-layout: auto;
    font-size: 0.9rem;
    color: #000;
}

.table > :not(caption) > * > * {
    padding: 0.5rem 1rem;
}

.table td, .table th {
    white-space: nowrap;
    max-width: 200px;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 1%;
    border-color: #e1e1e1;
}

 thead {
    padding: 0 1rem;
    height: 44px;
}

.table thead th {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #555;
    background: #fafafa;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

.qf-mobile-tag-filter {
    width: 100%;
}

.qf-mobile-tag-filter .form-select {
    width: 100%;
}

.qf-contact-tags-filter .dropdown-menu {
    min-width: 16rem !important;
}

.table td.td-actions {
    overflow: visible;
    max-width: none;
}

.table td .btn {
    min-height: auto;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.table-light {
    --bs-table-bg: #fafafa;
    --bs-table-color: #888;
}

/* ── Nav links ────────────────────────────────────────────────────────────── */

.nav-link {
    color: #333 !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
}

/* ── Inline field rows (Square-style property panel) ─────────────────────── */

.qf-field-label {
    width: 130px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.qf-field-row .form-control:focus {
    box-shadow: none;
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────────── */

.qf-breadcrumbs {
    background: #fafafa;
    border-color: #e1e1e1 !important;
}

.qf-breadcrumbs .breadcrumb {
    font-size: 0.8125rem;
}

.qf-breadcrumbs .breadcrumb-item a {
    color: #b69e45;
    text-decoration: none;
}

.qf-breadcrumbs .breadcrumb-item a:hover {
    color: #8a7730;
}

.qf-breadcrumbs .breadcrumb-item.active {
    color: #333;
    font-weight: 500;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar-width {
    width: 220px;
    padding-right: 2rem;
    flex-shrink: 0;
}

.sidebar-width .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    padding: 0.5rem 0.75rem;
    padding-left: 0.5rem;
    border-radius: 0;
    margin-bottom: 0.125rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-width .nav-link:hover,
.sidebar-width .nav-link.active {
    background: rgba(255, 215, 0, 0.25);
    color: #000;
    text-decoration: none;
}

/* ── Modals ───────────────────────────────────────────────────────────────── */

.modal-dialog {
    box-shadow: none;
}

.modal-content {
    border: 1px solid #e1e1e1;
    border-radius: 0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

.modal-header {
    border-bottom: 1px solid #e1e1e1;
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    border-radius: 0;
}

.modal-footer {
    border-top: 1px solid #e1e1e1;
    padding: 1rem 1.5rem;
    border-radius: 0;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    border-radius: 0;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    border-radius: 0;
    border-width: 1px;
    font-size: 0.9rem;
}

/* ── Toasts ───────────────────────────────────────────────────────────────── */

.toast {
    border-radius: 0;
    font-size: 0.875rem;
}

/* ── Icon Buttons ─────────────────────────────────────────────────────────── */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0;
    border: 1px solid #e1e1e1;
    background: transparent;
    color: #888;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    background-color: #f5f5f5;
    color: #000;
    border-color: #bbb;
    text-decoration: none;
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.bg-hover:hover {
    background-color: #f5f5f5;
}

.text-muted {
    color: #666 !important;
}

/* ── Cloudflare Turnstile ─────────────────────────────────────────────────── */

.cf-turnstile {
    width: 100%;
}

.qf-turnstile-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.qf-turnstile-wrap .cf-turnstile,
.qf-turnstile-wrap .cf-turnstile > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
}

.cf-turnstile iframe {
    width: 100% !important;
    max-width: 100% !important;
    display: block;
}

/* ── Choices.js ───────────────────────────────────────────────────────────── */

body .choices {
    font-size: 0.9375rem;
    margin-bottom: 0;
    min-width: 220px;
    text-align: left;
}

body .choices__inner {
    border: 1px solid #ccc;
    border-radius: 0;
    padding: var(--qf-control-padding-y, 0.625rem) var(--qf-control-padding-x, 0.875rem);
    min-height: var(--qf-control-height, 44px);
    height: auto;
    background-color: white;
    font-size: 14px;
    color: #000;
    box-sizing: border-box;
    transition: border-color 0.15s, background-color 0.15s;
}

body .choices.is-focused .choices__inner,
body .choices.is-open .choices__inner {
    border-color: #FFD700;
    background-color: #fff;
    outline: none;
}

body .choices__list--single {
    padding-top: 0;
}

body .choices__placeholder {
    opacity: .5;
}

body .choices__list--dropdown,
body .choices__list[aria-expanded] {
    border-radius: 0;
    border-color: #e1e1e1;
}

body .choices__item--selectable.is-highlighted,
body .choices__item--choice.is-highlighted {
    background-color: #f5f5f5;
    color: #000;
}

/* Choices.js inside Bootstrap .input-group */
.input-group > .choices {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    width: 1%;
}
.input-group > .choices .choices__inner {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    height: 100%;
    min-height: var(--qf-control-height, 44px);
}
.input-group > .choices__list--dropdown,
.input-group > .choices .choices__list[aria-expanded] {
    min-width: 200px;
}

/* ── Auth layout ──────────────────────────────────────────────────────────── */

body.main-layout:not(:has(#qf-editor)) {
    background: #fff;
}

.auth-layout {
    background: #fff;
}

.auth-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 575.98px) {
    .qf-auth-shell {
        padding: 0.75rem !important;
        align-items: flex-start !important;
    }

    .qf-auth-card {
        padding: 1rem !important;
    }

    .qf-auth-card .display-5 {
        font-size: 2rem;
    }

    .qf-auth-inline-actions {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .qf-auth-inline-actions .btn-link {
        padding-top: 0;
        padding-bottom: 0;
    }

    .qf-turnstile-wrap {
        margin-inline: -0.25rem;
    }
}

@media (max-width: 359.98px) {
    .qf-auth-shell {
        padding: 0.5rem !important;
    }

    .qf-auth-card {
        padding: 0.875rem !important;
    }

    .qf-turnstile-wrap {
        margin-inline: -0.375rem;
    }
}

.table td.td-actions {
    overflow: visible;
    max-width: none;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--bs-border-radius);
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-secondary-color);
}

/* ── Responsive helpers ───────────────────────────────────────────────────── */

@media (min-width: 576px) {
    .w-sm-auto {
        width: auto !important;
    }

    .flex-sm-grow-0 {
        flex-grow: 0 !important;
    }
}

/* ── Tablet: 576–767px ───────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* Page toolbars: title + button may need to wrap */
    .qf-page-toolbar {
        flex-wrap: wrap;
    }

    .qf-page-heading {
        font-size: 1.375rem;
    }

    /* Dashboard filters: at tablet, keep row layout but let items wrap */
    .qf-dashboard-filters {
        flex-wrap: wrap;
    }
    .qf-dashboard-filters form,
    .qf-dashboard-filters .input-group {
        width: 100%;
        flex: 0 0 100%;
    }
    .qf-dashboard-filters form .input-group {
        max-width: 100% !important;
        width: 100%;
    }
    .qf-dashboard-filter-clear {
        align-self: center;
        min-width: 44px;
    }
    .qf-tag-filter {
        max-width: 100% !important;
        width: 100% !important;
    }
}

@media (min-width: 992px) {
    .rounded-lg-4 {
        border-radius: 0 !important;
    }

    .min-vh-lg-unset {
        min-height: unset !important;
    }

    .w-lg-auto {
        width: auto !important;
    }

    /* Force account nav to the right regardless of Lux Bootstrap cascade */
    .main-nav .navbar-collapse {
        flex-grow: 1 !important;
        display: flex !important;
        flex-basis: auto !important;
    }

    .main-nav .navbar-collapse .navbar-nav {
        width: auto !important;
        margin-left: auto !important;
    }
}

@media (max-width: 991.98px) {
    .sidebar-width {
        width: 100%;
        padding-right: 0;
        margin-bottom: 1.5rem;
    }

    /* Dashboard actions stack on tablet and mobile */
    .qf-dashboard-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .qf-dashboard-actions .qf-view-toggle-group {
        display: flex;
        width: 100%;
    }

    .qf-dashboard-actions .qf-view-toggle {
        flex: 1 1 0;
        width: auto !important;
        height: var(--qf-control-height);
        min-width: 0;
    }

    .main-nav .navbar-collapse {
        position: fixed;
        top: var(--sqsp-nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        background: #fff;
        border-top: 1px solid #e1e1e1;
        border-bottom: 1px solid #e1e1e1;
        padding: 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        max-height: calc(100dvh - var(--sqsp-nav-height));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* ── Mobile expanded nav: full-width rows ── */
    .main-nav .navbar-collapse .navbar-nav {
        width: 100%;
        gap: 0;
        padding: 0.25rem 0;
        align-items: stretch;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .main-nav .navbar-collapse .nav-item {
        display: block !important;
        width: 100%;
    }

    .main-nav .navbar-collapse .nav-link,
    .main-nav .navbar-collapse .dropdown-toggle {
        padding: 0.75rem 1.25rem !important;
        width: 100%;
        display: flex !important;
        align-items: center;
        min-height: 48px;
        border-radius: 0 !important;
    }

    /* Upgrade button: full-width orange row */
    .main-nav .navbar-collapse .qf-upgrade-nav-item {
        padding: 0.25rem 0;
        border-top: 1px solid #e1e1e1;
        border-bottom: 1px solid #e1e1e1;
        margin: 0.25rem 0;
    }

    .main-nav .navbar-collapse .qf-upgrade-btn {
        display: flex !important;
        width: 100%;
        padding: 0.75rem 1.25rem !important;
        justify-content: flex-start;
        gap: 0.5rem;
        border: none !important;
        border-radius: 0 !important;
        min-height: 48px;
    }

    /* Always show upgrade label text in mobile nav */
    .main-nav .navbar-collapse .qf-upgrade-btn span {
        display: inline !important;
    }

    /* User / account section: visual separator */
    .main-nav .navbar-collapse .qf-user-nav-item {
        border-top: 1px solid #e1e1e1;
        margin-top: 0.25rem;
        padding-top: 0.25rem;
    }

    /* Match the mobile submenu trigger text to regular nav-link style */
    .main-nav .navbar-collapse .nav-link {
        font-size: 0.875rem;
        font-weight: 500;
        font-family: inherit;
        text-transform: none;
        letter-spacing: normal;
    }
    .main-nav .navbar-collapse .nav-item.dropdown {
        flex-direction: column;
        align-items: stretch;
    }

    .main-nav .navbar-collapse .dropdown-menu {
        /* Render inline, not as a floating popup */
        position: static !important;
        transform: none !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        inset: auto !important;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: #fafafa;
        padding: 0.25rem 0 0.5rem 2.5rem;
        margin: 0;
        min-width: 0;
        border-top: 1px solid #f0f0f0;
    }

    /* Ensure dropdown items are legible on the white mobile menu background */
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item {
        color: #333 !important;
        font-size: 0.875rem;
        font-weight: 500;
        font-family: inherit;
        text-transform: none;
        letter-spacing: normal;
        padding: 0.55rem 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .main-nav .navbar-collapse .dropdown-menu .dropdown-item:hover,
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item:focus {
        color: #000 !important;
        background-color: rgba(0, 0, 0, 0.05);
    }

    .main-nav .navbar-collapse .dropdown-menu .dropdown-item.text-danger {
        color: #dc3545 !important;
    }

    /* Active team/workspace item: white text must survive the #333 override */
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item.active,
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item:active {
        color: #fff !important;
        background-color: #000 !important;
    }

    /* Rotate chevron when the submenu is open */
    .main-nav .navbar-collapse .nav-item.dropdown.show .qf-submenu-chevron {
        transform: rotate(180deg);
    }

    .main-nav .navbar-collapse .qf-submenu-chevron {
        font-size: 0.75rem;
        transition: transform 0.2s ease;
    }

    .page-subheader .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1050;
        background: var(--sqsp-nav-bg, #fff);
        border-bottom: 1px solid #e1e1e1;
        padding: 0.5rem 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .page-subheader .navbar-collapse .dropdown-menu {
        position: absolute !important;
    }
}

@media (max-width: 575.98px) {
    .table > :not(caption) > * > * {
        padding: 0.375rem 0.75rem;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

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

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Prevent iOS auto-zoom on input focus */
    .form-control,
    .form-select {
        font-size: 16px !important;
    }

    /* Choices.js — prevent iOS zoom on the custom select */
    body .choices__inner {
        font-size: 16px;
    }

    /* Slightly larger labels for readability */
    .form-label {
        font-size: 0.875rem;
    }

    /* Slightly larger table headers */
    .table thead th {
        font-size: 0.875rem;
    }

    /* Breadcrumbs readable on small screens */
    .qf-breadcrumbs .breadcrumb {
        font-size: 0.875rem;
    }

    /* Horizontally scrollable nav-tabs (e.g. admin template categories) */
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 1px;
    }
    .nav-tabs .nav-item {
        flex-shrink: 0;
    }

    /* Plan/billing buttons wrap on small screens */
    .qf-plan-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100%;
    }
    .qf-plan-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Payment method row stacks on mobile */
    .qf-payment-method-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    .qf-payment-method-row .qf-payment-method-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Dashboard search/filter area: search goes full-width on top row,
       tag-filter dropdown + clear X stay on the same row below */
    .qf-dashboard-filters {
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: stretch !important;
        margin-bottom: 0.5rem !important;
    }
    /* Search form takes full first row */
    .qf-dashboard-filters form {
        order: 1;
        flex: 0 0 100%;
        width: 100%;
    }
    .qf-dashboard-filters .input-group {
        width: 100%;
    }
    .qf-dashboard-filters form .input-group {
        max-width: 100% !important;
        width: 100%;
    }
    /* Tag dropdown takes the left part of second row */
    .qf-dashboard-filters .dropdown {
        order: 2;
        flex: 1 1 auto;
        width: auto;
    }
    .qf-dashboard-filters .qf-tag-filter-btn {
        width: 100%;
        max-width: 100%;
        text-align: left;
    }
    /* Clear X button stays on the right of the dropdown (same row) */
    .qf-dashboard-filters .qf-dashboard-filter-clear {
        order: 3;
        flex: 0 0 auto;
    }

    /* Billing history filter stacks */
    .qf-billing-filter .col-auto {
        width: 100%;
    }
    .qf-billing-filter .col-auto .form-select,
    .qf-billing-filter .col-auto .form-control,
    .qf-billing-filter .col-auto .btn {
        width: 100%;
    }

    /* Contact list toolbar stacks */
    .qf-list-toolbar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .qf-list-toolbar form {
        width: 100%;
    }
    .qf-list-toolbar .qf-list-actions {
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .qf-list-toolbar .qf-list-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .toast-container {
        left: 0;
        right: 0;
        width: auto;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .qf-page-toolbar {
        flex-direction: column;
        align-items: stretch !important;
    }

    .qf-page-toolbar-main {
        align-items: flex-start;
        width: 100%;
    }

    /* New actions group: search + create stay on one row, full width */
    .qf-page-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .qf-page-toolbar-actions .qf-search-form {
        flex: 1 1 auto;
        width: auto;
    }

    .qf-page-toolbar > .btn,
    .qf-page-toolbar > a.btn,
    .qf-page-toolbar > form,
    .qf-page-toolbar > div,
    .qf-page-toolbar > .qf-dashboard-actions {
        width: 100%;
    }

    /* Don't expand the actions group's inner Create button to full width */
    .qf-page-toolbar-actions > .btn {
        width: auto;
    }

    .qf-page-heading {
        font-size: 1.25rem;
    }

    .qf-edit-form-actions {
        flex-wrap: nowrap;
    }

    .qf-edit-form-actions .btn {
        min-width: 0;
    }

    .qf-search-form .input-group {
        max-width: 100% !important;
    }

    .qf-admin-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }

    .qf-admin-nav .nav-item {
        flex: 0 0 auto;
    }

    .qf-dashboard-actions {
        width: 100%;
    }

    .qf-dashboard-actions > .btn,
    .qf-dashboard-actions > a,
    .qf-dashboard-actions > .qf-view-toggle-group {
        width: 100%;
    }

    .qf-view-toggle-group {
        width: 100%;
    }

    .qf-view-toggle-group .qf-view-toggle {
        flex: 1 1 0;
        width: auto;
    }

    #forms-grid-view .card-footer > .d-flex {
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }

    #forms-grid-view .card-footer .qf-card-action-group {
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-start;
    }

    .qf-dashboard-list-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.875rem;
    }

    .qf-dashboard-list-item .qf-list-thumbnail {
        width: 100%;
        height: 140px;
    }

    .qf-dashboard-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .qf-dashboard-list-tags {
        justify-content: flex-start;
    }

    .qf-dashboard-list-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .qf-dashboard-list-actions .qf-icon-btn,
    .qf-dashboard-list-actions form {
        flex: 1 1 0;
        min-width: 0;
    }

    .qf-dashboard-list-actions form .qf-icon-btn {
        width: 100%;
        justify-content: center;
    }

    /* Sidebar nav: compact horizontal scrollable strip on phones */
    #settings-nav {
        flex-direction: row !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.125rem;
        border-bottom: 1px solid #e1e1e1;
        margin-bottom: 1.25rem;
    }
    #settings-nav .nav-item {
        flex-shrink: 0;
    }
    #settings-nav .nav-link {
        white-space: nowrap;
        padding: 0.4rem 0.875rem;
        font-size: 0.8125rem;
    }
    .sidebar-width > h6 {
        display: none;
    }

    /* Forms table: hide URL column on phones */
    .qf-forms-table th:nth-child(2),
    .qf-forms-table td:nth-child(2) {
        display: none;
    }

    /* Users table: hide email column on phones */
    .qf-users-table th:nth-child(2),
    .qf-users-table td:nth-child(2) {
        display: none;
    }

    /* Teams member table: hide email on phones */
    .qf-team-members-table th:nth-child(2),
    .qf-team-members-table td:nth-child(2) {
        display: none;
    }

    /* Contact lists table: hide "Created" column on phones */
    .qf-contact-lists-table th:nth-child(3),
    .qf-contact-lists-table td:nth-child(3) {
        display: none;
    }

    /* Tags table: hide "count" column on phones */
    .qf-tags-table th:nth-child(2),
    .qf-tags-table td:nth-child(2) {
        display: none;
    }

    /* Billing table: hide "description" column on phones */
    .qf-billing-table th:nth-child(2),
    .qf-billing-table td:nth-child(2) {
        display: none;
    }

    /* Custom field rows stack on mobile */
    .custom-field-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .custom-field-row .btn {
        align-self: flex-end;
    }

    /* Dashboard list: slightly tighter on phones */
    .qf-dashboard-list-item {
        padding: 0.875rem 1rem;
    }

    /* Edit page header: center title on phones, hide spacer */
    .qf-edit-page-header {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .qf-edit-page-header h1 {
        text-align: center;
        font-size: 1.25rem !important;
        line-height: 1.2;
    }

    .qf-edit-form-actions {
        width: 100%;
    }

    .qf-mobile-tag-filter {
        margin-bottom: 1rem;
    }
}

/* ── Section utilities ────────────────────────────────────────────────────── */

.section-heading {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #888;
    margin-bottom: 1.25rem;
}

.page-section {
    padding-top: 3rem;
    padding-bottom: 3rem;
    border-top: 1px solid #e1e1e1;
    margin-top: 3rem;
}

.page-section:first-child {
    border-top: none;
    margin-top: 0;
}

/* Subtle table stripe */
.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(0, 0, 0, 0.015);
}

/* ── Popover / Tooltip ────────────────────────────────────────────────────── */

.popover {
    border-radius: 0;
    border-color: #e1e1e1;
}

.tooltip-inner {
    border-radius: 0;
}

/* ── List group ───────────────────────────────────────────────────────────── */

.list-group-item {
    border-color: #e1e1e1;
    border-radius: 0 !important;
}

.list-group {
    border-radius: 0;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.page-link {
    border-radius: 0 !important;
    border-color: #e1e1e1;
    color: #000;
}

.page-item.active .page-link {
    background-color: #000;
    border-color: #000;
    color: #fff;
}

.page-link:hover {
    background-color: #f5f5f5;
    color: #000;
}

/* ── Progress ─────────────────────────────────────────────────────────────── */

.progress {
    border-radius: 0;
}

.progress-bar {
    border-radius: 0;
}

/* ── Accordion ────────────────────────────────────────────────────────────── */

.accordion-item {
    border-color: #e1e1e1;
    border-radius: 0 !important;
}

.accordion-button {
    border-radius: 0 !important;
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background: #f5f5f5;
    color: #000;
    box-shadow: none;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */

.breadcrumb-item a {
    color: #000;
}

/* ── Input group ──────────────────────────────────────────────────────────── */

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text,
.input-group > .btn {
    border-radius: 0 !important;
}

/* Search-style input-groups (inline, next to buttons in a flex row):
   give them a visible border matching btn-outline-secondary so sizes align */
.d-flex > .input-group {
    border: 1px solid #ccc;
    background: #fff;
    transition: border-color 0.15s, background-color 0.15s;
    flex-shrink: 0;
    height: var(--qf-control-height);
}
.d-flex > .input-group > .form-control,
.d-flex > .input-group > .form-select,
.d-flex > .input-group > .input-group-text {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background-color: transparent !important;
    height: 100%;
}
.d-flex > .input-group > .form-control:focus,
.d-flex > .input-group > .form-select:focus,
.d-flex > .input-group > .input-group-text:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background-color: transparent !important;
}
.d-flex > .input-group:focus-within {
    border-color: #FFD700;
    background-color: #fff;
}
.d-flex > .input-group:focus-within .input-group-text {
    background-color: transparent !important;
    color: #000;
}
.d-flex > .input-group:focus-within .form-control,
.d-flex > .input-group:focus-within .form-select {
    background-color: transparent !important;
}

/* ── Nav action buttons ───────────────────────────────────────────────────── */

.qf-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.qf-nav-actions .nav-link,
.qf-nav-actions a,
.qf-nav-actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff !important;
    background: #000;
    border: 1px solid #000;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.qf-nav-actions .nav-link:hover,
.qf-nav-actions a:hover,
.qf-nav-actions button:hover {
    background-color: #333;
    border-color: #333;
    color: #fff !important;
}

/* ── Table responsive overflow ────────────────────────────────────────────── */

.table-responsive {
    border: 1px solid #e1e1e1;
    border-radius: 0;
}

.table-responsive .table {
    margin-bottom: 0;
}

/* ── Editor isolation: prevent Squarespace overrides from breaking editor UI ── */

#qf-editor .form-control,
#qf-editor .form-select {
    min-height: unset;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
}

#qf-editor .nav-link {
    font-size: inherit;
    font-weight: inherit;
}

#qf-editor .form-label {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: none;
}

#qf-editor .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    letter-spacing: 0;
    min-width: unset;
}

#qf-editor .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

#qf-editor .btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

#qf-editor .card {
    border-radius: 4px;
}

#qf-editor .dropdown-menu {
    border-radius: 4px;
}

/* Pace.js loading bar overrides */
.pace .pace-progress {
    background: #FFD700 !important;
    height: 3px !important;
}

@media (max-width: 991.98px) and (prefers-color-scheme: dark) {
    .main-nav .navbar-collapse {
        background: #111;
        border-bottom: 1px solid #2a2a2a;
    }
    .main-nav .navbar-collapse .nav-link,
    .main-nav .navbar-collapse .dropdown-toggle {
        color: #e0e0e0 !important;
    }
    .main-nav .navbar-collapse .dropdown-menu {
        background: #1a1a1a;
        border-top-color: #2a2a2a;
    }
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item {
        color: #e0e0e0 !important;
    }
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item:hover,
    .main-nav .navbar-collapse .dropdown-menu .dropdown-item:focus {
        color: #fff !important;
        background-color: rgba(255, 255, 255, 0.1);
    }
}
