/*
 * Backend shell in the BaseApp style: left sidebar, top bar, cards and KPI widgets.
 * Colors and measures mirror BaseApp (colors.css, sidebar-menu.css, dashboard KPI widgets).
 */
:root {
    --ba-primary: #00619d;
    --ba-primary-deep: #004f80;
    --ba-primary-soft: #e7f1f8;
    --ba-primary-mist: #f2f7fb;
    --ba-navy: #222d5b;
    --ba-ink: #3c3c3c;
    --ba-ink-soft: #55595f;
    --ba-mute: #7c828c;
    --ba-faint: #9a9a9a;
    --ba-line: #e5e7eb;
    --ba-wash: #f7f7f7;
    --ba-paper: #ffffff;
    --ba-info: #1fc3e6;
    --ba-info-soft: #e3f8fc;
    --ba-ok: #58a700;
    --ba-ok-soft: #eaf7dc;
    --ba-warn: #e5a100;
    --ba-warn-soft: #fff5cc;
    --ba-alert: #ea2b2b;
    --ba-alert-soft: #ffe5e5;
    --ba-sidebar-width: 300px;
    --ba-sidebar-mini: 76px;
    --ba-topbar-height: 64px;
}

body.ba-body {
    background: var(--ba-wash);
    color: var(--ba-ink);
}

/* ==========================================================================
   Shell
   ========================================================================== */

.ba-shell {
    min-height: 100vh;
}

.ba-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--ba-sidebar-width);
    background: var(--ba-paper);
    border-right: 1px solid var(--ba-line);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease, width .2s ease;
}

.ba-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}

.ba-sidebar__brand {
    height: var(--ba-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 20px;
    flex-shrink: 0;
}

.ba-sidebar__brand img {
    height: 30px;
    width: auto;
}

.ba-sidebar__brand img.ba-hide-collapsed {
    height: 36px;
}

.ba-show-collapsed {
    display: none !important;
}

.ba-sidebar__scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 14px 24px;
}

.ba-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .35);
    z-index: 30;
}

.ba-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: padding-left .2s ease;
}

.ba-content {
    flex: 1 1 auto;
    padding: 20px 16px 32px;
    width: 100%;
}

@media (min-width: 1024px) {
    .ba-sidebar {
        transform: none;
    }

    .ba-sidebar.is-open {
        box-shadow: none;
    }

    .ba-main {
        padding-left: var(--ba-sidebar-width);
    }

    .ba-content {
        padding: 24px 24px 40px;
    }

    .ba-overlay {
        display: none !important;
    }

    /* Collapsed sidebar: icons only */
    .ba-shell.is-collapsed .ba-sidebar {
        width: var(--ba-sidebar-mini);
    }

    .ba-shell.is-collapsed .ba-main {
        padding-left: var(--ba-sidebar-mini);
    }

    .ba-shell.is-collapsed .ba-hide-collapsed {
        display: none !important;
    }

    .ba-shell.is-collapsed .ba-show-collapsed {
        display: block !important;
    }

    .ba-shell.is-collapsed .ba-sidebar__brand {
        justify-content: center;
        padding: 0;
    }

    .ba-shell.is-collapsed .ba-sidebar__scroll {
        padding: 4px 10px 24px;
    }

    .ba-shell.is-collapsed .ba-menu-link {
        justify-content: center;
        padding: 9px 0;
    }

    .ba-shell.is-collapsed .ba-profile {
        justify-content: center;
        padding: 8px 0;
    }
}

/* ==========================================================================
   Sidebar content
   ========================================================================== */

.ba-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--ba-wash);
    border-radius: 10px;
    margin-bottom: 10px;
    color: inherit;
}

.ba-profile:hover {
    background: #f0f2f5;
}

.ba-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ba-primary-soft);
    color: var(--ba-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.ba-avatar--sm {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.ba-profile__name {
    font-size: 16px;
    font-weight: 500;
    color: var(--ba-ink);
    line-height: 1.25;
}

.ba-profile__sub {
    font-size: 14px;
    color: var(--ba-mute);
    line-height: 1.25;
}

.ba-impersonation {
    border: 1px solid #fde68a;
    background: #fffbeb;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.ba-impersonation__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #b45309;
}

.ba-impersonation__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ba-ink);
    margin: 2px 0 8px;
}

