/* Backoffice styling — shares the product design tokens. */
:root {
    --bhq-primary: #4f46e5;
    --bhq-primary-dark: #4338ca;
    --bhq-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #9333ea 100%);
    --bhq-radius-card: 14px;
    --bhq-radius-control: 10px;
    --bhq-shadow-card: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .07);
    --bhq-shadow-card-hover: 0 4px 8px rgba(15, 23, 42, .07), 0 18px 44px rgba(15, 23, 42, .12);

    /* Rewire Tabler's palette to the brand */
    --tblr-primary: #4f46e5;
    --tblr-primary-rgb: 79, 70, 229;
    --tblr-link-color: #4f46e5;
    --tblr-link-hover-color: #4338ca;
    --tblr-border-radius: var(--bhq-radius-control);
}

body { background: #f4f5fa; }
[data-bs-theme="dark"] body { background: #0f1222; }

/* ---- Cards: soft, borderless, floating -------------------------------- */
.page-wrapper .card {
    border: 0;
    border-radius: var(--bhq-radius-card);
    box-shadow: var(--bhq-shadow-card);
}
[data-bs-theme="dark"] .page-wrapper .card {
    background: #171a2e;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}
.page-wrapper .card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--tblr-border-color-translucent);
}
.card .card-title { font-weight: 600; }

/* ---- Page headers ------------------------------------------------------ */
.page-title { font-weight: 700; font-size: 1.35rem; letter-spacing: -.01em; }
.page-header { margin-top: 1rem; }

/* ---- Sidebar: deep gradient, pill navigation --------------------------- */
aside.navbar-vertical {
    background: linear-gradient(180deg, #151932 0%, #1c1147 100%) !important;
    border-inline-end: 0;
    box-shadow: 4px 0 24px rgba(10, 6, 40, .25);
}
aside.navbar-vertical .navbar-brand {
    font-weight: 700;
    letter-spacing: -.01em;
    padding-block: 1rem;
}
.bhq-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9px;
    background: var(--bhq-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .45);
    margin-inline-end: .4rem;
}
aside.navbar-vertical .nav-link {
    border-radius: 10px;
    margin: .1rem .6rem;
    padding: .5rem .75rem;
    color: rgba(255, 255, 255, .72);
    transition: background .12s ease, color .12s ease;
}
aside.navbar-vertical .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
aside.navbar-vertical .nav-link.active {
    background: var(--bhq-gradient);
    color: #fff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .38);
}
aside.navbar-vertical .sidebar-section {
    color: rgba(255, 255, 255, .45);
    opacity: 1;
    font-weight: 600;
}
aside.navbar-vertical .sidebar-footer { border-color: rgba(255, 255, 255, .08) !important; }

/* ---- Buttons & inputs -------------------------------------------------- */
.btn { border-radius: var(--bhq-radius-control); font-weight: 500; }
.btn-primary {
    background: var(--bhq-gradient);
    border: 0;
    box-shadow: 0 4px 14px rgba(99, 102, 241, .35);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 18px rgba(99, 102, 241, .45); }
.form-control, .form-select {
    border-radius: var(--bhq-radius-control);
}
/* Size selects from their longest option instead of Bootstrap's fixed full-column width. */
select.form-select:not([multiple]):not([size]) {
    inline-size: max-content;
    min-inline-size: 8rem;
    max-inline-size: 100%;
}
.input-group > select.form-select:not([multiple]):not([size]) {
    flex: 0 1 max-content;
    inline-size: max-content;
}
/* Inside a form grid a select must fill its column like every neighbouring input, or the row's
   bottom alignment breaks and the control floats loose of its label (the subscription interval
   select). The max-content sizing above is for standalone filter dropdowns, not grid forms. */
form .row [class*="col"] > select.form-select:not([multiple]):not([size]) {
    inline-size: 100%;
}
.dropdown-menu {
    inline-size: max-content;
    max-inline-size: calc(100vw - 1rem);
}
.dropdown-menu :where(.dropdown-item, .dropdown-header) {
    max-inline-size: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.form-control:focus, .form-select:focus {
    border-color: var(--bhq-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

/* Password fields use the common in-field visibility control. */
.bhq-password-field { position: relative; }
.bhq-password-field > .form-control {
    min-width: 0;
    padding-inline-end: 2.5rem;
    border-start-end-radius: var(--bhq-radius-control) !important;
    border-end-end-radius: var(--bhq-radius-control) !important;
}
.bhq-password-toggle {
    position: absolute;
    z-index: 5;
    /* Centered for whatever height the field has (flat groups, focus rings, zoom levels), and
       inset far enough that the circular hover pill stays clearly inside the input's rounded
       corner — at 2px of clearance it visually poked past the curve. */
    inset-block-start: 50%;
    transform: translateY(-50%);
    inset-inline-end: .3rem;
    display: inline-flex;
    width: 1.8rem;
    height: 1.8rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--tblr-secondary);
    background: transparent;
    cursor: pointer;
}
.bhq-password-toggle:hover {
    color: var(--bhq-primary);
    background: rgba(79, 70, 229, .09);
}
.bhq-password-toggle:focus-visible {
    outline: 2px solid var(--bhq-primary);
    outline-offset: 1px;
}
.bhq-password-toggle svg {
    display: block;
    width: 1.1rem;
    height: 1.1rem;
}

/* ---- Tables ------------------------------------------------------------ */
.card .table thead th {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .06em;
    color: var(--tblr-secondary);
    background: transparent;
    border-bottom-width: 1px;
}
.card .table tbody tr { transition: background .1s ease; }
.card .table tbody tr:hover { background: rgba(79, 70, 229, .04); }
[data-bs-theme="dark"] .card .table tbody tr:hover { background: rgba(129, 140, 248, .07); }
.badge { border-radius: 999px; font-weight: 600; }

/* Account operations stay compact while filters and actions remain usable on mobile. */
.bhq-account-filters .form-label { margin-bottom: .25rem; }
.bhq-account-filters .form-select { min-width: 8.5rem; }
.bhq-detail-list dt,
.bhq-detail-list dd { margin-bottom: .65rem; }
.bhq-detail-list dd { min-width: 0; }

/* Keep the operator account desk dense: management work should fit in one desktop viewport. */
.bhq-account-manage-page .page-header { margin-top: .6rem; }
.bhq-account-manage-page .page-body { padding-top: .65rem; }
.bhq-account-manage-heading {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    min-width: 0;
}
.bhq-account-manage-heading > a,
.bhq-account-manage-heading > span {
    flex: 0 0 auto;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.bhq-account-manage-heading > span { color: var(--tblr-secondary); }
.bhq-account-manage-heading .page-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bhq-account-manage-page .card-header {
    min-height: 2.75rem;
    padding: .65rem 1rem;
}
.bhq-account-manage-page .card-body { padding: .85rem 1rem; }
.bhq-account-manage-page .card-footer { padding: .65rem 1rem; }
.bhq-account-manage-page .form-label { margin-bottom: .25rem; }
.bhq-workspace-switches {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.5rem;
}
.bhq-workspace-switches .form-check { margin: 0; }
.bhq-disable-confirm {
    margin: .65rem 0 0;
    padding: .45rem .65rem .45rem 2.15rem;
    border-radius: var(--bhq-radius-control);
    color: var(--tblr-warning-text-emphasis);
    background: var(--tblr-warning-bg-subtle);
}
.bhq-disable-confirm .form-check-input { margin-top: .1rem; }
.bhq-subscription-control { min-width: 0; }
.bhq-account-manage-page .bhq-detail-list { font-size: .875rem; }
.bhq-account-manage-page .bhq-detail-list dt,
.bhq-account-manage-page .bhq-detail-list dd { margin-bottom: .4rem; }
@media (max-width: 767.98px) {
    .bhq-account-filters .form-select { min-width: 0; }
    .bhq-account-filters .btn { flex: 1 1 auto; }
    .bhq-account-manage-page .page-header { margin-top: .35rem; }
    .bhq-account-manage-page .page-body { padding-top: .5rem; }
    .bhq-account-manage-page .card-header,
    .bhq-account-manage-page .card-body,
    .bhq-account-manage-page .card-footer { padding-inline: .75rem; }
    .bhq-disable-confirm { padding-inline-end: .5rem; }
    .bhq-subscription-control + .bhq-subscription-control {
        padding-top: .75rem;
        border-top: 1px solid var(--tblr-border-color-translucent);
    }
}

/* ---- Stat cards -------------------------------------------------------- */
.card .avatar { border-radius: 11px; }
.subheader { letter-spacing: .05em; }

/* ---- Alerts / banners -------------------------------------------------- */
.alert { border: 0; border-radius: var(--bhq-radius-card); box-shadow: var(--bhq-shadow-card); }

/* ---- Pagination pills -------------------------------------------------- */
.bhq-pagination button { border-radius: 999px; border-color: transparent; background: rgba(79, 70, 229, .07); }
.bhq-pagination button.active { background: var(--bhq-gradient); }
.bhq-pagination { display:flex;justify-content:center;gap:.35rem;padding:.65rem;border-top:1px solid var(--tblr-border-color-translucent); }
.bhq-pagination button { min-width:2rem;min-height:2rem;padding:.25rem .5rem; }
.table-sortable th[role="button"] { cursor:pointer;user-select:none; }
.table-sortable th.sorted-asc::after { content:" ↑"; }
.table-sortable th.sorted-desc::after { content:" ↓"; }
.bhq-row-actions { flex-wrap:nowrap;white-space:nowrap; }
.bhq-receipt-preview iframe { display:block;width:100%;height:720px;border:0;border-radius:0 0 var(--bhq-radius-card) var(--bhq-radius-card);background:#fff; }
@media (max-width: 767.98px) { .bhq-receipt-preview iframe { height:520px; } }

/* ---- Login hero -------------------------------------------------------- */
.bhq-hero {
    background:
        radial-gradient(60rem 30rem at 15% 10%, rgba(147, 51, 234, .45), transparent 60%),
        radial-gradient(50rem 30rem at 90% 90%, rgba(56, 189, 248, .35), transparent 60%),
        linear-gradient(150deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%);
}
.bhq-glass {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
[data-bs-theme="dark"] .bhq-glass {
    background: rgba(23, 26, 46, .88);
    border-color: rgba(255, 255, 255, .08);
}

/* Matrix chips */
.badge.w-100 { border-radius: 8px; padding-block: .35rem; }

/* Support requests arrive as typed text; keep the author's line breaks. */
.bhq-preline { white-space: pre-line; }

/* Backoffice motion mirrors the product's fast feedback without reducing information density. */
:root {
    --bhq-motion-fast: 140ms;
    --bhq-motion-base: 220ms;
    --bhq-motion-ease: cubic-bezier(.2, .8, .2, 1);
}
.page-header .container-xl { animation: bhq-bo-page-in var(--bhq-motion-base) var(--bhq-motion-ease) both; }
/* Never animate .page-body containers: they hold the fixed-position modals, and a filled
   opacity/transform animation turns the container into a containing block and stacking
   context — the modal then renders inside the page flow, trapped below its own body-level
   backdrop: gray screen, nothing clickable. Same rule as the product app's app.css. */
.alert { animation: bhq-bo-alert-in 260ms var(--bhq-motion-ease) both; }
.dropdown-menu.show { transform-origin: top center; animation: bhq-bo-pop-in var(--bhq-motion-fast) var(--bhq-motion-ease) both; }
[dir="rtl"] .dropdown-menu.show { transform-origin: top right; }
.btn { transition: transform var(--bhq-motion-fast) ease, box-shadow var(--bhq-motion-fast) ease, filter var(--bhq-motion-fast) ease; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0) scale(.98); }
aside.navbar-vertical .nav-link-icon { transition: transform var(--bhq-motion-base) var(--bhq-motion-ease); }
aside.navbar-vertical .nav-link:hover .nav-link-icon { transform: translateY(-1px) scale(1.08); }
.form-control,.form-select { transition: border-color var(--bhq-motion-fast) ease, box-shadow var(--bhq-motion-fast) ease, background-color var(--bhq-motion-fast) ease; }
@keyframes bhq-bo-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bhq-bo-alert-in { from { opacity: 0; transform: translateY(-6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes bhq-bo-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    *,*::before,*::after { animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important; }
}
@media print { .page-header .container-xl,.page-body > .container-xl,.alert { animation:none!important; } }

/* A .table-responsive clips absolutely-positioned children, so a row's "More" menu opened
   invisibly inside the scroll container. While one of its menus is open the container stops
   clipping (scrolling pauses for that moment, which is fine — a menu is open). */
.table-responsive:has(.dropdown-menu.show) { overflow: visible; }
