:root {
    --sidebar-width: 268px;
    --brand-navy: #082b58;
    --brand-blue: #0b75db;
    --brand-cyan: #10c9e8;
    --brand-sky: #eaf7ff;
    --brand-ink: #14304b;
    --brand-muted: #708399;
    --brand-line: #dfeaf4;
    --app-bg: #f4f9fd;
    --card-bg: rgba(255, 255, 255, .96);
    --card-shadow: 0 14px 34px rgba(8, 43, 88, .08);
    --card-shadow-hover: 0 18px 40px rgba(8, 43, 88, .13);
    --radius-xl: 1.35rem;
    --radius-lg: 1rem;
    --radius-md: .8rem;
}

html { scroll-behavior: smooth; }

body {
    background:
        radial-gradient(circle at 92% 2%, rgba(16, 201, 232, .09), transparent 23rem),
        radial-gradient(circle at 4% 100%, rgba(11, 117, 219, .08), transparent 24rem),
        var(--app-bg);
    color: var(--brand-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(120deg, transparent 0 18%, rgba(11,117,219,.025) 18.1% 18.4%, transparent 18.5% 100%),
        linear-gradient(300deg, transparent 0 86%, rgba(16,201,232,.03) 86.1% 86.5%, transparent 86.6% 100%);
}

a { color: var(--brand-blue); }
a:hover { color: #075cae; }

.text-secondary { color: var(--brand-muted) !important; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Layout */
.app-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    overflow-y: auto;
    padding-bottom: 6rem !important;
    background:
        radial-gradient(circle at 18% 0, rgba(16,201,232,.18), transparent 18rem),
        linear-gradient(180deg, #082f62 0%, #06305a 48%, #052544 100%);
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 20px 0 50px rgba(8,43,88,.09);
}

.app-sidebar::after {
    content: "";
    position: absolute;
    inset: auto -10rem -10rem auto;
    width: 20rem;
    height: 20rem;
    border: 1px solid rgba(16,201,232,.12);
    border-radius: 50%;
    pointer-events: none;
}

.app-sidebar .brand {
    color: #fff;
    font-weight: 800;
    letter-spacing: -.02em;
    text-decoration: none;
}

.brand-mark {
    width: 46px;
    height: 46px;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0, 204, 238, .18));
    flex: 0 0 auto;
}

.brand-title { font-size: 1rem; line-height: 1.1; }
.brand-subtitle { color: rgba(226, 244, 255, .7); font-size: .73rem; font-weight: 500; }

.app-sidebar .nav { position: relative; z-index: 1; }
.app-sidebar .nav-link {
    color: rgba(225, 239, 250, .73);
    border-radius: .9rem;
    padding: .72rem .82rem;
    margin: .08rem 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .15rem;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.app-sidebar .nav-link i { width: 1.35rem; font-size: 1.06rem; color: #83dff1; }
.app-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.app-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(11,117,219,.88), rgba(16,201,232,.32));
    box-shadow: 0 10px 22px rgba(0, 72, 142, .25), inset 0 0 0 1px rgba(255,255,255,.08);
}
.app-sidebar .nav-link.active i { color: #fff; }
.app-sidebar hr { border-color: rgba(255,255,255,.13) !important; opacity: 1 !important; }

.app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;
}

.topbar {
    min-height: 72px;
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(198, 218, 233, .7);
    box-shadow: 0 4px 18px rgba(8,43,88,.035);
}

.topbar .btn-light,
.topbar .dropdown-toggle {
    background: #fff;
    border: 1px solid var(--brand-line);
    color: var(--brand-ink);
    border-radius: .8rem;
    box-shadow: 0 5px 14px rgba(8,43,88,.05);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}
.mobile-brand img { width: 30px; height: 30px; object-fit: contain; }
.mobile-brand span { font-weight: 800; color: var(--brand-navy); white-space: nowrap; }

.content-wrap {
    width: 100%;
    max-width: 1560px;
    min-width: 0;
    padding: 1.6rem clamp(1rem, 2.3vw, 2.25rem) 2.4rem;
    margin: 0 auto;
}

.legal-footer {
    clear: both;
    width: 100%;
    margin-top: 2rem;
    border-top: 1px solid rgba(205, 224, 238, .72);
}

.legal-footer a {
    display: inline-block;
    margin-block: .25rem;
}

/* Typography + headings */
h1, h2, h3, h4, h5, h6 { color: var(--brand-ink); letter-spacing: -.025em; }
h1, h2, h3 { font-weight: 800; }
h2 { font-size: clamp(1.55rem, 2.1vw, 2rem); }

.content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4 {
    position: relative;
    padding: .35rem 0 .35rem .9rem;
}
.content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4::before {
    content: "";
    position: absolute;
    inset: .4rem auto .4rem 0;
    width: 4px;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--brand-cyan), var(--brand-blue));
}

/* Cards */
.card {
    border: 1px solid rgba(205, 224, 238, .82);
    border-radius: var(--radius-xl);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.card-header,
.card-footer {
    border-color: rgba(213, 228, 240, .84) !important;
    background: rgba(255,255,255,.88) !important;
}
.card-header { font-weight: 700; }
.metric-card {
    position: relative;
    border: 0;
    min-height: 128px;
    transition: transform .2s ease, box-shadow .2s ease;
    isolation: isolate;
}
.metric-card::after {
    content: "";
    position: absolute;
    inset: auto -2.3rem -2.8rem auto;
    width: 7rem;
    height: 7rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16,201,232,.12), transparent 68%);
    z-index: -1;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.metric-card .card-body { padding: 1.25rem; }
.metric-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    font-size: 1.25rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.metric-card .fs-4 { font-size: clamp(1.32rem, 2.1vw, 1.7rem) !important; color: var(--brand-ink); }