.ba-impersonation__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #b45309;
}

.ba-impersonation__back:hover {
    color: #92400e;
}

.ba-menu-hdr {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ba-faint);
    margin: 18px 0 8px 10px;
}

.ba-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 18px;
    border-radius: 8px;
    color: var(--ba-ink-soft);
    font-size: 15px;
    margin-bottom: 2px;
}

.ba-menu-link:hover {
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
}

.ba-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--ba-line);
    background: var(--ba-paper);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ba-mute);
    flex-shrink: 0;
}

.ba-menu-link.is-active {
    background: var(--ba-primary-soft);
    color: var(--ba-primary);
    font-weight: 600;
}

.ba-menu-link.is-active .ba-menu-icon {
    background: var(--ba-primary);
    border-color: var(--ba-primary);
    color: #fff;
}

/* Sub-entry of the menu (e.g. Users > Vacation and permits) */
.ba-menu-link--sub {
    padding-left: 34px;
    font-size: 14px;
}

.ba-menu-link--sub .ba-menu-icon {
    width: 26px;
    height: 26px;
}

/* Small counter of things waiting for the user (requests to approve...) */
.ba-menu-link {
    position: relative;
}

.ba-menu-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .ba-shell.is-collapsed .ba-menu-link--sub {
        padding-left: 0;
    }

    .ba-shell.is-collapsed .ba-menu-count {
        position: absolute;
        top: 2px;
        right: 6px;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        padding: 0 4px;
        font-size: 10px;
    }
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.ba-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--ba-topbar-height);
    background: var(--ba-paper);
    border-bottom: 1px solid var(--ba-line);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
}

@media (min-width: 1024px) {
    .ba-topbar {
        padding: 0 24px;
    }
}

.ba-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--ba-line);
    background: var(--ba-paper);
    color: var(--ba-ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ba-icon-btn:hover {
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
}

.ba-chip-btn {
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--ba-line);
    background: var(--ba-paper);
    color: var(--ba-ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 14px;
    max-width: 320px;
}

.ba-chip-btn:hover {
    border-color: #cbd5e1;
}

/* Company switcher: the chip shrinks with the top bar instead of pushing it wider. */
.ba-switcher {
    min-width: 0;
    flex: 0 1 auto;
}

.ba-chip-btn--fluid {
    max-width: 100%;
}

.ba-chip-btn--fluid > .truncate {
    min-width: 0;
}

.ba-count-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
    font-size: 12px;
    font-weight: 600;
}

.ba-search {
    position: relative;
    flex: 0 1 380px;
}

.ba-search input {
    width: 100%;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--ba-line);
    background: var(--ba-wash);
    padding: 0 12px 0 36px;
    font-size: 14px;
}

.ba-search input:focus {
    outline: none;
    border-color: var(--ba-primary);
    background: var(--ba-paper);
    box-shadow: 0 0 0 3px var(--ba-primary-soft);
}

.ba-search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ba-mute);
    pointer-events: none;
}

.ba-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    background: var(--ba-paper);
    border: 1px solid var(--ba-line);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
    z-index: 50;
    padding: 6px;
}

.ba-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--ba-ink);
}

.ba-dropdown__item:hover,
.ba-dropdown__item:focus {
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
    outline: none;
}

.ba-dropdown__item.is-active {
    color: var(--ba-primary);
    font-weight: 600;
}

.ba-dropdown__hdr {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ba-faint);
    padding: 8px 10px 4px;
}

/* ==========================================================================
   Page header, cards, KPI
   ========================================================================== */

.ba-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.ba-page-header__icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--ba-primary);
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ba-page-header__title {
    font-size: 19px;
    font-weight: 500;
    color: var(--ba-ink);
    line-height: 1.2;
}

.ba-page-header__crumb {
    font-size: 14px;
    color: var(--ba-primary);
}

.ba-card {
    background: var(--ba-paper);
    border: 1px solid var(--ba-line);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.ba-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ba-ink);
}

.ba-kpi-row {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .ba-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .ba-kpi-row {
        grid-template-columns: repeat(var(--ba-kpi-cols, 5), minmax(0, 1fr));
    }
}

.ba-kpi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    min-height: 92px;
    transition: transform .2s ease, box-shadow .2s ease;
    color: inherit;
}

a.ba-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, .05);
}

.ba-kpi__value {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ba-ink);
    font-variant-numeric: tabular-nums;
}

.ba-kpi__label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-top: 2px;
}

.ba-kpi__delta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    min-height: 1.15em;
}

.ba-kpi__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ba-tone-primary { background: var(--ba-primary-soft); color: var(--ba-primary); }
.ba-tone-success { background: var(--ba-ok-soft); color: var(--ba-ok); }
.ba-tone-info { background: var(--ba-info-soft); color: #0e9bb8; }
.ba-tone-warning { background: var(--ba-warn-soft); color: var(--ba-warn); }
.ba-tone-secondary { background: #eef0f4; color: var(--ba-navy); }

.ba-text-success { color: var(--ba-ok); }

.ba-table {
    width: 100%;
    border-collapse: collapse;
}

.ba-table thead th {
    background: var(--ba-wash);
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--ba-ink);
    padding: 12px 12px;
    border-bottom: 1px solid var(--ba-line);
}

.ba-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--ba-line);
    font-size: 14px;
    color: var(--ba-ink);
    vertical-align: middle;
}

.ba-table tbody tr:hover {
    background: var(--ba-primary-mist);
}

.ba-btn-enter {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--ba-info);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ba-btn-enter:hover {
    background: #13a9ca;
}

.ba-btn-light {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border-radius: 6px;
    background: var(--ba-wash);
    border: 1px solid var(--ba-line);
    font-size: 14px;
    font-weight: 600;
    color: var(--ba-ink);
}

.ba-btn-light:hover {
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
}

.ba-btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--ba-wash);
    border: 1px solid var(--ba-line);
    font-size: 12px;
    font-weight: 600;
    color: var(--ba-ink);
}

.ba-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

/* Existing pages inside the new shell: no extra centering gutter */
.ba-content > .container,
.ba-content .container.mx-auto {
    max-width: none;
}

/* Visibility helpers: .ba-icon-btn sets display, which would win over Tailwind's hidden/lg:hidden */
@media (min-width: 1024px) {
    .ba-mobile-only {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .ba-desktop-only {
        display: none !important;
    }
}

/* ==========================================================================
   Horizontal tabs (BaseApp "Fatture" style) and buttons
   ========================================================================== */

.ba-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--ba-line);
    padding: 0 12px;
    scrollbar-width: thin;
}

.ba-tab {
    position: relative;
    white-space: nowrap;
    padding: 14px 14px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ba-mute);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
}

.ba-tab:hover {
    color: var(--ba-ink);
}

.ba-tab.is-active {
    color: var(--ba-primary);
    border-bottom-color: var(--ba-primary);
    font-weight: 600;
}

.ba-tab__count {
    color: var(--ba-faint);
    font-weight: 500;
    margin-left: 2px;
}

.ba-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    background: var(--ba-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--ba-primary);
}

.ba-btn-primary:hover {
    background: var(--ba-primary-deep);
}

.ba-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--ba-paper);
    color: var(--ba-ink);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--ba-line);
}

.ba-btn-outline:hover {
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
}

/* A tab strip alone in a card: no extra space below the line */
.ba-card > .ba-tabs:only-child {
    margin-bottom: 0;
}

/* Status pills (grids, license tab, ...) */
.rp-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.rp-pill--success { background: #eaf7dc; color: #3f7a00; }
.rp-pill--danger { background: #ffe5e5; color: #c81e1e; }
.rp-pill--warning { background: #fff5cc; color: #9a6b00; }
.rp-pill--info { background: #e7f1f8; color: #00619d; }
.rp-pill--muted { background: #eef0f4; color: #55595f; }

/* Alerts (e.g. licenses expiring on the admin dashboard) */
.rp-alert {
    border-radius: 10px;
    border: 1px solid;
    padding: 12px 16px;
    font-size: 14px;
}

.rp-alert--danger { background: var(--ba-alert-soft); border-color: #f8b4b4; color: #9b1c1c; }
.rp-alert--warning { background: var(--ba-warn-soft); border-color: #f6d860; color: #8a5a00; }

.rp-alert__chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: 600;
    color: inherit;
}

.rp-alert__chip:hover {
    background: #fff;
}

/* Modal */
.rp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .45);
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 16px;
    overflow-y: auto;
}

.rp-modal {
    width: 100%;
    max-width: 640px;
    background: var(--ba-paper);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
}

/* Wizard inside a modal: steps, choice cards, summary */
.rp-wizard-steps {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
}

.rp-wizard-steps li {
    flex: 1;
    min-width: 0;
    border-bottom: 3px solid var(--ba-line);
}

.rp-wizard-steps li.is-current,
.rp-wizard-steps li.is-done {
    border-color: var(--ba-primary);
}

.rp-wizard-steps button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 0 10px;
    background: none;
    border: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ba-mute);
    text-align: left;
}

.rp-wizard-steps .is-current button,
.rp-wizard-steps .is-done button {
    color: var(--ba-ink);
}

.rp-wizard-steps__dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ba-wash);
    border: 1px solid var(--ba-line);
    font-size: 12px;
}