/* Buttons */
.btn {
    border-radius: .8rem;
    font-weight: 700;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #0876de, #08b9df);
    box-shadow: 0 9px 20px rgba(11,117,219,.19);
}
.btn-primary:hover,
.btn-primary:focus { border-color: transparent; background: linear-gradient(135deg, #0668c7, #08a8cb); }
.btn-outline-primary { color: #0871d1; border-color: #8ac8ef; background: rgba(255,255,255,.72); }
.btn-outline-primary:hover { color: #fff; border-color: #0876de; background: #0876de; }
.btn-outline-secondary { color: #5d7186; border-color: #c7d6e3; background: rgba(255,255,255,.78); }
.btn-success { box-shadow: 0 8px 18px rgba(25,135,84,.13); }
.btn-danger { box-shadow: 0 8px 18px rgba(220,53,69,.12); }
.btn-sm { border-radius: .65rem; }

/* Forms */
.form-label { font-size: .86rem; font-weight: 700; color: #435d74; margin-bottom: .42rem; }
.form-control,
.form-select {
    min-height: 44px;
    border: 1px solid #cfe0ec;
    border-radius: .82rem;
    background-color: rgba(255,255,255,.95);
    color: var(--brand-ink);
    box-shadow: inset 0 1px 2px rgba(8,43,88,.015);
}
.form-control:focus,
.form-select:focus {
    border-color: #51bce6;
    box-shadow: 0 0 0 .22rem rgba(16, 201, 232, .12);
}
.form-control::placeholder { color: #9aabbb; }
.form-check-input:checked { background-color: var(--brand-blue); border-color: var(--brand-blue); }

/* Alerts */
.alert { border-radius: 1rem; border-width: 1px; box-shadow: 0 7px 20px rgba(8,43,88,.035); }
.alert-light { background: rgba(255,255,255,.86); border-color: #d9e7f1 !important; }

/* Tables */
.table-responsive { border-radius: inherit; }
.table { color: var(--brand-ink); --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .9rem .85rem; border-color: #e8f0f6; vertical-align: middle; }
.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: #7890a6;
    font-weight: 800;
    background: #f7fbfe;
    border-bottom-color: #dce9f2;
}
.table tbody tr { transition: background-color .14s ease; }
.table tbody tr:hover { background: rgba(234,247,255,.58); }
.table a.fw-semibold { color: #086ac7; }

.badge {
    border-radius: 999px;
    padding: .46em .7em;
    letter-spacing: .01em;
}
.badge-status,
.badge.text-bg-secondary { background: #e7f3fb !important; color: #255f8d !important; }
.badge.text-bg-primary { background: #dceeff !important; color: #075da9 !important; }
.badge.text-bg-success { background: #dcf5e7 !important; color: #157347 !important; }
.badge.text-bg-warning { background: #fff2cb !important; color: #7d5b00 !important; }
.badge.text-bg-danger { background: #fde4e7 !important; color: #a52c3a !important; }

/* Lists and dropdowns */
.list-group-item { border-color: #edf2f6; background: transparent; }
.list-group-item-action:hover { background: #f3faff; }
.dropdown-menu {
    border: 1px solid #dbe8f1;
    border-radius: 1rem;
    padding: .5rem;
    box-shadow: 0 18px 45px rgba(8,43,88,.14);
}
.dropdown-item { border-radius: .65rem; padding: .62rem .7rem; }
.dropdown-item:hover { background: #eef8ff; color: #075fae; }

/* Dashboard */
.dashboard-chart-card .card-body { padding: 1.2rem 1.2rem 1rem; }
.chart-shell { position: relative; min-height: 320px; height: 320px; }
.dashboard-upcoming .list-group-item { padding: 1rem 1.15rem; }
.dashboard-upcoming strong { color: var(--brand-ink); }

/* Guest / auth */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    background:
        radial-gradient(circle at 12% 12%, rgba(16,201,232,.22), transparent 20rem),
        radial-gradient(circle at 88% 88%, rgba(11,117,219,.18), transparent 24rem),
        linear-gradient(135deg, #effaff, #f7fbff 42%, #e9f5ff);
}
.auth-card { width: 100%; max-width: 470px; border: 1px solid rgba(184,215,237,.75); }
.auth-logo-wrap {
    width: 68px;
    height: 68px;
    margin-inline: auto;
    display: grid;
    place-items: center;
    border-radius: 1.15rem;
    background: linear-gradient(145deg, #eefbff, #fff);
    box-shadow: 0 12px 24px rgba(8,43,88,.1), inset 0 0 0 1px rgba(130,198,237,.45);
}
.auth-logo-wrap img { width: 48px; height: 48px; object-fit: contain; }

/* Plan cards */
.navbar { backdrop-filter: blur(12px); }
section.py-5 .card { transition: transform .2s ease, box-shadow .2s ease; }
section.py-5 .card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }

/* WhatsApp */
.support-whatsapp {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8rem 1rem;
    border-radius: 999px;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 10px 26px rgba(24, 145, 80, .24);
    transition: .2s ease;
}
.support-whatsapp:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 30px rgba(24,145,80,.3); }
.support-whatsapp i { font-size: 1.3rem; }

.sidebar-backdrop { display: none; }

@media (min-width: 992px) {
    body.authenticated .support-whatsapp {
        left: 18px;
        right: auto;
        bottom: 18px;
        width: calc(var(--sidebar-width) - 36px);
        box-shadow: 0 8px 22px rgba(0,0,0,.2);
    }
}

@media (max-width: 1199.98px) {
    :root { --sidebar-width: 250px; }
    .content-wrap { padding-inline: 1.25rem; }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(82vw, 310px);
        transform: translateX(-104%);
        transition: transform .22s ease;
        box-shadow: 24px 0 55px rgba(3, 30, 56, .25);
    }
    .app-sidebar.show { transform: translateX(0); }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1025;
        background: rgba(5, 31, 56, .34);
        backdrop-filter: blur(1.5px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .2s ease, visibility .2s ease;
    }
    .sidebar-backdrop.show { opacity: 1; visibility: visible; pointer-events: auto; }
    body.sidebar-open { overflow: hidden; }
    .app-main { margin-left: 0; width: 100%; }
    .content-wrap { padding: 1rem 1rem 6.25rem; }
    .topbar { min-height: 66px; }
    .chart-shell { min-height: 290px; height: 290px; }
}

/* On small screens data grids become real stacked cards: no horizontal dragging. */
@media (max-width: 767.98px) {
    .table-responsive {
        overflow-x: visible !important;
        overflow-y: visible !important;
        border-radius: 0;
        background: transparent;
    }

    .responsive-data-table {
        display: block;
        width: 100%;
        margin: 0;
        border: 0;
        background: transparent;
    }
    .responsive-data-table thead { display: none; }
    .responsive-data-table tbody {
        display: grid;
        width: 100%;
        gap: .8rem;
        padding: .8rem;
    }
    .responsive-data-table tbody tr {
        display: block;
        width: 100%;
        padding: .28rem .95rem;
        border: 1px solid #dce9f2;
        border-radius: 1rem;
        background: #fff;
        box-shadow: 0 8px 22px rgba(8,43,88,.055);
    }
    .responsive-data-table tbody tr:hover { background: #fff; }
    .responsive-data-table tbody td {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: .75rem;
        width: 100%;
        padding: .68rem 0;
        border: 0;
        border-bottom: 1px dashed #e4edf4;
        text-align: right !important;
        overflow-wrap: anywhere;
    }
    .responsive-data-table tbody td:last-child { border-bottom: 0; }
    .responsive-data-table tbody td::before {
        content: attr(data-label);
        color: #7890a6;
        font-size: .72rem;
        line-height: 1.35;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .045em;
        text-align: left;
        padding-top: .14rem;
    }
    .responsive-data-table tbody td > * { min-width: 0; }
    .responsive-data-table tbody td .btn { margin-block: .1rem; }
    .responsive-data-table tbody td[data-label="Ações"],
    .responsive-data-table tbody td[data-label="Acoes"] {
        align-items: center;
    }
    .mobile-card-actions {
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: .45rem;
        flex-wrap: wrap;
    }
    .mobile-card-actions > a,
    .mobile-card-actions > button,
    .mobile-card-actions > form {
        flex: 0 0 auto;
        margin: 0 !important;
    }
    .mobile-card-actions > form {
        display: inline-flex !important;
        align-items: center;
    }
    .mobile-card-actions .btn {
        width: auto !important;
        min-width: 2.35rem;
        margin: 0 !important;
    }
    .responsive-data-table tbody td[data-empty="true"] {
        display: block;
        padding: 1.2rem .4rem;
        border: 0;
        text-align: center !important;
        color: var(--brand-muted);
    }
    .responsive-data-table tbody td[data-empty="true"]::before { display: none; }
    .responsive-data-table tbody tr.table-empty-row { padding: 0; }

    .card > .table-responsive + .card-footer,
    .card > .card-footer { border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

    .content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4 {
        align-items: stretch !important;
    }
    .content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4 > .btn,
    .content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4 > .d-flex {
        width: 100%;
    }
    .content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4 > .d-flex .btn { flex: 1 1 0; }

    .card .card-body form .d-flex.gap-2 { flex-wrap: wrap; }
    .card .card-body form .d-flex.gap-2 .btn { flex: 1 1 auto; }
    .chart-shell { height: 270px; min-height: 270px; }
}

@media (max-width: 575.98px) {
    .content-wrap { padding-inline: .75rem; }
    .card { border-radius: 1rem; }
    .metric-card .card-body { padding: 1rem; }
    .metric-icon { width: 46px; height: 46px; }
    .topbar { padding-inline: .75rem !important; }
    .topbar .dropdown-toggle { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-brand span { display: none; }
    .support-whatsapp { right: 16px; bottom: 16px; width: 52px; height: 52px; padding: 0; }
    .support-whatsapp span { display: none; }
    .support-whatsapp i { font-size: 1.45rem; }
    body.guest { padding-bottom: 5.25rem; }
    .responsive-data-table tbody { padding: .7rem; }
    .responsive-data-table tbody td { grid-template-columns: 88px minmax(0, 1fr); }
}

@media print {
    .app-sidebar, .topbar, .no-print, .support-whatsapp { display: none !important; }
    .app-main { margin: 0; width: 100%; }
    body { background: white; }
    body::before { display: none; }
    .content-wrap { max-width: none; padding: 0; }
    .card { box-shadow: none; border-color: #ddd; }
    .table-responsive { overflow: visible !important; }
    .responsive-data-table { display: table; }
    .responsive-data-table thead { display: table-header-group; }
    .responsive-data-table tbody { display: table-row-group; padding: 0; }
    .responsive-data-table tbody tr { display: table-row; box-shadow: none; border: 0; padding: 0; }
    .responsive-data-table tbody td { display: table-cell; text-align: inherit !important; border-bottom: 1px solid #ddd; padding: .5rem; }
    .responsive-data-table tbody td::before { display: none; }
}

.min-w-0 { min-width: 0 !important; }
@media (max-width: 767.98px) {
    .responsive-data-table .input-group { flex-wrap: wrap; gap: .35rem; }
    .responsive-data-table .input-group > .form-control,
    .responsive-data-table .input-group > .form-select,
    .responsive-data-table .input-group > .btn { border-radius: .65rem !important; flex: 1 1 100%; width: 100%; }
}

.legal-copy h4 { margin-top: 1.75rem; margin-bottom: .65rem; }
.legal-copy h4:first-child { margin-top: 0; }
.legal-copy p, .legal-copy li { line-height: 1.72; }


/* Theme switcher */
.theme-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
}
.app-sidebar .theme-toggle {
    color: rgba(225, 239, 250, .78);
}
.app-sidebar .theme-toggle:hover,
.app-sidebar .theme-toggle:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.08);
}
.theme-footer-toggle { font-weight: 600; }

html[data-theme="dark"] {
    color-scheme: dark;
    --brand-navy: #dcecff;
    --brand-blue: #55aefb;
    --brand-cyan: #39d4ed;
    --brand-sky: #0b2135;
    --brand-ink: #e6f0f8;
    --brand-muted: #9fb1c3;
    --brand-line: #294357;
    --app-bg: #07131f;
    --card-bg: rgba(13, 29, 43, .96);
    --card-shadow: 0 14px 34px rgba(0, 0, 0, .24);
    --card-shadow-hover: 0 18px 42px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 92% 2%, rgba(16, 201, 232, .08), transparent 23rem),
        radial-gradient(circle at 4% 100%, rgba(11, 117, 219, .10), transparent 24rem),
        var(--app-bg);
}
html[data-theme="dark"] body::before {
    background-image:
        linear-gradient(120deg, transparent 0 18%, rgba(85,174,251,.025) 18.1% 18.4%, transparent 18.5% 100%),
        linear-gradient(300deg, transparent 0 86%, rgba(57,212,237,.025) 86.1% 86.5%, transparent 86.6% 100%);
}
html[data-theme="dark"] a { color: #65b7ff; }
html[data-theme="dark"] a:hover { color: #8bc9ff; }
html[data-theme="dark"] .support-whatsapp {
    background: #1fa855;
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .34), 0 0 0 1px rgba(37, 211, 102, .10);
}
html[data-theme="dark"] .support-whatsapp:hover,
html[data-theme="dark"] .support-whatsapp:focus-visible {
    background: #25D366;
    color: #fff;
    box-shadow: 0 13px 32px rgba(0, 0, 0, .42), 0 0 0 3px rgba(37, 211, 102, .13);
}
html[data-theme="dark"] .app-sidebar {
    background:
        radial-gradient(circle at 18% 0, rgba(16,201,232,.12), transparent 18rem),
        linear-gradient(180deg, #071d34 0%, #071a2d 48%, #051522 100%);
    border-right-color: rgba(112, 177, 220, .13);
    box-shadow: 20px 0 50px rgba(0,0,0,.16);
}
html[data-theme="dark"] .topbar {
    background: rgba(9, 23, 36, .88);
    border-bottom-color: rgba(63, 91, 114, .72);
    box-shadow: 0 4px 18px rgba(0,0,0,.15);
}
html[data-theme="dark"] .topbar .btn-light,
html[data-theme="dark"] .topbar .dropdown-toggle,
html[data-theme="dark"] .btn-light {
    background: #122638;
    border-color: #2a465c;
    color: #e7f2fb;
}
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-light:focus { background: #183249; color: #fff; }
html[data-theme="dark"] .card { border-color: rgba(52, 82, 105, .92); }
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .bg-white {
    background: rgba(13, 29, 43, .96) !important;
    border-color: rgba(52, 82, 105, .86) !important;
}
html[data-theme="dark"] .bg-light { background: #102536 !important; }
html[data-theme="dark"] .border { border-color: #304a5f !important; }
html[data-theme="dark"] .btn-outline-primary {
    color: #70bcff;
    border-color: #356f9f;
    background: rgba(14, 34, 50, .8);
}
html[data-theme="dark"] .btn-outline-primary:hover { color: #061522; background: #70bcff; border-color: #70bcff; }
html[data-theme="dark"] .btn-outline-secondary {
    color: #b1c3d2;
    border-color: #486075;
    background: rgba(14, 34, 50, .76);
}
html[data-theme="dark"] .form-label { color: #b8c9d7; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #0d2233;
    border-color: #355169;
    color: #edf6fd;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.13);
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    border-color: #47bce6;
    box-shadow: 0 0 0 .22rem rgba(16, 201, 232, .14);
}
html[data-theme="dark"] .form-control::placeholder { color: #71889a; }
html[data-theme="dark"] .alert-light {
    background: rgba(15, 35, 51, .92);
    border-color: #355169 !important;
    color: #dce8f2;
}
html[data-theme="dark"] .table { --bs-table-color: var(--brand-ink); --bs-table-bg: transparent; }
html[data-theme="dark"] .table > :not(caption) > * > * { border-color: #233c50; }
html[data-theme="dark"] .table thead th {
    color: #9fb3c4;
    background: #0c2030;
    border-bottom-color: #304b61;
}
html[data-theme="dark"] .table tbody tr:hover { background: rgba(37, 77, 104, .25); }
html[data-theme="dark"] .table a.fw-semibold { color: #6bbcff; }
html[data-theme="dark"] .table-light { --bs-table-bg: #102536; --bs-table-color: #dbe8f2; }
html[data-theme="dark"] .badge-status,
html[data-theme="dark"] .badge.text-bg-secondary { background: #17344a !important; color: #9fd4ff !important; }
html[data-theme="dark"] .badge.text-bg-primary { background: #103e62 !important; color: #a9d9ff !important; }
html[data-theme="dark"] .badge.text-bg-success { background: #123c2d !important; color: #8be0b5 !important; }
html[data-theme="dark"] .badge.text-bg-warning { background: #493b16 !important; color: #f7d77a !important; }
html[data-theme="dark"] .badge.text-bg-danger { background: #4a2028 !important; color: #ffabb5 !important; }
html[data-theme="dark"] .badge.text-bg-light { background: #173044 !important; color: #d7e6f2 !important; }
html[data-theme="dark"] .list-group-item { border-color: #223b4f; color: var(--brand-ink); }
html[data-theme="dark"] .list-group-item-action:hover { background: #102a3d; }
html[data-theme="dark"] .dropdown-menu {
    background: #0e2233;
    border-color: #304b61;
    box-shadow: 0 18px 45px rgba(0,0,0,.34);
}
html[data-theme="dark"] .dropdown-item { color: #dbe8f2; }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background: #17364d; color: #8dccff; }
html[data-theme="dark"] .dropdown-divider { border-color: #30495d; }
html[data-theme="dark"] .auth-shell {
    background:
        radial-gradient(circle at 12% 12%, rgba(16,201,232,.11), transparent 20rem),
        radial-gradient(circle at 88% 88%, rgba(11,117,219,.12), transparent 24rem),
        linear-gradient(135deg, #07131f, #0a1a29 42%, #081726);
}
html[data-theme="dark"] .auth-card { border-color: rgba(55, 92, 119, .82); }
html[data-theme="dark"] .auth-logo-wrap {
    background: linear-gradient(145deg, #102a3d, #0c1e2d);
    box-shadow: 0 12px 24px rgba(0,0,0,.24), inset 0 0 0 1px rgba(73,139,178,.35);
}
html[data-theme="dark"] .navbar { background-color: rgba(9, 23, 36, .94) !important; }
html[data-theme="dark"] .navbar-brand { color: #e5f1fa; }

@media (max-width: 767.98px) {
    html[data-theme="dark"] .responsive-data-table tbody tr {
        border-color: #2c465b;
        background: #0d1f2f;
        box-shadow: 0 8px 22px rgba(0,0,0,.18);
    }
    html[data-theme="dark"] .responsive-data-table tbody tr:hover { background: #0d1f2f; }
    html[data-theme="dark"] .responsive-data-table tbody td { border-bottom-color: #284054; }
    html[data-theme="dark"] .responsive-data-table tbody td::before { color: #91a9bc; }
}

@media print {
    html[data-theme="dark"] body { background: #fff !important; color: #000 !important; }
    html[data-theme="dark"] body::before { display: none !important; }
    html[data-theme="dark"] .card,
    html[data-theme="dark"] .card-header,
    html[data-theme="dark"] .card-footer,
    html[data-theme="dark"] .bg-white,
    html[data-theme="dark"] .table thead th,
    html[data-theme="dark"] .responsive-data-table tbody tr {
        background: #fff !important;
        color: #000 !important;
        border-color: #ddd !important;
    }
    html[data-theme="dark"] h1,
    html[data-theme="dark"] h2,
    html[data-theme="dark"] h3,
    html[data-theme="dark"] h4,
    html[data-theme="dark"] h5,
    html[data-theme="dark"] h6,
    html[data-theme="dark"] .table { color: #000 !important; }
}

/* PWA install floating card */
.pwa-install-card {
    position: fixed;
    right: 22px;
    bottom: 96px;
    z-index: 1075;
    width: min(380px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .85rem;
    padding: 1rem 2.5rem 1rem 1rem;
    border: 1px solid rgba(129, 178, 214, .42);
    border-radius: 1.15rem;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 18px 48px rgba(20, 61, 92, .18), 0 2px 8px rgba(20, 61, 92, .08);
    backdrop-filter: blur(14px);
    animation: pwa-install-card-in .22s ease-out;
}

.pwa-install-card-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: .9rem;
    background: linear-gradient(145deg, #e8f6ff, #f7fcff);
    color: #0b75db;
    box-shadow: inset 0 0 0 1px rgba(11, 117, 219, .10);
    font-size: 1.35rem;
}

.pwa-install-card-title {
    padding-right: .25rem;
    color: #0b2f4f;
    font-weight: 800;
    line-height: 1.25;
}

.pwa-install-card-text {
    margin-top: .25rem;
    color: #5a7184;
    font-size: .88rem;
    line-height: 1.4;
}

.pwa-install-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .75rem;
}

.pwa-install-dismiss {
    position: absolute;
    top: .65rem;
    right: .65rem;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #718596;
    font-size: .82rem;
}

.pwa-install-dismiss:hover,
.pwa-install-dismiss:focus-visible {
    background: #edf5fb;
    color: #173b59;
}

.pwa-ios-instructions {
    margin-top: .8rem;
    padding-top: .7rem;
    border-top: 1px solid #dce9f2;
}

.pwa-ios-step {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: start;
    gap: .45rem;
    margin-top: .45rem;
    color: #4e6679;
    font-size: .82rem;
    line-height: 1.35;
}

.pwa-ios-step > span {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e9f5ff;
    color: #0b75db;
    font-size: .72rem;
    font-weight: 800;
}

@keyframes pwa-install-card-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 992px) {
    body.authenticated .pwa-install-card { bottom: 22px; }
}

@media (max-width: 575.98px) {
    .pwa-install-card {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        grid-template-columns: 40px minmax(0, 1fr);
        gap: .7rem;
        padding: .85rem 2.25rem .85rem .85rem;
        border-radius: 1rem;
    }

    .pwa-install-card-icon { width: 40px; height: 40px; border-radius: .8rem; }
    .pwa-install-actions .btn-primary { flex: 1 1 auto; }
}

html[data-theme="dark"] .pwa-install-card {
    border-color: rgba(78, 119, 149, .78);
    background: rgba(10, 29, 44, .97);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .42), 0 0 0 1px rgba(96, 169, 220, .06);
}

html[data-theme="dark"] .pwa-install-card-icon {
    background: linear-gradient(145deg, #102f46, #0b2538);
    color: #70bcff;
    box-shadow: inset 0 0 0 1px rgba(112, 188, 255, .14);
}

html[data-theme="dark"] .pwa-install-card-title { color: #e7f3fb; }
html[data-theme="dark"] .pwa-install-card-text,
html[data-theme="dark"] .pwa-ios-step { color: #a9bdcc; }
html[data-theme="dark"] .pwa-install-dismiss { color: #91a9bb; }
html[data-theme="dark"] .pwa-install-dismiss:hover,
html[data-theme="dark"] .pwa-install-dismiss:focus-visible { background: #17364d; color: #dcedf8; }
html[data-theme="dark"] .pwa-ios-instructions { border-top-color: #29465b; }
html[data-theme="dark"] .pwa-ios-step > span { background: #123c5b; color: #8dccff; }

@media print {
    .pwa-install-card { display: none !important; }
}


/* Searchable client combobox */
[data-client-options] {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: .5rem;
    overflow: hidden auto;
}
[data-client-option] {
    background: #fff !important;
    color: #212529 !important;
}
[data-client-option]:hover,
[data-client-option]:focus,
[data-client-option].active {
    background: #f8f9fa !important;
    color: #212529 !important;
}
[data-client-option] + [data-client-option] {
    border-top-color: rgba(0, 0, 0, .075);
}

/* Password fields */
.password-input-shell {
    position: relative;
    width: 100%;
}
.password-input-shell > .form-control {
    padding-right: 3rem;
}
.password-toggle-button {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: var(--bs-secondary-color);
    z-index: 3;
}
.password-toggle-button:hover,
.password-toggle-button:focus-visible {
    background: rgba(13, 110, 253, .1);
    color: var(--bs-primary);
    outline: 0;
}
.password-requirements {
    display: grid;
    gap: .22rem;
}
.password-requirements li {
    transition: color .15s ease;
}
.password-requirements li.is-valid { color: var(--bs-success-text-emphasis); }
.password-requirements li.is-pending { color: var(--bs-secondary-color); }

/* Beauty branding and white-label overrides */
body {
    background:
        radial-gradient(circle at 92% 2%, color-mix(in srgb, var(--brand-accent) 24%, transparent), transparent 23rem),
        radial-gradient(circle at 4% 100%, color-mix(in srgb, var(--brand-primary) 16%, transparent), transparent 24rem),
        var(--app-bg);
}

.app-sidebar {
    background:
        radial-gradient(circle at 18% 0, color-mix(in srgb, var(--brand-sidebar-glow) 30%, transparent), transparent 18rem),
        linear-gradient(180deg, var(--brand-sidebar-start) 0%, color-mix(in srgb, var(--brand-sidebar-start) 70%, var(--brand-sidebar-end) 30%) 48%, var(--brand-sidebar-end) 100%);
}

.app-sidebar::after {
    border-color: color-mix(in srgb, var(--brand-accent) 24%, transparent);
}

.topbar {
    background: color-mix(in srgb, var(--brand-topbar) 86%, rgba(255,255,255,.65));
    border-bottom: 1px solid color-mix(in srgb, var(--brand-line) 80%, #ffffff);
}

.topbar-tagline {
    color: var(--brand-muted);
}

.brand-mark {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-mark-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #ffffff;
    font-weight: 800;
    letter-spacing: .04em;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

.brand-subtitle {
    color: color-mix(in srgb, var(--brand-accent) 50%, #ffffff);
}

.btn-primary {
    color: var(--brand-button-text);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    box-shadow: 0 9px 20px color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

.btn-primary:hover,
.btn-primary:focus {
    color: var(--brand-button-text);
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 88%, #000000), color-mix(in srgb, var(--brand-secondary) 88%, #000000));
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: color-mix(in srgb, var(--brand-primary) 38%, #ffffff);
}

.btn-outline-primary:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.content-wrap > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-2.mb-4::before {
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-primary));
}

.brand-preview-card {
    overflow: hidden;
}

.brand-preview-shell {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 1.15rem;
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--brand-accent) 45%, transparent), transparent 7rem),
        linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 12%, #ffffff), color-mix(in srgb, var(--brand-secondary) 10%, #ffffff));
    border: 1px solid color-mix(in srgb, var(--brand-line) 72%, #ffffff);
}

.brand-preview-mark {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: grid;
    place-items: center;
    color: #ffffff;
    box-shadow: 0 18px 32px color-mix(in srgb, var(--brand-primary) 20%, transparent);
    overflow: hidden;
}

.brand-preview-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.brand-preview-mark span {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.brand-preview-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--brand-ink);
}

.brand-preview-tagline {
    margin-top: .25rem;
    color: var(--brand-muted);
    font-size: .92rem;
    line-height: 1.4;
}

.brand-preview-panels {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.preview-chip {
    padding: .7rem .95rem;
    border-radius: .95rem;
    font-weight: 700;
    font-size: .9rem;
}

.preview-chip-primary {
    background: color-mix(in srgb, var(--brand-primary) 12%, #ffffff);
    color: var(--brand-primary);
}

.preview-chip-secondary {
    background: color-mix(in srgb, var(--brand-secondary) 10%, #ffffff);
    color: var(--brand-secondary);
}

.preview-chip-accent {
    background: color-mix(in srgb, var(--brand-accent) 55%, #ffffff);
    color: var(--brand-ink);
}

.brand-settings-fields.is-disabled {
    opacity: .6;
}

.brand-preset-grid {
    display: grid;
    gap: .75rem;
}

.brand-preset-card {
    border: 1px solid color-mix(in srgb, var(--brand-line) 80%, #ffffff);
    border-radius: 1rem;
    padding: .85rem .9rem;
    background: rgba(255,255,255,.75);
}

.brand-preset-card.active {
    border-color: color-mix(in srgb, var(--brand-primary) 45%, #ffffff);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

.brand-preset-swatches {
    display: flex;
    gap: .4rem;
    margin-bottom: .55rem;
}

.brand-preset-swatches span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(255,255,255,.75);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.current-brand-logo {
    width: 100%;
    max-width: 180px;
    padding: .75rem;
    border-radius: 1rem;
    border: 1px solid color-mix(in srgb, var(--brand-line) 76%, #ffffff);
    background: rgba(255,255,255,.8);
}

.current-brand-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.color-field-stack {
    display: grid;
    gap: .9rem;
}

.color-input-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
}

.color-input-wrap .form-control-color {
    width: 52px;
    min-width: 52px;
    height: 44px;
    padding: .3rem;
    border-radius: .8rem;
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 92% 2%, color-mix(in srgb, var(--brand-accent) 15%, transparent), transparent 23rem),
        radial-gradient(circle at 4% 100%, color-mix(in srgb, var(--brand-primary) 14%, transparent), transparent 24rem),
        #18121a;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
    border-color: rgba(111, 92, 110, .55) !important;
}

html[data-theme="dark"] .brand-preview-shell,
html[data-theme="dark"] .current-brand-logo,
html[data-theme="dark"] .brand-preset-card {
    background: rgba(34, 24, 34, .72);
}

/* White-label logo cropper */
.brand-logo-selection-preview,
.current-brand-logo {
    max-width: 220px;
}

.brand-logo-selection-preview img,
.current-brand-logo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid color-mix(in srgb, var(--brand-line) 78%, #ffffff);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

.brand-logo-crop-modal .modal-content {
    overflow: hidden;
}

.brand-logo-crop-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1.25rem;
    align-items: start;
}

.brand-logo-crop-stage {
    position: relative;
    width: min(100%, 560px);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 1.25rem;
    background:
        linear-gradient(45deg, #f1f1f1 25%, transparent 25%),
        linear-gradient(-45deg, #f1f1f1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f1f1 75%),
        linear-gradient(-45deg, transparent 75%, #f1f1f1 75%),
        #ffffff;
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    border: 1px solid color-mix(in srgb, var(--brand-line) 85%, #ffffff);
}

.brand-logo-crop-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.brand-logo-crop-stage canvas.is-dragging {
    cursor: grabbing;
}

.brand-logo-crop-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 1.25rem;
    box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brand-primary) 65%, #ffffff);
}

.brand-logo-crop-frame::after {
    content: "";
    position: absolute;
    inset: 9%;
    border-radius: 18%;
    border: 1px dashed rgba(255, 255, 255, .9);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .08);
}

.brand-logo-crop-controls {
    padding: 1rem;
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-background) 74%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--brand-line) 80%, #ffffff);
}

html[data-theme="dark"] .brand-logo-selection-preview img,
html[data-theme="dark"] .current-brand-logo img,
html[data-theme="dark"] .brand-logo-crop-stage {
    background-color: #ffffff;
}

html[data-theme="dark"] .brand-logo-crop-controls {
    background: rgba(40, 29, 40, .78);
}

@media (max-width: 767.98px) {
    .brand-logo-crop-workspace {
        grid-template-columns: 1fr;
    }

    .brand-logo-crop-controls {
        width: 100%;
    }
}

/* Agenda calendar */
.agenda-view-switch .btn.active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-color: transparent;
}

.calendar-card {
    overflow: visible;
    min-width: 0;
}

.calendar-card .card-body,
.beauty-calendar,
.beauty-calendar .fc,
.beauty-calendar .fc-view-harness {
    min-width: 0;
}

.beauty-calendar {
    --fc-border-color: color-mix(in srgb, var(--brand-line) 85%, #ffffff);
    --fc-button-bg-color: var(--brand-primary);
    --fc-button-border-color: var(--brand-primary);
    --fc-button-hover-bg-color: var(--brand-secondary);
    --fc-button-hover-border-color: var(--brand-secondary);
    --fc-button-active-bg-color: var(--brand-secondary);
    --fc-button-active-border-color: var(--brand-secondary);
    --fc-today-bg-color: color-mix(in srgb, var(--brand-accent) 26%, transparent);
    --fc-neutral-bg-color: color-mix(in srgb, var(--brand-background) 70%, #ffffff);
    --fc-page-bg-color: transparent;
    color: var(--brand-ink);
}

.beauty-calendar .fc-toolbar-title {
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    font-weight: 800;
    color: var(--brand-ink);
}

.beauty-calendar .fc-button {
    border-radius: .7rem !important;
    font-weight: 700;
    box-shadow: none !important;
}

.beauty-calendar .fc-scrollgrid,
.beauty-calendar .fc-theme-standard td,
.beauty-calendar .fc-theme-standard th {
    border-color: color-mix(in srgb, var(--brand-line) 88%, #ffffff);
}

.beauty-calendar .fc-col-header-cell-cushion,
.beauty-calendar .fc-daygrid-day-number,
.beauty-calendar .fc-timegrid-axis-cushion,
.beauty-calendar .fc-timegrid-slot-label-cushion {
    color: var(--brand-ink);
    text-decoration: none;
}

.beauty-calendar-event {
    border: 0 !important;
    border-radius: .55rem !important;
    padding: .08rem .18rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
}

.beauty-calendar-event--scheduled { background: var(--brand-primary) !important; }
.beauty-calendar-event--confirmed { background: var(--brand-secondary) !important; }
.beauty-calendar-event--in_progress { background: #d4892f !important; }
.beauty-calendar-event--completed { background: #3d9272 !important; }
.beauty-calendar-event--canceled { background: #8a8790 !important; opacity: .72; }
.beauty-calendar-event--no_show { background: #b45d62 !important; }

.appointment-time-block {
    min-width: 64px;
}

.appointment-service-thumb {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    object-fit: cover;
    border-radius: .9rem;
    border: 1px solid color-mix(in srgb, var(--brand-line) 75%, #ffffff);
}

/* Beauty service images */
.beauty-service-card {
    overflow: hidden;
}

.beauty-service-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: color-mix(in srgb, var(--brand-accent) 18%, var(--brand-background));
}

.beauty-service-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}

.beauty-service-card:hover .beauty-service-cover img {
    transform: scale(1.025);
}

.beauty-service-cover-placeholder {
    display: grid;
    place-items: center;
    color: var(--brand-primary);
    font-size: 2.2rem;
    background:
        radial-gradient(circle at 75% 25%, color-mix(in srgb, var(--brand-accent) 50%, transparent), transparent 7rem),
        linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 8%, #ffffff), color-mix(in srgb, var(--brand-secondary) 7%, #ffffff));
}

.service-image-editor {
    position: sticky;
    top: 92px;
}

.service-image-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 1.15rem;
    border: 1px dashed color-mix(in srgb, var(--brand-primary) 35%, var(--brand-line));
    background: color-mix(in srgb, var(--brand-background) 75%, #ffffff);
}

.service-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.service-image-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    color: var(--brand-muted);
}

.service-image-preview-placeholder i {
    font-size: 2rem;
    color: var(--brand-primary);
}

@media (max-width: 767.98px) {
    .agenda-page-header {
        align-items: stretch !important;
    }

    .agenda-page-heading,
    .agenda-page-actions {
        width: 100%;
    }

    .agenda-page-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: .65rem !important;
    }

    .agenda-view-switch {
        width: 100%;
        min-width: 0;
    }

    .agenda-view-switch .btn {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: .7rem;
        white-space: nowrap;
    }

    .calendar-card .card-body {
        padding: .65rem !important;
    }

    .calendar-mobile-view-switch {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .4rem;
        margin-bottom: .65rem;
    }

    .calendar-mobile-view-switch .btn {
        min-width: 0;
        min-height: 40px;
        padding: .45rem .35rem;
        border-radius: .75rem !important;
        font-size: .84rem;
        white-space: nowrap;
    }

    .calendar-mobile-view-switch .btn.active {
        color: #fff;
        background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
        border-color: transparent;
    }

    .beauty-calendar .fc-header-toolbar {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center !important;
        gap: .45rem;
        margin-bottom: .65rem !important;
    }

    .beauty-calendar .fc-header-toolbar .fc-toolbar-chunk {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .beauty-calendar .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
        justify-content: center;
        overflow: hidden;
    }

    .beauty-calendar .fc-toolbar-title {
        max-width: 100%;
        margin: 0;
        overflow: hidden;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .98rem !important;
        line-height: 1.15;
        letter-spacing: -.01em;
    }

    .beauty-calendar .fc-header-toolbar .fc-button {
        min-height: 38px;
        padding: .4rem .62rem;
        font-size: .82rem;
    }

    .beauty-calendar .fc-header-toolbar .fc-prev-button,
    .beauty-calendar .fc-header-toolbar .fc-next-button {
        width: 38px;
        padding-inline: 0;
    }

    .beauty-calendar .fc-header-toolbar .fc-button-group {
        gap: .25rem;
    }

    .beauty-calendar .fc-header-toolbar .fc-button-group > .fc-button {
        border-radius: .7rem !important;
    }

    .beauty-calendar .fc-col-header-cell-cushion {
        padding: .45rem .2rem;
        font-size: .8rem;
        font-weight: 800;
        text-transform: capitalize;
    }

    .beauty-calendar .fc-timegrid-axis {
        width: 50px !important;
    }

    .beauty-calendar .fc-timegrid-axis-cushion,
    .beauty-calendar .fc-timegrid-slot-label-cushion {
        padding-inline: .25rem;
        font-size: .76rem;
        font-variant-numeric: tabular-nums;
    }

    .beauty-calendar .fc-timegrid-slot {
        height: 1.75rem;
    }

    .beauty-calendar .fc-timegrid-event {
        margin-inline: 2px;
    }

    .beauty-calendar .fc-timegrid-event .fc-event-main {
        padding: .15rem .22rem;
    }

    .beauty-calendar .fc-event-time {
        font-size: .7rem;
        line-height: 1.15;
    }

    .beauty-calendar .fc-event-title {
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: .78rem;
        line-height: 1.15;
    }

    .beauty-calendar .fc-daygrid-day-number {
        padding: .35rem;
        font-size: .82rem;
    }

    .beauty-calendar .fc-daygrid-event {
        margin-inline: 2px;
        font-size: .72rem;
    }

    .beauty-calendar .fc-list {
        border-radius: .85rem;
        overflow: hidden;
    }

    .beauty-calendar .fc-list-day-cushion {
        padding: .55rem .7rem;
        background: color-mix(in srgb, var(--brand-background) 78%, var(--brand-surface));
    }

    .beauty-calendar .fc-list-event td {
        padding-block: .55rem;
        font-size: .84rem;
    }

    .beauty-calendar .fc-list-event-time {
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .service-image-editor {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .agenda-page-actions {
        grid-template-columns: 1fr;
    }

    .agenda-new-appointment {
        width: 100%;
    }

    .agenda-page-heading p {
        font-size: .92rem;
    }

    .calendar-card {
        border-radius: 1rem;
    }

    .calendar-card .card-body {
        padding: .5rem !important;
    }

    .beauty-calendar .fc-header-toolbar {
        gap: .3rem;
    }

    .beauty-calendar .fc-header-toolbar .fc-button {
        min-height: 36px;
        padding: .35rem .5rem;
    }

    .beauty-calendar .fc-header-toolbar .fc-prev-button,
    .beauty-calendar .fc-header-toolbar .fc-next-button {
        width: 36px;
    }

    .beauty-calendar .fc-toolbar-title {
        font-size: .9rem !important;
    }

    .beauty-calendar .fc-timegrid-axis {
        width: 44px !important;
    }

    .beauty-calendar .fc-timegrid-axis-cushion,
    .beauty-calendar .fc-timegrid-slot-label-cushion {
        font-size: .7rem;
    }
}

/* Service image cropper */
.service-image-meta .badge {
    font-weight: 600;
}

.service-image-actions .btn {
    width: 100%;
}

.service-image-crop-modal .modal-content {
    overflow: hidden;
}

.service-image-crop-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    align-items: start;
}

.service-image-crop-stage {
    --service-crop-ratio: 4 / 3;
    position: relative;
    width: min(100%, 860px);
    aspect-ratio: var(--service-crop-ratio);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 1.25rem;
    background:
        linear-gradient(45deg, #f1f1f1 25%, transparent 25%),
        linear-gradient(-45deg, #f1f1f1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f1f1 75%),
        linear-gradient(-45deg, transparent 75%, #f1f1f1 75%),
        #ffffff;
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    border: 1px solid color-mix(in srgb, var(--brand-line) 85%, #ffffff);
}

.service-image-crop-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.service-image-crop-stage canvas.is-dragging {
    cursor: grabbing;
}

.service-image-crop-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 1.25rem;
    box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brand-primary) 65%, #ffffff);
}

.service-image-crop-frame::after {
    content: "";
    position: absolute;
    inset: 5%;
    border-radius: 1rem;
    border: 1px dashed rgba(255, 255, 255, .92);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .08);
}

.service-image-crop-controls {
    padding: 1rem;
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-background) 74%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--brand-line) 80%, #ffffff);
}

.service-image-ratio-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
}

.service-image-ratio-group .btn {
    font-weight: 700;
}

html[data-theme="dark"] .service-image-crop-stage {
    background-color: #ffffff;
}

html[data-theme="dark"] .service-image-crop-controls {
    background: rgba(40, 29, 40, .78);
}

@media (max-width: 991.98px) {
    .service-image-editor {
        position: static;
    }

    .service-image-crop-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .service-image-preview {
        aspect-ratio: 16 / 10;
    }

    .service-image-ratio-group {
        grid-template-columns: 1fr;
    }

    .service-image-crop-stage {
        width: 100%;
    }
}

/* Extra compact calendar typography for phones */
@media (max-width: 575.98px) {
    .calendar-mobile-view-switch {
        gap: .3rem;
        margin-bottom: .5rem;
    }

    .calendar-mobile-view-switch .btn {
        min-height: 34px;
        padding: .3rem .25rem;
        border-radius: .65rem !important;
        font-size: .72rem;
        line-height: 1.05;
    }

    .beauty-calendar .fc-header-toolbar {
        margin-bottom: .45rem !important;
        gap: .2rem;
    }

    .beauty-calendar .fc-toolbar-title {
        font-size: .72rem !important;
        line-height: 1.05 !important;
        font-weight: 800;
        letter-spacing: -.015em;
    }

    .beauty-calendar .fc-header-toolbar .fc-button {
        min-height: 32px;
        padding: .25rem .38rem;
        border-radius: .6rem !important;
        font-size: .68rem;
        line-height: 1;
    }

    .beauty-calendar .fc-header-toolbar .fc-prev-button,
    .beauty-calendar .fc-header-toolbar .fc-next-button {
        width: 32px;
    }

    .beauty-calendar .fc-col-header-cell-cushion {
        padding: .3rem .06rem;
        font-size: .62rem;
        line-height: 1.05;
        font-weight: 800;
    }

    .beauty-calendar .fc-daygrid-day-top {
        min-height: 1.45rem;
    }

    .beauty-calendar .fc-daygrid-day-number {
        padding: .2rem .25rem;
        font-size: .66rem;
        line-height: 1;
    }

    .beauty-calendar .fc-daygrid-event {
        margin-inline: 1px;
        padding: 0 .08rem;
        border-radius: .32rem !important;
        font-size: .58rem;
        line-height: 1.05;
    }

    .beauty-calendar .fc-daygrid-event .fc-event-time,
    .beauty-calendar .fc-daygrid-event .fc-event-title {
        font-size: .58rem;
        line-height: 1.05;
    }

    .beauty-calendar .fc-daygrid-more-link {
        font-size: .58rem;
    }

    .beauty-calendar .fc-timegrid-axis {
        width: 39px !important;
    }

    .beauty-calendar .fc-timegrid-axis-cushion,
    .beauty-calendar .fc-timegrid-slot-label-cushion {
        padding-inline: .12rem;
        font-size: .62rem;
        line-height: 1;
    }

    .beauty-calendar .fc-timegrid-slot {
        height: 1.55rem;
    }

    .beauty-calendar .fc-timegrid-event .fc-event-main {
        padding: .1rem .14rem;
    }

    .beauty-calendar .fc-timegrid-event .fc-event-time {
        font-size: .58rem;
        line-height: 1.05;
    }

    .beauty-calendar .fc-timegrid-event .fc-event-title {
        font-size: .64rem;
        line-height: 1.08;
    }

    .beauty-calendar .fc-list-day-cushion {
        padding: .4rem .5rem;
        font-size: .7rem;
    }

    .beauty-calendar .fc-list-event td {
        padding-block: .4rem;
        font-size: .7rem;
    }
}

@media (max-width: 420px) {
    .beauty-calendar .fc-toolbar-title {
        font-size: .66rem !important;
    }

    .beauty-calendar .fc-col-header-cell-cushion {
        font-size: .56rem;
    }

    .beauty-calendar .fc-daygrid-day-number {
        font-size: .62rem;
    }

    .calendar-mobile-view-switch .btn {
        font-size: .68rem;
    }
}

/* Service image cropper v21: viewport-safe preview + mobile gestures */
.service-image-preview {
    display: grid;
    place-items: center;
    width: 100%;
    height: clamp(180px, 26vw, 300px);
    max-height: min(38vh, 300px);
    aspect-ratio: auto;
    padding: .35rem;
}

.service-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: .85rem;
}

.service-image-crop-modal .modal-dialog {
    max-width: min(1180px, calc(100vw - 1rem));
}

.service-image-crop-modal .modal-body {
    overflow-x: hidden;
}

.service-image-crop-workspace {
    min-width: 0;
}

.service-image-crop-stage {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 68dvh;
    aspect-ratio: auto;
    flex: 0 0 auto;
}

.service-image-crop-stage canvas {
    max-width: 100%;
    max-height: 100%;
    overscroll-behavior: contain;
    touch-action: none;
}

.service-image-ratio-group {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.service-image-ratio-group .btn {
    flex: 1 1 82px;
    min-width: 72px;
}

.service-image-flex-scale {
    gap: 1rem;
}

@media (max-width: 991.98px) {
    .service-image-crop-modal .modal-dialog {
        max-width: 100%;
    }

    .service-image-crop-modal .modal-body {
        padding: .75rem;
    }

    .service-image-crop-workspace {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
        width: 100%;
        min-width: 0;
    }

    .service-image-crop-stage {
        align-self: center;
        max-width: calc(100vw - 1.5rem);
        max-height: 48dvh;
    }

    .service-image-crop-controls {
        width: 100%;
        min-width: 0;
        padding: .85rem;
    }
}

@media (max-width: 575.98px) {
    .service-image-preview {
        width: 100%;
        height: min(42dvh, 240px);
        min-height: 170px;
        max-height: 240px;
        padding: .25rem;
        border-radius: 1rem;
    }

    .service-image-preview img {
        border-radius: .75rem;
    }

    .service-image-crop-modal .modal-header {
        padding: .75rem .9rem;
    }

    .service-image-crop-modal .modal-title {
        font-size: 1rem;
    }

    .service-image-crop-modal .modal-header .small {
        font-size: .76rem;
        line-height: 1.25;
    }

    .service-image-ratio-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .4rem;
    }

    .service-image-ratio-group .btn:last-child {
        grid-column: 1 / -1;
    }

    .service-image-crop-stage {
        max-width: calc(100vw - 1.5rem);
        max-height: 46dvh;
        border-radius: .9rem;
    }

    .service-image-crop-frame {
        border-radius: .9rem;
    }

    .service-image-crop-controls {
        border-radius: .85rem;
        font-size: .9rem;
    }

    .service-image-editor .form-control[type="file"] {
        max-width: 100%;
        font-size: .88rem;
    }

    .service-image-meta .badge {
        font-size: .72rem;
    }
}

/* Service image cropper v22: same containment behavior as the logo cropper */
.service-image-preview {
    width: 100% !important;
    height: clamp(180px, 28dvh, 240px) !important;
    min-height: 180px !important;
    max-height: 240px !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    display: grid !important;
    place-items: center !important;
    padding: .35rem !important;
}

.service-image-preview img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

.service-image-crop-stage {
    width: min(100%, 560px);
    max-width: 100% !important;
    overflow: hidden !important;
    margin-inline: auto !important;
}

.service-image-crop-stage canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    touch-action: none !important;
}

@media (max-width: 575.98px) {
    .service-image-preview {
        height: min(28dvh, 210px) !important;
        min-height: 160px !important;
        max-height: 210px !important;
    }

    .service-image-crop-modal .modal-body {
        overflow-x: hidden !important;
    }

    .service-image-crop-stage {
        max-width: calc(100vw - 1.5rem) !important;
        max-height: 44dvh !important;
    }
}

/* Availability and weekly schedule */
.schedule-editor {
    display: grid;
    gap: .85rem;
}

.schedule-day {
    padding: 1rem;
    border: 1px solid var(--brand-line);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-surface) 94%, var(--brand-background));
}

.schedule-day-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.schedule-day-rows {
    display: grid;
    gap: .65rem;
}

.schedule-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: end;
}

.schedule-remove {
    min-width: 42px;
    min-height: 38px;
}

.schedule-closed {
    padding: .7rem .8rem;
    border-radius: .75rem;
    color: var(--brand-muted);
    background: color-mix(in srgb, var(--brand-background) 82%, var(--brand-surface));
    font-size: .92rem;
}

.schedule-disabled {
    opacity: .58;
}

.public-link-preview {
    overflow-wrap: anywhere;
    padding: .75rem;
    border-radius: .8rem;
    background: color-mix(in srgb, var(--brand-primary) 6%, var(--brand-surface));
    border: 1px solid var(--brand-line);
}

.availability-block-list {
    display: grid;
    gap: .75rem;
}

.availability-block-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem;
    border: 1px solid var(--brand-line);
    border-radius: .9rem;
    background: var(--brand-surface);
}

.availability-block-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: .8rem;
    color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
}

@media (max-width: 575.98px) {
    .schedule-day {
        padding: .85rem;
    }

    .schedule-day-heading {
        align-items: center;
    }

    .schedule-day-heading .small {
        display: none;
    }

    .schedule-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
        gap: .45rem;
    }

    .schedule-row .form-control {
        padding-inline: .55rem;
    }

    .availability-block-item {
        align-items: flex-start;
    }
}

.beauty-calendar-event--blocked {
    background: repeating-linear-gradient(
        -45deg,
        rgba(108, 117, 125, .18),
        rgba(108, 117, 125, .18) 7px,
        rgba(108, 117, 125, .28) 7px,
        rgba(108, 117, 125, .28) 14px
    ) !important;
    border-color: rgba(108, 117, 125, .45) !important;
    color: var(--brand-ink) !important;
}

.agenda-block-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--brand-line);
    background: color-mix(in srgb, var(--brand-muted) 7%, var(--brand-surface));
}

.agenda-block-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: .75rem;
    color: var(--brand-muted);
    background: color-mix(in srgb, var(--brand-muted) 12%, var(--brand-surface));
}

@media (max-width: 767.98px) and (min-width: 576px) {
    .agenda-page-actions {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }

    .agenda-view-switch {
        grid-column: 1 / -1;
    }

    .agenda-availability-button,
    .agenda-new-appointment {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .agenda-availability-button {
        width: 100%;
    }
}

/* Agenda e disponibilidade: tema escuro completo */
html[data-theme="dark"] .availability-page .schedule-day {
    border-color: rgba(111, 92, 110, .62);
    background: rgba(34, 24, 34, .78);
}

html[data-theme="dark"] .availability-page .schedule-day strong,
html[data-theme="dark"] .availability-page .form-check-label,
html[data-theme="dark"] .availability-page .card strong {
    color: #f6edf4;
}

html[data-theme="dark"] .availability-page .schedule-closed {
    color: #c9b9c7;
    background: rgba(48, 34, 47, .9);
    border: 1px solid rgba(111, 92, 110, .45);
}

html[data-theme="dark"] .availability-page .public-link-preview {
    background: color-mix(in srgb, var(--brand-primary) 10%, #211722);
    border-color: rgba(111, 92, 110, .62);
}

html[data-theme="dark"] .availability-page .public-link-preview a {
    color: color-mix(in srgb, var(--brand-accent) 62%, #ffffff);
}

html[data-theme="dark"] .availability-page .availability-block-item {
    color: #f2e8f0;
    background: rgba(34, 24, 34, .78);
    border-color: rgba(111, 92, 110, .62);
}

html[data-theme="dark"] .availability-page .availability-block-icon {
    color: color-mix(in srgb, var(--brand-accent) 65%, #ffffff);
    background: color-mix(in srgb, var(--brand-primary) 18%, #211722);
}

html[data-theme="dark"] .availability-page .input-group-text {
    color: #d9cad6;
    background: #281d29;
    border-color: #5a4657;
}

html[data-theme="dark"] .availability-page hr {
    border-color: rgba(111, 92, 110, .6);
    opacity: 1;
}

html[data-theme="dark"] .availability-page .badge.text-bg-light {
    color: #eadfe8 !important;
    background: #362738 !important;
    border-color: #665064 !important;
}

html[data-theme="dark"] .availability-page .form-text,
html[data-theme="dark"] .availability-page .text-secondary {
    color: #b9a9b6 !important;
}

html[data-theme="dark"] .availability-page input[type="date"],
html[data-theme="dark"] .availability-page input[type="time"] {
    color-scheme: dark;
}

/* Professional ↔ service links */
.service-link-panel {
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--brand-line) 82%, transparent);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-surface) 92%, var(--brand-background));
}

.service-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.service-link-option {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .75rem .85rem;
    border: 1px solid color-mix(in srgb, var(--brand-line) 86%, transparent);
    border-radius: .85rem;
    background: var(--brand-surface);
    cursor: pointer;
}

.service-link-option > span {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.service-link-option small {
    color: var(--brand-muted);
}

.service-link-option:has(input:checked) {
    border-color: color-mix(in srgb, var(--brand-primary) 58%, var(--brand-line));
    background: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-surface));
}

@media (max-width: 575.98px) {
    .service-link-grid {
        grid-template-columns: 1fr;
    }
}

/* Internal appointment availability */
.internal-availability-panel {
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--brand-line) 82%, transparent);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-surface) 92%, var(--brand-background));
}

.internal-availability-status {
    padding: .7rem .8rem;
    border-radius: .8rem;
    font-size: .92rem;
    border: 1px solid transparent;
}

.internal-availability-status.is-muted,
.internal-availability-status.is-loading {
    color: var(--brand-muted);
    background: color-mix(in srgb, var(--brand-background) 72%, var(--brand-surface));
    border-color: color-mix(in srgb, var(--brand-line) 72%, transparent);
}

.internal-availability-status.is-available {
    color: #146c43;
    background: rgba(25, 135, 84, .09);
    border-color: rgba(25, 135, 84, .2);
}

.internal-availability-status.is-unavailable {
    color: #9b2c2c;
    background: rgba(220, 53, 69, .08);
    border-color: rgba(220, 53, 69, .2);
}

.internal-availability-slots {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.internal-availability-slot {
    min-width: 68px;
    font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .internal-availability-panel {
    background: color-mix(in srgb, var(--brand-surface) 84%, #111111);
    border-color: rgba(255, 255, 255, .12);
}

html[data-theme="dark"] .internal-availability-status.is-muted,
html[data-theme="dark"] .internal-availability-status.is-loading {
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .1);
}

html[data-theme="dark"] .internal-availability-status.is-available {
    color: #8fe0b6;
    background: rgba(25, 135, 84, .16);
    border-color: rgba(143, 224, 182, .2);
}

html[data-theme="dark"] .internal-availability-status.is-unavailable {
    color: #ff9ca8;
    background: rgba(220, 53, 69, .14);
    border-color: rgba(255, 156, 168, .2);
}

@media (max-width: 575.98px) {
    .internal-availability-panel {
        padding: .85rem;
    }

    .internal-availability-slot {
        flex: 1 0 calc(25% - .5rem);
        min-width: 64px;
    }
}

/* Service editor dark surfaces */
html[data-theme="dark"] .service-link-panel {
    background: #221822;
    border-color: #5a4657;
}

html[data-theme="dark"] .service-link-option {
    color: #f2e8ef;
    background: #2a1e2a;
    border-color: #5a4657;
}

html[data-theme="dark"] .service-link-option:hover {
    background: #302231;
    border-color: #765b72;
}

html[data-theme="dark"] .service-link-option:has(input:checked) {
    background: color-mix(in srgb, var(--brand-primary) 18%, #261b27);
    border-color: color-mix(in srgb, var(--brand-primary) 58%, #75566f);
}

html[data-theme="dark"] .service-link-option small,
html[data-theme="dark"] .service-link-panel .text-secondary {
    color: #bcaeb9 !important;
}

html[data-theme="dark"] .service-image-preview {
    background: #211921 !important;
    border-color: #665064 !important;
}

html[data-theme="dark"] .service-image-preview-placeholder {
    color: #bcaeb9;
}

html[data-theme="dark"] .service-image-meta {
    color: #eadfe8;
}

html[data-theme="dark"] .service-image-meta .badge.text-bg-light {
    background: #362738 !important;
    color: #eadfe8 !important;
    border-color: #665064 !important;
}

.beauty-status-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

.beauty-status-badge.text-bg-success {
    background: color-mix(in srgb, #198754 88%, #ffffff) !important;
}

.beauty-status-badge.text-bg-secondary {
    background: color-mix(in srgb, #6c757d 92%, #ffffff) !important;
}


/* Internal appointment availability dark theme refinement */
html[data-theme="dark"] .internal-availability-panel {
    background: linear-gradient(180deg, rgba(9, 28, 43, .96), rgba(11, 34, 49, .94)) !important;
    border-color: rgba(102, 177, 255, .16) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

html[data-theme="dark"] .internal-availability-panel .fw-semibold,
html[data-theme="dark"] .internal-availability-panel .form-label,
html[data-theme="dark"] .internal-availability-panel strong {
    color: #eef5fb;
}

html[data-theme="dark"] .internal-availability-panel .text-secondary,
html[data-theme="dark"] .internal-availability-panel .small {
    color: rgba(220, 233, 246, .72) !important;
}

html[data-theme="dark"] .internal-availability-panel .btn-outline-secondary {
    color: #dce9f6;
    border-color: rgba(220, 233, 246, .16);
    background: rgba(255,255,255,.05);
}

html[data-theme="dark"] .internal-availability-panel .btn-outline-secondary:hover,
html[data-theme="dark"] .internal-availability-panel .btn-outline-secondary:focus {
    color: #ffffff;
    border-color: rgba(220, 233, 246, .28);
    background: rgba(255,255,255,.09);
}

html[data-theme="dark"] .internal-availability-slot.btn-outline-primary {
    color: #8fc3ff;
    border-color: rgba(143, 195, 255, .38);
    background: rgba(74, 144, 226, .14);
}

html[data-theme="dark"] .internal-availability-slot.btn-outline-primary:hover,
html[data-theme="dark"] .internal-availability-slot.btn-outline-primary:focus,
html[data-theme="dark"] .internal-availability-slot.btn-outline-primary.active {
    color: #ffffff;
    border-color: rgba(143, 195, 255, .58);
    background: rgba(74, 144, 226, .3);
}

/* Prevent Bootstrap badges from stretching vertically inside flex rows. */
.d-flex:not(.align-items-start):not(.align-items-center):not(.align-items-end):not(.align-items-baseline):not(.align-items-stretch) > .badge {
    align-self: flex-start;
    flex: 0 0 auto;
    height: fit-content;
}

.card .badge,
.list-group-item .badge,
.alert .badge {
    max-width: 100%;
    white-space: nowrap;
}


/* Weekly schedule editor: dark theme in forms (professionals and shared editor) */
html[data-theme="dark"] .schedule-editor .schedule-day {
    border-color: rgba(111, 92, 110, .62);
    background: rgba(34, 24, 34, .78);
}

html[data-theme="dark"] .schedule-editor .schedule-day strong,
html[data-theme="dark"] .schedule-editor .form-label,
html[data-theme="dark"] .schedule-editor .schedule-day .small,
html[data-theme="dark"] .schedule-editor + .text-danger,
html[data-theme="dark"] [data-professional-schedule] > .small,
html[data-theme="dark"] [data-professional-schedule] .small.text-secondary {
    color: #f2e8f0 !important;
}

html[data-theme="dark"] .schedule-editor .schedule-day .small.text-secondary {
    color: #cdbccd !important;
}

html[data-theme="dark"] .schedule-editor .schedule-closed {
    color: #c9b9c7;
    background: rgba(48, 34, 47, .9);
    border: 1px solid rgba(111, 92, 110, .45);
}

html[data-theme="dark"] .schedule-editor .btn-outline-primary {
    color: #8fc3ff;
    border-color: rgba(143, 195, 255, .34);
    background: rgba(74, 144, 226, .10);
}

html[data-theme="dark"] .schedule-editor .btn-outline-primary:hover,
html[data-theme="dark"] .schedule-editor .btn-outline-primary:focus {
    color: #ffffff;
    border-color: rgba(143, 195, 255, .52);
    background: rgba(74, 144, 226, .22);
}

html[data-theme="dark"] .schedule-editor .btn-outline-danger {
    color: #ff9ba5;
    border-color: rgba(255, 107, 122, .42);
    background: rgba(255, 107, 122, .08);
}

html[data-theme="dark"] .schedule-editor .btn-outline-danger:hover,
html[data-theme="dark"] .schedule-editor .btn-outline-danger:focus {
    color: #fff2f4;
    border-color: rgba(255, 107, 122, .56);
    background: rgba(255, 107, 122, .18);
}

/* Modern file picker */
.modern-file-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 58px;
    padding: .65rem .75rem;
    border: 1px solid var(--brand-line);
    border-radius: .9rem;
    background: color-mix(in srgb, var(--brand-surface) 94%, var(--brand-background));
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.modern-file-picker:hover,
.modern-file-picker:focus-within {
    border-color: color-mix(in srgb, var(--brand-primary) 46%, var(--brand-line));
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

.modern-file-picker.is-invalid {
    border-color: var(--bs-danger);
}

.modern-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

.modern-file-picker-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: .75rem;
    color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
    font-size: 1.15rem;
}

.modern-file-picker-body {
    flex: 1 1 auto;
    min-width: 0;
}

.modern-file-selection {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--brand-muted);
    font-size: .9rem;
}

.modern-file-picker.has-files .modern-file-selection {
    color: var(--brand-ink);
    font-weight: 600;
}

.modern-file-picker-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex: 0 0 auto;
}

.media-preview-shell {
    position: relative;
}

.media-preview-actions {
    position: absolute;
    right: .65rem;
    bottom: .65rem;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .45rem;
}

.media-preview-actions .btn {
    border-radius: 999px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

.media-preview-actions .btn-light {
    color: #241b22;
    background: rgba(255, 255, 255, .9);
    border-color: rgba(255, 255, 255, .72);
}

.media-preview-actions .btn-outline-danger {
    color: #fff4f5;
    background: rgba(121, 28, 41, .78);
    border-color: rgba(255, 154, 166, .55);
}

.brand-logo-upload-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 190px;
    overflow: hidden;
    border: 1px dashed color-mix(in srgb, var(--brand-primary) 36%, var(--brand-line));
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand-background) 72%, var(--brand-surface));
}

.brand-logo-upload-stage img {
    width: 100%;
    max-height: 210px;
    object-fit: contain;
    padding: 1rem;
}

.brand-logo-upload-placeholder {
    display: grid;
    place-items: center;
    gap: .45rem;
    padding: 2rem 1rem;
    color: var(--brand-muted);
    text-align: center;
}

.brand-logo-upload-placeholder i {
    font-size: 2rem;
    color: var(--brand-primary);
}

html[data-theme="dark"] .modern-file-picker {
    background: rgba(34, 24, 34, .78);
    border-color: rgba(111, 92, 110, .62);
}

html[data-theme="dark"] .modern-file-picker-icon {
    color: #8fc3ff;
    background: rgba(74, 144, 226, .12);
}

html[data-theme="dark"] .modern-file-picker .modern-file-selection,
html[data-theme="dark"] .modern-file-picker.has-files .modern-file-selection {
    color: #e8dce6;
}

html[data-theme="dark"] .brand-logo-upload-stage {
    background: rgba(34, 24, 34, .78);
    border-color: rgba(111, 92, 110, .62);
}

@media (max-width: 575.98px) {
    .modern-file-picker {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .modern-file-picker-body {
        min-width: calc(100% - 58px);
    }

    .modern-file-picker-actions {
        width: 100%;
        padding-left: 58px;
    }

    .modern-file-picker-actions .btn {
        flex: 1 1 auto;
    }

    .media-preview-actions {
        left: .65rem;
        right: .65rem;
    }

    .media-preview-actions .btn:first-child {
        flex: 1 1 auto;
    }
}

/* Internal appointment smart date picker */
.internal-booking-grid {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
    gap: 1rem;
    align-items: start;
}

.internal-date-picker {
    border: 1px solid color-mix(in srgb, var(--brand-line) 82%, transparent);
    border-radius: 1rem;
    padding: .9rem;
    background: color-mix(in srgb, var(--brand-surface) 95%, var(--brand-background));
    transition: opacity .15s ease;
}

.internal-date-picker.is-loading {
    opacity: .62;
    pointer-events: none;
}

.internal-date-picker-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    text-align: center;
}

.internal-date-picker-header strong {
    display: block;
    text-transform: capitalize;
}

.internal-date-weekdays,
.internal-date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .3rem;
}

.internal-date-weekdays {
    margin-bottom: .35rem;
}

.internal-date-weekdays span {
    text-align: center;
    font-size: .72rem;
    font-weight: 700;
    color: var(--brand-muted);
}

.internal-date-spacer,
.internal-date-day {
    aspect-ratio: 1 / 1;
    min-width: 0;
}

.internal-date-day {
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: .7rem;
    background: transparent;
    color: var(--brand-muted);
    font-size: .84rem;
    font-weight: 650;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.internal-date-day:disabled {
    opacity: .3;
    cursor: not-allowed;
}

.internal-date-day.is-available:not(:disabled) {
    color: var(--brand-ink);
    background: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-surface));
    border-color: color-mix(in srgb, var(--brand-primary) 18%, var(--brand-line));
    cursor: pointer;
}

.internal-date-day.is-available:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--brand-primary) 48%, var(--brand-line));
}

.internal-date-day.is-selected {
    color: #fff !important;
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 .45rem 1rem color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

.internal-date-day.is-selected-unavailable {
    opacity: .75;
    color: var(--brand-muted);
    border-color: color-mix(in srgb, var(--brand-muted) 35%, var(--brand-line));
    background: color-mix(in srgb, var(--brand-muted) 7%, var(--brand-surface));
}

.internal-date-status {
    margin-top: .75rem;
    min-height: 1.25rem;
}

.internal-slots-area {
    min-width: 0;
}

html[data-theme="dark"] .internal-date-picker {
    background: rgba(22, 37, 51, .76);
    border-color: rgba(255, 255, 255, .11);
}

html[data-theme="dark"] .internal-date-picker-header strong {
    color: #eef5fb;
}

html[data-theme="dark"] .internal-date-weekdays span,
html[data-theme="dark"] .internal-date-status {
    color: rgba(220, 233, 246, .68) !important;
}

html[data-theme="dark"] .internal-date-day {
    color: rgba(220, 233, 246, .52);
}

html[data-theme="dark"] .internal-date-day.is-available:not(:disabled) {
    color: #eaf4ff;
    background: rgba(74, 144, 226, .12);
    border-color: rgba(143, 195, 255, .22);
}

html[data-theme="dark"] .internal-date-day.is-available:not(:disabled):hover {
    background: rgba(74, 144, 226, .2);
    border-color: rgba(143, 195, 255, .42);
}

html[data-theme="dark"] .internal-date-day.is-selected-unavailable {
    color: #c8d4df;
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .12);
}

@media (max-width: 991.98px) {
    .internal-booking-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .internal-date-picker {
        padding: .7rem;
    }

    .internal-date-weekdays,
    .internal-date-grid {
        gap: .2rem;
    }

    .internal-date-day {
        border-radius: .55rem;
        font-size: .78rem;
    }
}