.rp-wizard-steps .is-current .rp-wizard-steps__dot,
.rp-wizard-steps .is-done .rp-wizard-steps__dot {
    background: var(--ba-primary);
    border-color: var(--ba-primary);
    color: #fff;
}

.rp-wizard-steps__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .rp-wizard-steps li:not(.is-current) .rp-wizard-steps__label {
        display: none;
    }
}

.rp-wizard-body {
    min-height: 340px;
}

.rp-wizard-legend {
    font-size: 13px;
    font-weight: 600;
    color: var(--ba-ink);
    margin-bottom: 8px;
}

.rp-wizard-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--ba-mute);
}

.rp-field .rp-choice {
    position: relative;
    display: flex;
    margin-bottom: 0;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 1px solid var(--ba-line);
    border-radius: 10px;
    background: var(--ba-paper);
    color: var(--ba-ink-soft);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.rp-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rp-choice:hover {
    background: var(--ba-primary-mist);
}

.rp-choice:has(input:checked) {
    border-color: var(--ba-primary);
    background: var(--ba-primary-soft);
    color: var(--ba-primary);
}

.rp-choice:has(input:focus-visible) {
    box-shadow: 0 0 0 3px var(--ba-primary-soft);
}

.rp-field .rp-choice--row {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
}

.rp-choice--row small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--ba-mute);
}

.rp-stepper {
    display: flex;
    gap: 8px;
    max-width: 220px;
}

.rp-stepper .ba-btn-outline {
    flex: none;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
}

.rp-field .rp-stepper input[type="number"] {
    text-align: center;
}

.rp-summary {
    margin: 0;
    border: 1px solid var(--ba-line);
    border-radius: 10px;
}

.rp-summary > div {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 12px;
    padding: 12px 14px;
    font-size: 14px;
}

.rp-summary > div + div {
    border-top: 1px solid var(--ba-line);
}

.rp-summary dt {
    color: var(--ba-mute);
    font-weight: 600;
    font-size: 13px;
}

.rp-summary dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.rp-summary__edit {
    background: none;
    border: 0;
    padding: 0;
    color: var(--ba-primary);
    font-size: 13px;
    font-weight: 600;
    align-self: start;
}

@media (max-width: 480px) {
    .rp-summary > div {
        grid-template-columns: 1fr auto;
    }

    .rp-summary dd {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.rp-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ba-ink);
    margin-bottom: 4px;
}

.rp-field input[type="text"],
.rp-field input[type="email"],
.rp-field input[type="url"],
.rp-field input[type="date"],
.rp-field input[type="number"],
.rp-field input[type="tel"],
.rp-field select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--ba-line);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    background: var(--ba-paper);
}

.rp-field textarea {
    width: 100%;
    border: 1px solid var(--ba-line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--ba-paper);
}

.rp-field input:focus,
.rp-field textarea:focus,
.rp-field select:focus {
    outline: none;
    border-color: var(--ba-primary);
    box-shadow: 0 0 0 3px var(--ba-primary-soft);
}

/* Google Places "Search address" box (device request) */
.rp-field gmp-place-autocomplete {
    display: block;
    width: 100%;
    color-scheme: light;
    /* Same frame as the other fields: Google draws none */
    border: 1px solid var(--ba-line);
    border-radius: 8px;
    background: var(--ba-paper);
}

.rp-field gmp-place-autocomplete:focus-within {
    border-color: var(--ba-primary);
    box-shadow: 0 0 0 3px var(--ba-primary-soft);
}

.rp-field__help {
    font-size: 12px;
    color: var(--ba-mute);
    margin-top: 4px;
}

/* Person form: permission cards and permission icons in the users list */
.rp-flag:has(input:checked) {
    border-color: var(--ba-primary);
    background: var(--ba-primary-mist);
}
.rp-perm-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rp-perm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--ba-primary-mist);
    color: var(--ba-primary);
    cursor: help;
}
.rp-perm-icon.is-off {
    background: transparent;
    color: #b8bec8;
}

/* ==========================================================================
   Legacy Tailwind blues inside the backend shell
   Older pages still use Tailwind's bright blue utilities for buttons, links and
   focus rings: inside the shell they take the theme blue, so every primary
   button and link looks the same whatever template it comes from.
   ========================================================================== */

.ba-shell .bg-blue-600 { background-color: var(--ba-primary); }
.ba-shell .hover\:bg-blue-700:hover,
.ba-shell .bg-blue-700 { background-color: var(--ba-primary-deep); }
.ba-shell .bg-blue-50 { background-color: var(--ba-primary-mist); }
.ba-shell .bg-blue-100 { background-color: var(--ba-primary-soft); }
.ba-shell .text-blue-600,
.ba-shell .text-blue-700 { color: var(--ba-primary); }
.ba-shell .hover\:text-blue-700:hover,
.ba-shell .hover\:text-blue-800:hover,
.ba-shell .hover\:text-blue-900:hover { color: var(--ba-primary-deep); }
.ba-shell .border-blue-500,
.ba-shell .border-blue-600 { border-color: var(--ba-primary); }
.ba-shell .focus\:border-blue-500:focus { border-color: var(--ba-primary); }
.ba-shell .focus\:ring-blue-500:focus,
.ba-shell .focus\:ring-blue-500\/20:focus { --tw-ring-color: color-mix(in srgb, var(--ba-primary) 25%, transparent); }

/* Organization settings: a module with the add-ons that depend on it */
.ba-modules {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

@media (min-width: 1024px) {
    .ba-modules {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ba-module {
    background: var(--ba-paper);
    border: 1px solid var(--ba-line);
    border-radius: 10px;
    overflow: hidden;
}

.ba-module__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
}

.ba-module__row + .ba-module__row {
    border-top: 1px solid var(--ba-line);
}

.ba-module__row--head {
    padding: 16px;
}

.ba-module__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 20px;
    margin-top: 1px;
    color: var(--ba-ink-soft);
}

.ba-module__row--head .ba-module__icon {
    height: 36px;
    margin-top: 0;
    border-radius: 8px;
    background: var(--ba-primary-soft);
    color: var(--ba-primary);
}

.ba-module.is-off .ba-module__row--head .ba-module__icon {
    background: #eef0f4;
    color: var(--ba-ink-soft);
}

.ba-module__text {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.ba-module__name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ba-ink);
}

.ba-module__row--head .ba-module__name {
    font-size: 15px;
    color: var(--ba-navy);
}

.ba-module__description {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--ba-ink-soft);
}

.ba-module__addons {
    border-top: 1px solid var(--ba-line);
    background: var(--ba-primary-mist);
}

.ba-module__addons-label {
    padding: 10px 16px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ba-ink-soft);
}

.ba-module.is-off .ba-module__addons .ba-module__row {
    opacity: .5;
}

.ba-module.is-off .ba-module__addons .ba-module__text {
    cursor: default;
}

/* On/off switch drawn on a real checkbox */
input.ba-switch {
    flex: none;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 36px;
    height: 20px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: #c9ced6;
    cursor: pointer;
    transition: background-color .15s ease;
}

input.ba-switch::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}

input.ba-switch:checked {
    background: var(--ba-primary);
}

input.ba-switch:checked::before {
    transform: translateX(16px);
}

input.ba-switch:focus-visible {
    outline: 2px solid var(--ba-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    input.ba-switch,
    input.ba-switch::before {
        transition: none;
    }
}

/* Settings that belong to the option above, inside a module box (e.g. the Teams sender) */
.ba-module__panel {
    padding: 0 16px 16px 64px;
}

.ba-module__addons-label:not(:first-child) {
    padding-top: 16px;
}

.ba-module__row--head .rp-pill {
    flex: none;
    margin-top: 8px;
}

.ba-module__row .ba-btn-outline {
    flex: none;
}
