/* ==========================================================================
   1. UNIFIED THEME TOKENS, CONSTRAINTS & DARK MODE RESKINS
   ========================================================================== */

/* ==========================================================================
   App-wide light / dark theme
   --------------------------------------------------------------------------
   Pages should use the --app-* tokens below instead of hard-coded colours.
   The theme is set on <html data-theme="light|dark"> by assets/js/theme.js
   (an inline snippet in layouts/app.blade.php applies it before first paint).
   The rest of this file re-skins the Bootstrap based admin theme for dark mode.
   ========================================================================== */

:root {
    --app-bg:          #fafafa;
    --app-surface:     #ffffff;
    --app-surface-2:   #f5f7fa;
    --app-surface-3:   #eceff3;
    --app-border:      #dfe2e6;
    --app-border-2:    #cbd0d6;
    --app-text:        #272c33;
    --app-text-2:      #4b5563;
    --app-muted:       #868e96;
    --app-accent:       #1877F2;
    --app-accent-hover: #1464d2;
    --app-accent-soft:  #eef4ff;
    --app-accent-line: rgba(24, 119, 242, .28);
    --app-success:     #34A12E;
    --app-warning:     #e4a93c;
    --app-danger:      #d9534f;
    --app-info:        #17a2b8;
    --app-shadow:       0 1px 2px rgba(39, 44, 51, .06), 0 1px 3px rgba(39, 44, 51, .04);
    --app-shadow-md:    0 6px 18px rgba(15, 18, 22, .08), 0 1px 3px rgba(15, 18, 22, .05);
    --app-max-w:        1040px;
    --app-max-w-narrow: 860px;
    --app-max-w-wide:   1120px;
    --app-radius-sm:    8px;
    --app-radius-md:    12px;
    --app-radius-lg:    16px;
    --app-radius-pill:  999px;
    color-scheme: light;
}

html[data-theme="dark"] {
    --app-bg:          #0f1216;
    --app-surface:     #171b21;
    --app-surface-2:   #1e232a;
    --app-surface-3:   #262c35;
    --app-border:      #2a313a;
    --app-border-2:    #38414d;
    --app-text:        #e6e9ee;
    --app-text-2:      #c2c8d0;
    --app-muted:       #98a2b0;
    --app-accent:       #4c9aff;
    --app-accent-hover: #6aadff;
    --app-accent-soft:  rgba(76, 154, 255, .14);
    --app-accent-line: rgba(76, 154, 255, .35);
    --app-success:     #4cc26a;
    --app-warning:     #f0b955;
    --app-danger:      #f0716d;
    --app-info:        #3cc3d8;
    --app-shadow:       0 1px 2px rgba(0, 0, 0, .4);
    --app-shadow-md:    0 8px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

/* Smooth the switch, but not on first paint */
html.theme-ready body,
html.theme-ready .navbar,
html.theme-ready .sidebar,
html.theme-ready .card,
html.theme-ready .list-group-item {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* ---- Unified icon-only Back button (navbar & views) --------------------- */
.bb-back-btn,
[dir] a.bb-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--app-border, #e2e8f0);
    background: var(--app-surface-2, #f4f6fa);
    color: var(--app-text-2, #475569);
    text-decoration: none !important;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bb-back-btn__icon {
    transition: transform 0.16s ease;
}
.bb-back-btn:hover,
.bb-back-btn:focus-visible,
[dir] a.bb-back-btn:hover,
[dir] a.bb-back-btn:focus-visible {
    background: var(--app-surface, #ffffff);
    border-color: color-mix(in srgb, var(--app-accent, #1877f2) 45%, var(--app-border, #e2e8f0));
    color: var(--app-text, #0f172a);
    outline: none;
}
.bb-back-btn:hover .bb-back-btn__icon {
    transform: translateX(-2px);
}
.bb-back-btn:active {
    transform: scale(0.96);
}
.bb-nav-back-btn {
    margin-left: 4px;
}
.bb-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bb-title-row > h1 {
    margin-bottom: 0;
}
@media (prefers-reduced-motion: reduce) {
    .bb-back-btn,
    .bb-back-btn__icon { transition: none; transform: none !important; }
}

/* ---- Theme toggle button (navbar) ---------------------------------------- */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible { background: rgba(127, 127, 127, .15); outline: none; }
.theme-toggle-btn .icon-dark  { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-light { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-dark  { display: inline-block; }

/* ==========================================================================
   Dark overrides for the Bootstrap admin theme
   ========================================================================== */
html[data-theme="dark"] body,
html[data-theme="dark"] .page-content,
html[data-theme="dark"] .mdk-drawer-layout__content {
    background-color: var(--app-bg);
    color: var(--app-text);
}

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"] .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"] .text-dark, html[data-theme="dark"] .text-black,
html[data-theme="dark"] .text-black-100, html[data-theme="dark"] .text-body,
html[data-theme="dark"] .text-primary { color: var(--app-text) !important; }
html[data-theme="dark"] .text-black-50, html[data-theme="dark"] .text-black-60,
html[data-theme="dark"] .text-50, html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-grey, html[data-theme="dark"] .text-secondary { color: var(--app-muted) !important; }
/* Only bare links: classed links (buttons, cards, nav...) keep the colours their own CSS sets */
html[data-theme="dark"] a:not([class]) { color: var(--app-accent); }
html[data-theme="dark"] hr { border-color: var(--app-border); }

/* Surfaces */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .navbar-light,
html[data-theme="dark"] .navbar,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar-light,
html[data-theme="dark"] .mdk-drawer__content,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .page-item .page-link,
html[data-theme="dark"] .accordion .card { background-color: var(--app-surface) !important; color: var(--app-text); }
html[data-theme="dark"] .navbar-light { border-color: var(--app-border); }
html[data-theme="dark"] .bg-black { background-color: #000 !important; }

/* Borders */
html[data-theme="dark"] .border, html[data-theme="dark"] .border-top, html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-left, html[data-theme="dark"] .border-right,
html[data-theme="dark"] .border-1, html[data-theme="dark"] .border-2, html[data-theme="dark"] .border-3,
html[data-theme="dark"] .card, html[data-theme="dark"] .card-header, html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .list-group-item, html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .dropdown-divider, html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer, html[data-theme="dark"] .navbar-border,
html[data-theme="dark"] .page-link, html[data-theme="dark"] .table td, html[data-theme="dark"] .table th,
html[data-theme="dark"] .nav-tabs { border-color: var(--app-border) !important; }

/* Navbar */
html[data-theme="dark"] .navbar-light .navbar-nav .nav-link,
html[data-theme="dark"] .navbar-light .navbar-toggler,
html[data-theme="dark"] .navbar .material-icons { color: var(--app-text-2); }

/* Sidebar (it has hard-coded colours inline in components/sidebar.blade.php) */
html[data-theme="dark"] .sidebar .list-group-item { border-color: var(--app-border) !important; }
html[data-theme="dark"] .sidebar .sidebar-nav-icon,
html[data-theme="dark"] .sidebar-close-btn { color: var(--app-text-2); }
html[data-theme="dark"] .sidebar .list-group-item:hover,
html[data-theme="dark"] .list-group-item:hover { background-color: var(--app-surface-2) !important; }
html[data-theme="dark"] .sidebar .list-group-item.sidebar-nav-item.active,
html[data-theme="dark"] .sidebar .dropdown-item.active { background-color: var(--app-accent-soft) !important; }
html[data-theme="dark"] .sidebar .list-group-item.sidebar-nav-item.active strong,
html[data-theme="dark"] .sidebar .list-group-item.sidebar-nav-item.active .sidebar-nav-icon,
html[data-theme="dark"] .sidebar .dropdown-item.active { color: var(--app-accent); }
html[data-theme="dark"] .sidebar .list-group-item.sidebar-nav-item.bg-black,
html[data-theme="dark"] .sidebar .list-group-item.sidebar-nav-item.bg-black.active { background-color: #000 !important; }
html[data-theme="dark"] .sidebar-close-btn:hover { background: var(--app-surface-2); }
html[data-theme="dark"] .show-timer-btn { background: var(--app-surface-2); }
html[data-theme="dark"] .show-timer-btn:hover { background: var(--app-surface-3); }
html[data-theme="dark"] .sidebar-brand,
html[data-theme="dark"] .sidebar strong,
html[data-theme="dark"] .sidebar .text-black-100 { color: var(--app-text); }

/* Dropdowns */
html[data-theme="dark"] .dropdown-item { color: var(--app-text-2); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background-color: var(--app-surface-2); color: var(--app-text); }
html[data-theme="dark"] .dropdown-header { color: var(--app-muted); }
html[data-theme="dark"] .dropdown-item svg { fill: currentColor; }
html[data-theme="dark"] .dropdown-item svg path,
html[data-theme="dark"] .dropdown-item svg rect { fill: currentColor; }

/* Forms */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"] {
    background-color: var(--app-surface-2);
    border-color: var(--app-border-2);
    color: var(--app-text);
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .custom-select:focus { background-color: var(--app-surface-2); border-color: var(--app-accent); color: var(--app-text); }
html[data-theme="dark"] .form-control::placeholder { color: var(--app-muted); }
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly] { background-color: var(--app-surface-3); }
html[data-theme="dark"] label, html[data-theme="dark"] .form-label { color: var(--app-text-2); }

/* Buttons */
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-white { background-color: var(--app-surface-2); border-color: var(--app-border-2); color: var(--app-text); }
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-white:hover { background-color: var(--app-surface-3); color: var(--app-text); }
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-dark,
html[data-theme="dark"] .btn-outline-primary { color: var(--app-text-2); border-color: var(--app-border-2); }
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-dark:hover,
html[data-theme="dark"] .btn-outline-primary:hover { background-color: var(--app-surface-3); color: var(--app-text); }
/* The default primary / dark buttons are black: invert them so they stay visible */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-dark { background-color: #e6e9ee; border-color: #e6e9ee; color: #0f1216; }
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-dark:hover { background-color: #fff; border-color: #fff; color: #0f1216; }
html[data-theme="dark"] .close { color: var(--app-text); text-shadow: none; }

/* Tables, tabs, pagination, badges */
html[data-theme="dark"] .table { color: var(--app-text); }
html[data-theme="dark"] .table thead th { background-color: var(--app-surface-2); color: var(--app-muted); }
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background-color: var(--app-surface-2); }
html[data-theme="dark"] .table-hover tbody tr:hover { background-color: var(--app-surface-3); color: var(--app-text); }
html[data-theme="dark"] .nav-tabs .nav-link { color: var(--app-muted); }
html[data-theme="dark"] .nav-tabs .nav-link.active { background-color: var(--app-surface); color: var(--app-text); }
html[data-theme="dark"] .page-link { color: var(--app-text-2); }
html[data-theme="dark"] .page-item.active .page-link { background-color: var(--app-accent) !important; border-color: var(--app-accent) !important; color: #fff; }
.badge.badge-light {
    --bs-badge-color: var(--app-text);
    background-color: var(--app-surface-2) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}
html[data-theme="dark"] .badge-light { background-color: var(--app-surface-3) !important; color: var(--app-text) !important; }
html[data-theme="dark"] .modal-backdrop.show { opacity: .7; }
html[data-theme="dark"] .alert-light { background-color: var(--app-surface-2); border-color: var(--app-border); color: var(--app-text); }

/* Third party widgets that render their own white panels */
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-theme="dark"] .select2-dropdown { background-color: var(--app-surface-2); border-color: var(--app-border-2); color: var(--app-text); }
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--app-text); }
html[data-theme="dark"] .flatpickr-calendar { background: var(--app-surface); color: var(--app-text); box-shadow: none; border: 1px solid var(--app-border); }
html[data-theme="dark"] .swal2-popup,
html[data-theme="dark"] .sweet-alert { background: var(--app-surface); color: var(--app-text); }

/* Logo, timer button and other currentColor SVGs follow the text colour */
.sidebar-brand svg, .navbar-brand-icon { color: var(--app-text); }
.show-timer-btn { color: #111827; }
html[data-theme="dark"] .show-timer-btn { color: var(--app-text); }

@media print {
    html[data-theme="dark"] body { background: #fff; color: #000; }
}

/* Sidebar chevrons carry an inline colour:black */
html[data-theme="dark"] .sidebar [style*="color:black"] { color: var(--app-text-2) !important; }

/* Opacity based text helpers are black at N% alpha, which vanishes on dark surfaces */
html[data-theme="dark"] .text-90, html[data-theme="dark"] .text-80, html[data-theme="dark"] .text-70,
html[data-theme="dark"] .text-60, html[data-theme="dark"] .text-black-90, html[data-theme="dark"] .text-black-80,
html[data-theme="dark"] .text-black-70, html[data-theme="dark"] .text-black-60 { color: var(--app-text-2) !important; }
html[data-theme="dark"] .text-40, html[data-theme="dark"] .text-30, html[data-theme="dark"] .text-20,
html[data-theme="dark"] .text-10, html[data-theme="dark"] .text-black-40, html[data-theme="dark"] .text-black-30,
html[data-theme="dark"] .text-black-20 { color: var(--app-muted) !important; }
html[data-theme="dark"] .card-title, html[data-theme="dark"] .card-title a { color: var(--app-text); }
html[data-theme="dark"] .card-title[href]:hover { color: var(--app-accent); }
html[data-theme="dark"] .card--elevated { box-shadow: none; border: 1px solid var(--app-border); }
html[data-theme="dark"] .icon-holder--outline-muted { color: var(--app-muted); border-color: var(--app-border-2); }
html[data-theme="dark"] .page-headline > :first-child:after { background-color: var(--app-accent) !important; }
html[data-theme="dark"] .page-section { background-color: transparent; }
html[data-theme="dark"] .rating__item .material-icons { color: #f0b955; }
html[data-theme="dark"] .border-top-1, html[data-theme="dark"] .border-bottom-1 { border-color: var(--app-border) !important; }
html[data-theme="dark"] .carousel-control-next .carousel-control-icon,
html[data-theme="dark"] .carousel-control-prev .carousel-control-icon { background-color: var(--app-surface-3); color: var(--app-text); }

/* Sidebar profile caret + the small arrow the theme draws on top of every dropdown */
.sidebar .sidebar-caret, .sidebar .sidebar-caret .material-symbols-rounded { color: #4b5563; }
html[data-theme="dark"] .sidebar .sidebar-caret,
html[data-theme="dark"] .sidebar .sidebar-caret .material-symbols-rounded { color: var(--app-text-2); }
.sidebar .sidebar-caret:hover .material-symbols-rounded { color: #1877F2; }
html[data-theme="dark"] .dropdown-menu:after { border-bottom-color: var(--app-surface) !important; }
html[data-theme="dark"] .dropup .dropdown-menu:after { border-bottom-color: transparent !important; border-top-color: var(--app-surface) !important; }

/* ---- Profile picture (edit + show pages) ---- */
/* Camera badge: dark translucent circle, so its icon must be white in both themes */
.profile-picture .camera-icon-small svg,
.profile-picture .camera-icon-small svg g,
.profile-picture .camera-icon-small svg path,
.profile-picture .camera-icon-small svg circle,
.profile-picture .camera-icon-small svg rect { fill: #fff; }
html[data-theme="dark"] .profile-picture {
    border-color: var(--app-surface);        /* the white ring becomes the card colour */
    background-color: var(--app-surface-2);
    box-shadow: none;
}
/* The built-in default avatar (served for /i/profile/photo/default-avatar) is a light image */
html[data-theme="dark"] img[src$="/i/profile/photo/default-avatar"],
html[data-theme="dark"] img[src$="/assets/images/avatar.webp"] { filter: brightness(.78) contrast(.95); }
html[data-theme="dark"] .profile-container { background-color: var(--app-surface) !important; }
html[data-theme="dark"] .banner { background-color: var(--app-surface-3); }

/* Default avatar artwork has its own margin inside the circle: scale it up so it fills the rounded shape */
.profile-picture img[src$="/i/profile/photo/default-avatar"],
.profile-picture img[src$="/assets/images/avatar.webp"],
.avatar img[src$="/i/profile/photo/default-avatar"],
.avatar img[src$="/assets/images/avatar.webp"] { transform: scale(1.18); }

/* Change-photo button: centred over the profile picture, revealed on hover/focus (always visible on touch) */
.profile-picture label.cursor-pointer { display: block; width: 100%; height: 100%; margin: 0; position: relative; border-radius: 50%; overflow: hidden; }
.profile-picture .camera-icon-small {
    top: 50% !important; left: 50% !important; right: auto !important; bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 40px; height: 40px;
    background-color: rgba(0, 0, 0, .55);
    transition: background-color .15s ease, transform .15s ease;
    pointer-events: none;                 /* clicks fall through to the label that opens the file picker */
}
.profile-picture .camera-icon-small .avatar-btn { display: none; }
.profile-picture .camera-icon-small svg { width: 20px; height: 20px; }
.profile-picture label:hover .camera-icon-small,
.profile-picture label:focus-within .camera-icon-small { background-color: rgba(0, 0, 0, .75); transform: translate(-50%, -50%) scale(1.08) !important; }

/* Page title / breadcrumb in the secondary top bar */
html[data-theme="dark"] .breadcrumb-item.active,
html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--app-muted) !important; }
html[data-theme="dark"] .breadcrumb-item a { color: var(--app-text-2); }
html[data-theme="dark"] .breadcrumb-item a:hover { color: var(--app-accent); }

/* Light buttons: keep them dark in their pressed / focused / toggled states too */
html[data-theme="dark"] .btn-light:focus,
html[data-theme="dark"] .btn-light:active,
html[data-theme="dark"] .btn-light.active,
html[data-theme="dark"] .show > .btn-light.dropdown-toggle {
    background-color: var(--app-surface-3) !important; border-color: var(--app-border-2) !important; color: var(--app-text) !important;
}
html[data-theme="dark"] .btn-light .material-icons { color: inherit; }

/* ==========================================================================
   Legacy admin styles (assets/css/admin.css, admin-panel.css) read their own
   --color-* / --scp-* variables. Point them at the app tokens so the back-office
   Livewire pages follow the theme and share the same accent.
   ========================================================================== */
:root,
.admin-page,
.admin-modal-backdrop,
.admin-modal {
    --color-text: var(--app-text);
    --color-muted: var(--app-muted);
    --color-border: var(--app-border);
    --color-bg: var(--app-surface-2);
    --color-surface: var(--app-surface);
    --color-primary: var(--app-accent);
    --color-danger: var(--app-danger);
}
html[data-theme="dark"] .scp-wrap {
    --scp-surface: var(--app-surface); --scp-surface-2: var(--app-surface-2); --scp-surface-3: var(--app-surface-3);
    --scp-border: var(--app-border); --scp-focus: var(--app-accent-soft);
    --scp-text: var(--app-text); --scp-text-2: var(--app-text-2); --scp-text-3: var(--app-muted);
    --scp-blue: var(--app-accent); --scp-blue-dim: var(--app-accent-soft); --scp-blue-glow: var(--app-accent-line);
    --scp-green-dim: rgba(76,194,106,.14); --scp-amber-dim: rgba(240,185,85,.14); --scp-red-dim: rgba(240,113,109,.14);
}
html[data-theme="dark"] .badge--blue   { background: var(--app-accent-soft) !important; color: var(--app-accent) !important; }
html[data-theme="dark"] .badge--purple { background: rgba(167,158,255,.16) !important; color: #a79eff !important; }
html[data-theme="dark"] .badge--green  { background: rgba(76,194,106,.16) !important; color: var(--app-success) !important; }
html[data-theme="dark"] .badge--gray   { background: var(--app-surface-3) !important; color: var(--app-text-2) !important; }
html[data-theme="dark"] .dlv .flash--success { background: rgba(76,194,106,.12); color: var(--app-success); }
html[data-theme="dark"] .dlv .flash--error   { background: rgba(240,113,109,.12); color: var(--app-danger); }
html[data-theme="dark"] .dlv .rate-warn { color: var(--app-warning); }
html[data-theme="dark"] .data-table tr:hover td { background: var(--app-surface-2); }

/* Slug / code pills in the admin tables and modals */
.badge-code { background: var(--app-surface-2) !important; color: var(--app-text-2); border-color: var(--app-border) !important; }

/* ---- Legacy admin.css: modals, inputs, banners, avatars (hard-coded light colours) ---- */
.admin-modal { background: var(--app-surface); border-color: var(--app-border); box-shadow: 0 20px 60px rgba(0,0,0,.35); color: var(--app-text); }
.admin-modal__header { background: var(--app-surface); border-bottom-color: var(--app-border); }
.admin-modal__title { color: var(--app-text); }
.admin-modal__close { color: var(--app-muted); }
.admin-modal__close:hover { color: var(--app-text); }
.admin-modal__footer { border-top-color: var(--app-border); }
.form-input { background: var(--app-surface-2); color: var(--app-text); border-color: var(--app-border-2); border-radius: 10px; }
.form-input:focus { background: var(--app-surface) !important; border-color: var(--app-accent) !important; box-shadow: 0 0 0 3px var(--app-accent-soft) !important; }
.form-input::placeholder { color: var(--app-muted); }
.form-label { color: var(--app-text-2); letter-spacing: .01em; text-transform: none; font-size: .8125rem; font-weight: 600; }
.info-banner--warning { background: color-mix(in srgb, var(--app-warning) 14%, transparent); color: var(--app-text-2); border-color: color-mix(in srgb, var(--app-warning) 35%, transparent); }
.alert-success { background: color-mix(in srgb, var(--app-success) 14%, transparent); color: var(--app-success); border-color: color-mix(in srgb, var(--app-success) 35%, transparent); }
.provider-avatar--blue   { background: var(--app-accent-soft); color: var(--app-accent); }
.provider-avatar--green  { background: color-mix(in srgb, var(--app-success) 16%, transparent); color: var(--app-success); }
.provider-avatar--amber  { background: color-mix(in srgb, var(--app-warning) 16%, transparent); color: var(--app-warning); }
.provider-avatar--purple { background: rgba(139,124,246,.16); color: #8b7cf6; }
.provider-avatar--pink   { background: rgba(236,72,153,.15); color: #ec4899; }
.cred-item--set { color: var(--app-success); }
.cred-indicator { color: var(--app-success); background: color-mix(in srgb, var(--app-success) 14%, transparent); border-color: color-mix(in srgb, var(--app-success) 35%, transparent); }
.settings-card { background: var(--app-surface); border-color: var(--app-border); }
.settings-card__title { color: var(--app-text); }
.btn--ghost:hover { background: var(--app-surface-2) !important; }

/* ---- Tables: rows that carry a leftover `selected` class stay neutral; only ticked rows highlight ---- */
.table tbody tr.selected,
.table tbody tr.selected > td { background-color: transparent; }
.table tbody tr.selected:has(input[type="checkbox"]:checked),
.table tbody tr.selected:has(input[type="checkbox"]:checked) > td { background-color: var(--app-accent-soft); }
html[data-theme="dark"] .table tbody tr.selected,
html[data-theme="dark"] .table tbody tr.selected > td { background-color: transparent !important; }
html[data-theme="dark"] .table tbody tr.selected:has(input[type="checkbox"]:checked),
html[data-theme="dark"] .table tbody tr.selected:has(input[type="checkbox"]:checked) > td { background-color: var(--app-accent-soft) !important; }
html[data-theme="dark"] .table-hover tbody tr:hover > td { background-color: var(--app-surface-2) !important; }

/* ---- Contact list ---- */
.list-group-item.contact-tab-active {
    background: var(--app-accent-soft) !important; color: var(--app-accent) !important;
    border-color: var(--app-accent-line) !important; border-radius: 10px !important;
}
.list-group-item.contact-tab-active .counter { color: inherit; }
.contact-email-details .js-lists-values-list-email { color: var(--app-text); }
.contact-email-details .send-mail-icon { color: var(--app-accent); }
/* Search box inside card headers (a stronger rule in app.css kept it white) */
html[data-theme="dark"] .form-control.search,
html[data-theme="dark"] .search-form .form-control {
    background-color: var(--app-surface-2) !important; color: var(--app-text) !important; border-color: var(--app-border-2) !important;
}
html[data-theme="dark"] .form-control.search::placeholder { color: var(--app-muted); }
.search-form .form-control { border-radius: 10px; min-height: 40px; min-width: 280px; }

/* International phone input (intl-tel-input) */
html[data-theme="dark"] .iti__selected-flag { background-color: transparent; }
html[data-theme="dark"] .iti__selected-flag:hover,
html[data-theme="dark"] .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag { background-color: var(--app-surface-3); }
html[data-theme="dark"] .iti__country-list { background-color: var(--app-surface); color: var(--app-text); border-color: var(--app-border); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
html[data-theme="dark"] .iti__country.iti__highlight { background-color: var(--app-surface-3); }
html[data-theme="dark"] .iti__divider { border-bottom-color: var(--app-border); }
html[data-theme="dark"] .iti__dial-code { color: var(--app-muted); }
/* Disabled contacts: a quiet red marker instead of a solid red cell */
td.contact-status-off { box-shadow: inset 3px 0 0 var(--app-danger); background-color: color-mix(in srgb, var(--app-danger) 8%, transparent); }

/* ---- Card-header search + list picker (contact lists) ---- */
.search-form { display: flex; align-items: center; gap: 6px; }
.search-form #search-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
    background: var(--app-surface-2); border: 1px solid var(--app-border-2); border-radius: 10px; color: var(--app-text-2);
}
.search-form #search-icon:hover { background: var(--app-accent-soft); border-color: var(--app-accent-line); color: var(--app-accent); }
.search-form #search-icon .material-icons { font-size: 20px; }
.dropdown.alert-soft-accent {
    background: var(--app-surface-2) !important; border: 1px solid var(--app-border-2); border-radius: 10px; color: var(--app-text-2);
}
.dropdown.alert-soft-accent > .nav-link { color: var(--app-text-2) !important; padding: .5rem 1rem; font-weight: 600; }
.dropdown.alert-soft-accent:hover { border-color: var(--app-accent-line); }
.dropdown-menu .sidebar-menu-button { display: block; padding: .5rem 1rem; color: var(--app-text-2); text-decoration: none; }
.dropdown-menu .sidebar-menu-button:hover { background: var(--app-surface-2); color: var(--app-text); }

/* Row action icons are plain links with black glyphs */
html[data-theme="dark"] .table td > a:not(.btn):not([class*="badge"]) { color: var(--app-text-2); }
html[data-theme="dark"] .table td > a:not(.btn) svg { filter: invert(.85); }
html[data-theme="dark"] .table td > a:not(.btn):hover { color: var(--app-accent); }

/* ---- Alerts (Bootstrap contextual): tinted surfaces instead of pale pastels in dark mode ---- */
html[data-theme="dark"] .alert { border-color: var(--app-border-2); color: var(--app-text-2); }
html[data-theme="dark"] .alert-primary,
html[data-theme="dark"] .alert-info      { background-color: var(--app-accent-soft); border-color: var(--app-accent-line); color: var(--app-text-2); }
html[data-theme="dark"] .alert-success   { background-color: color-mix(in srgb, var(--app-success) 13%, transparent); border-color: color-mix(in srgb, var(--app-success) 35%, transparent); color: var(--app-text-2); }
html[data-theme="dark"] .alert-warning   { background-color: color-mix(in srgb, var(--app-warning) 13%, transparent); border-color: color-mix(in srgb, var(--app-warning) 38%, transparent); color: var(--app-text-2); }
html[data-theme="dark"] .alert-danger    { background-color: color-mix(in srgb, var(--app-danger) 13%, transparent); border-color: color-mix(in srgb, var(--app-danger) 38%, transparent); color: var(--app-text-2); }
html[data-theme="dark"] .alert-secondary,
html[data-theme="dark"] .alert-light     { background-color: var(--app-surface-2); color: var(--app-text-2); }
html[data-theme="dark"] .alert .close { color: var(--app-text-2); opacity: .8; }
html[data-theme="dark"] .alert .material-icons { color: var(--app-accent); }
html[data-theme="dark"] .alert-primary small, html[data-theme="dark"] .alert-info small,
html[data-theme="dark"] .alert .text-black-100 { color: var(--app-text-2) !important; }

/* ---- Chips, list items and secondary buttons ---- */
html[data-theme="dark"] .chip-primary { background: var(--app-accent-soft) !important; color: var(--app-accent) !important; border: 1px solid var(--app-accent-line); }
html[data-theme="dark"] .chip { color: var(--app-text-2); }
html[data-theme="dark"] .list-group-item.active { background-color: var(--app-accent-soft) !important; color: var(--app-accent) !important; border-color: var(--app-accent-line) !important; }
html[data-theme="dark"] .btn-light-secondary { background: transparent; border: 1px solid var(--app-border-2); color: var(--app-text-2); }
html[data-theme="dark"] .btn-light-secondary:hover { background: var(--app-surface-3); color: var(--app-text); }
/* ---- Unified Brand Modals & Overlays ---- */
html[data-theme="dark"] .modal-content { box-shadow: 0 24px 64px rgba(0, 0, 0, .55); }

/* Keep Bootstrap modals above their backdrop and above mobile bottom sheets/toolbars */
.modal-backdrop {
    --bs-backdrop-zindex: 1075;
    z-index: 1075 !important;
}
.modal-backdrop.show {
    background-color: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 1 !important;
}
html[data-theme="dark"] .modal-backdrop.show {
    background-color: rgba(0, 0, 0, 0.68);
    opacity: 1 !important;
}
.modal {
    --bs-modal-zindex: 1080;
    z-index: 1080 !important;
}
.modal[data-backdrop="false"],
.modal[data-bs-backdrop="false"] {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
:where(.modal) .modal-content {
    border-radius: 20px;
    border: 1px solid var(--app-border, #e5e7eb);
    background: var(--app-surface, #ffffff);
    color: var(--app-text, #0f172a);
    box-shadow: 0 24px 64px -16px rgba(15, 23, 42, 0.28), 0 4px 16px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}
.modal.fade .modal-dialog {
    transform: translateY(10px) scale(.97);
    transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.modal.show .modal-dialog {
    transform: none;
}
:where(.modal) .modal-header {
    border-bottom: 1px solid var(--app-border, #e5e7eb);
    padding: 18px 22px 14px;
    align-items: center;
}
:where(.modal) .modal-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--app-text, #0f172a);
    letter-spacing: -.01em;
}
:where(.modal) .modal-header .close {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: -4px -6px -4px auto;
    color: var(--app-muted, #64748b);
    opacity: 1;
    text-shadow: none;
    transition: background-color .15s ease, color .15s ease;
}
:where(.modal) .modal-header .close:hover {
    background: var(--app-surface-2, #f1f5f9);
    color: var(--app-text, #0f172a);
}
:where(.modal) .modal-body {
    padding: 18px 22px;
    color: var(--app-text-2, #475569);
}
:where(.modal) .modal-footer {
    border-top: 1px solid var(--app-border, #e5e7eb);
    padding: 14px 22px 18px;
    gap: 8px;
}
:where(.modal) .modal-footer .btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 8px 16px;
}
.custom-modal-backdrop {
    z-index: 1082;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.custom-modal-wrapper {
    z-index: 1084;
}
.pd-modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
@media (max-width: 480px) {
    :where(.modal) .modal-dialog-centered {
        margin: 0;
        max-width: none;
        min-height: 100%;
        align-items: flex-end;
    }
    :where(.modal) .modal-dialog-centered .modal-content {
        border-radius: 22px 22px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}
@media (prefers-reduced-motion: reduce) {
    .modal.fade .modal-dialog { transition: none; }
}

/* ==========================================================================
   Global mobile responsiveness, native vertical/horizontal scroll & tables
   ========================================================================== */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

.mdk-drawer-layout {
    max-width: 100%;
    overflow-x: clip !important;
    overflow-y: visible;
}

.mdk-drawer-layout.mdk-drawer-layout--fullbleed {
    overflow: hidden !important;
}

.mdk-drawer-layout__content,
.page-content {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
}

/* Keep closed mobile drawer & scrim non-interactive and guarantee form/editor selectability */
.mdk-drawer { pointer-events: none; }
.mdk-drawer[data-opened],
.mdk-drawer[data-persistent],
.mdk-drawer__content { pointer-events: auto; }
.mdk-drawer__scrim {
    visibility: hidden;
    pointer-events: none;
}
.mdk-drawer[data-opened]:not([data-persistent]) > .mdk-drawer__scrim {
    visibility: visible;
    pointer-events: auto;
}
input, textarea, select, .form-control,
[contenteditable="true"], [contenteditable=""],
.ck-editor__editable, .ck-content {
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* Native vertical scrolling on standalone fullbleed layouts (prevents PerfectScrollbar from locking touch/nested table scroll) */
.mdk-drawer-layout--fullbleed > .mdk-drawer-layout__content,
.mdk-drawer-layout__content.ps,
[data-perfect-scrollbar].mdk-drawer-layout__content {
    overflow-y: auto !important;
    overflow-x: clip !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

/* Nested .mdk-drawer-layout wrappers inside .page-content must flow with the main document scroll (no double vertical scrollbars) */
.page-content .mdk-drawer-layout,
.page-content .mdk-drawer-layout.mdk-drawer-layout--fullbleed,
.page-content .mdk-drawer-layout[data-fullbleed] {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 1 0 auto !important;
    overflow-y: visible !important;
    overflow-x: clip !important;
}

.page-content .mdk-drawer-layout > .mdk-drawer-layout__content,
.page-content .mdk-drawer-layout__content.ps,
.page-content [data-perfect-scrollbar].mdk-drawer-layout__content {
    height: auto !important;
    min-height: 0 !important;
    overflow-y: visible !important;
    overflow-x: clip !important;
}

.mdk-drawer-layout__content > .ps__rail-x,
.mdk-drawer-layout__content > .ps__rail-y {
    display: none !important;
}

/* Stop Bootstrap grid columns & cards inside flex drawer layout from expanding wider than the viewport */
.mdk-drawer-layout__content .row > [class*="col-"],
.mdk-drawer-layout__content .card,
.mdk-drawer-layout__content .card-body,
.mdk-drawer-layout__content .bo-card,
.mdk-drawer-layout__content .section-card {
    min-width: 0;
    max-width: 100%;
}

/* Ensure every table wrapper scrolls smoothly left-to-right while allowing vertical page scroll */
.table-responsive,
.data-table-wrap,
.ph-table-wrap,
.scroll-horizontal {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.search-form {
    max-width: 100%;
    flex-wrap: wrap;
}

.search-form .form-control {
    min-width: 0 !important;
    max-width: 100%;
    flex: 1 1 180px;
}

@media (max-width: 767.98px) {
    .mdk-drawer-layout__content .navbar:not(#default-navbar) {
        flex-wrap: wrap;
        gap: 8px;
    }

    #default-navbar {
        position: relative;
        flex-wrap: nowrap !important;
        gap: 0;
        padding-left: 10px !important;
        padding-right: 10px !important;
        min-height: 54px;
    }

    #default-navbar > .flex {
        min-width: 4px;
        flex: 1 1 0;
    }

    #default-navbar > .navbar-toggler {
        padding: 4px 6px;
        flex-shrink: 0;
    }

    #default-navbar .bb-nav-back-btn {
        width: 34px;
        height: 34px;
        margin-left: 6px;
    }

    #default-navbar .bb-nav-search-btn,
    #default-navbar .theme-toggle-btn {
        width: 34px;
        height: 34px;
        margin-right: 4px !important;
        flex-shrink: 0;
    }

    #default-navbar .navbar-border {
        flex-shrink: 0;
        border-left: none !important;
    }

    #default-navbar .navbar-toggler-custom {
        width: auto;
        min-width: 36px;
        padding: 6px 8px;
    }

    .mdk-drawer-layout__content .card-header > .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-page {
        padding: 1rem 0.875rem;
    }
}

/* ==========================================================================
   Top Navbar Subscribe Pill CTA (shown when user has no active subscription)
   ========================================================================== */
.bb-nav-subscribe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--app-border-2, #d1d5db);
    background: var(--app-surface, #ffffff);
    color: var(--app-text, #0f172a) !important;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.bb-nav-subscribe-btn:hover {
    background: var(--app-surface-2, #f3f4f6);
    border-color: var(--app-text-2, #94a3b8);
    color: var(--app-text, #0f172a) !important;
}

.bb-nav-subscribe-btn:active {
    transform: scale(0.96);
}

html[data-theme="dark"] .bb-nav-subscribe-btn {
    background: var(--app-surface-2, #1b1f2a);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f8fafc !important;
}

html[data-theme="dark"] .bb-nav-subscribe-btn:hover {
    background: var(--app-surface-3, #252b3b);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   X.com-Style Mobile Navigation (< 992px): Avatar Drawer Trigger + Glass Dock
   ========================================================================== */
@media (max-width: 991.98px) {
    #default-navbar {
        position: relative;
        padding-left: 12px !important;
        padding-right: 10px !important;
        min-height: 54px;
    }

    .bb-mobile-avatar-trigger,
    [dir] button.bb-mobile-avatar-trigger {
        position: relative;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: transparent;
        cursor: pointer;
        flex-shrink: 0;
        transition: transform 0.14s ease, opacity 0.14s ease;
    }

    .bb-mobile-avatar-trigger:active {
        transform: scale(0.94);
    }

    .bb-mobile-avatar-trigger:focus {
        outline: none;
        box-shadow: none;
    }

    .bb-mobile-avatar-trigger:focus-visible {
        outline: 2px solid var(--app-accent, #0B5FFF);
        outline-offset: 2px;
    }

    .bb-mobile-avatar-img {
        width: 34px;
        height: 34px;
        object-fit: cover;
        display: block;
    }

    .bb-mobile-avatar-dot {
        position: absolute;
        top: 0;
        right: 0;
        width: 9px;
        height: 9px;
        border-radius: 999px;
        background: #0B5FFF;
        border: 2px solid var(--app-surface, #ffffff);
    }

    .bb-mobile-brand {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 999px;
        color: var(--app-text, #0B0F19);
        text-decoration: none !important;
        z-index: 2;
    }

    .bb-mobile-brand:active {
        transform: translate(-50%, -50%) scale(0.94);
    }

    /* Floating Glassmorphic Bottom Dock */
    .bb-mobile-dock {
        position: fixed;
        left: 50%;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-50%);
        z-index: 950;
        display: inline-flex;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        padding: 6px 8px;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.44) 100%);
        backdrop-filter: blur(22px) saturate(190%);
        -webkit-backdrop-filter: blur(22px) saturate(190%);
        border: 1px solid rgba(255, 255, 255, 0.72);
        box-shadow:
            0 12px 32px -6px rgba(15, 23, 42, 0.18),
            0 2px 8px rgba(15, 23, 42, 0.06),
            inset 0 1.5px 0 rgba(255, 255, 255, 0.9),
            inset 0 -1px 0 rgba(15, 23, 42, 0.06);
        max-width: calc(100vw - 20px);
    }

    html[data-theme="dark"] .bb-mobile-dock {
        background: linear-gradient(180deg, rgba(28, 33, 46, 0.64) 0%, rgba(18, 22, 32, 0.5) 100%);
        border-color: rgba(255, 255, 255, 0.16);
        box-shadow:
            0 14px 36px -6px rgba(0, 0, 0, 0.58),
            inset 0 1px 0 rgba(255, 255, 255, 0.18),
            inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    }

    .bb-dock-item,
    [dir] button.bb-dock-item {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 46px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: var(--app-text-2, #475569);
        text-decoration: none !important;
        cursor: pointer;
        transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    }

    .bb-dock-item:active {
        transform: scale(0.92);
    }

    .bb-dock-item:focus {
        outline: none;
        box-shadow: none;
    }

    .bb-dock-item .material-symbols-rounded {
        font-size: 27px;
        line-height: 1;
        font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 28;
    }

    .bb-dock-svg {
        width: 25px;
        height: 25px;
        display: block;
    }

    .bb-dock-item.is-active {
        background: rgba(15, 23, 42, 0.08);
        color: var(--app-text, #0B0F19);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    }

    html[data-theme="dark"] .bb-dock-item.is-active {
        background: rgba(255, 255, 255, 0.14);
        color: #ffffff;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    }

    .bb-dock-item.is-active .material-symbols-rounded {
        font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 28;
    }

    .bb-dock-item.is-active .bb-bell-body {
        fill: currentColor;
    }

    .bb-dock-badge {
        position: absolute;
        top: 4px;
        right: 6px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 999px;
        background: #0B5FFF;
        color: #ffffff;
        font-size: 0.65rem;
        font-weight: 700;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1.5px solid rgba(255, 255, 255, 0.92);
        box-shadow: 0 2px 6px rgba(11, 95, 255, 0.35);
        pointer-events: none;
    }

    html[data-theme="dark"] .bb-dock-badge {
        border-color: rgba(20, 24, 34, 0.92);
    }

    /* Floating Compose Button (sits cleanly above right edge of dock, like X.com) */
    .bb-mobile-fab {
        position: fixed;
        right: 18px;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        z-index: 945;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
        border-radius: 999px;
        background: #0B0F19;
        color: #ffffff !important;
        text-decoration: none !important;
        border: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow: 0 10px 26px -6px rgba(11, 15, 25, 0.42);
        transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    }

    html[data-theme="dark"] .bb-mobile-fab {
        background: #0B5FFF;
        box-shadow: 0 10px 28px -6px rgba(11, 95, 255, 0.5);
    }

    .bb-mobile-fab:hover,
    .bb-mobile-fab:active {
        transform: scale(0.95);
        color: #ffffff !important;
    }

    .bb-mobile-fab .material-symbols-rounded {
        font-size: 22px;
        line-height: 1;
        font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    }

    /* Give page content bottom clearance so the last card scrolls cleanly above both the dock and the floating Write brief FAB */
    .page-content {
        padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px));
    }

    /* Lift existing mobile FABs so they clear the floating dock cleanly */
    .contacts-mobile-fab,
    #bb-fab.bb-fab {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 945;
    }

    /* Layer the mobile sidebar drawer + backdrop cleanly above the bottom dock and FABs (below modals 1075+) */
    #default-drawer {
        z-index: 1055;
    }
    #default-drawer > .mdk-drawer__scrim {
        z-index: 1;
    }
    #default-drawer > .mdk-drawer__content {
        z-index: 2;
    }
}

/* ==========================================================================
   Shared Empty State (matches Notifications / Contacts empty pages)
   ========================================================================== */
.app-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 440px;
    min-height: 48vh;
    margin: 0 auto;
    padding: 52px 24px;
    text-align: center;
}

.app-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

.app-empty__icon .material-icons {
    font-size: 30px;
    width: auto;
    overflow: visible;
}

.app-empty__title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--app-text);
}

.app-empty__body {
    margin: 0;
    max-width: 38ch;
    font-size: .9375rem;
    line-height: 1.55;
    color: var(--app-muted);
}

.app-empty__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.app-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, background-color .15s ease;
}

.app-empty__btn:hover {
    transform: translateY(-1px);
    text-decoration: none !important;
}

.app-empty__btn--primary {
    border: 1px solid var(--app-accent);
    background: var(--app-accent);
    color: #fff !important;
}

.app-empty__btn--primary:hover {
    opacity: .92;
    color: #fff !important;
}

.app-empty__btn--ghost {
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text) !important;
}

.app-empty__btn--ghost:hover {
    background: var(--app-surface-2);
    color: var(--app-text) !important;
}

@media (max-width: 640px) {
    .app-empty {
        min-height: 40vh;
        padding: 40px 16px;
    }

    .app-empty__title {
        font-size: 1.3rem;
    }
}

/* ==========================================================================
   2. GLOBAL EDITOR & PHONE FIELD UTILITIES (merged from custom.css)
   ========================================================================== */

.ck-editor__editable_inline {
        min-height: 480px !important;
        max-width:100%;
        min-width: 300px !important;
    }
    .ck-content a[href] {color: #15c;}
    .ck.ck-icon, .ck.ck-icon:hover{
        color:#7fb8d1;
    }
    .modal.fade.in .lab-modal-body {
        bottom: 0;
        opacity: 1;
    }
    
    img.grid_img{
        width: 50%
    }
    .ck-content code {
        background-color: #292D3E;
        padding: .15em;
        border-radius: 2px;
    }
    .ck-content pre {
        padding: 1em;
        color: #ffffff;
        background: #292D3E;
        border: 1px solid hsl(0, 0%, 77%);
        border-radius: 2px;
        text-align: left;
        direction: ltr;
        tab-size: 4;
        white-space: pre-wrap;
        font-style: normal;
        min-width: 200px;
    }
    #snippet-balloon-block-editor {
        margin-left: 5%;
        margin-right: 5%;
    }
    :root {
    --ck-z-default: 100;
    --ck-z-modal: calc( var(--ck-z-default) + 999 );
    }
/* Brief editor placeholder: keep the space CKEditor will take (toolbar + editing area) while it
   loads, with a soft pulse, so the form below doesn't jump down ~480px when the editor appears.
   CKEditor hides (classic) or fills (inline/balloon) this element, so the rule stops applying. */
#content.content:empty {
    min-height: 519px;
    border-color: #eef0f3;
    background: linear-gradient(90deg, #f5f6f8 25%, #eceef1 37%, #f5f6f8 63%);
    background-size: 400% 100%;
    animation: brief-editor-loading 1.4s ease infinite;
}
@keyframes brief-editor-loading {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
    #content.content:empty { animation: none; }
}

/* Make intlTelInput phone wrapper match full-width form fields */
.iti {
    display: block;
    width: 100%;
}
.iti .iti__tel-input,
.iti input[type="tel"],
.iti input.form-control {
    width: 100% !important;
}

/* ==========================================================================
   3. ADMIN, SETTINGS FORMS & PROVIDER MODALS (merged from admin.css)
   ========================================================================== */

/*
 * admin.css — BriefBrew admin UI
 * Single source of truth. No duplicate blocks.
 * Bootstrap 4 overrides use !important only where Bootstrap specificity wins.
 */

/* ══════════════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   Scoped to both .admin-page and .admin-modal-backdrop so modal children
   can resolve the same vars even though the modal lives outside .admin-page.
   ══════════════════════════════════════════════════════════════════════════ */
.admin-page,
.admin-modal-backdrop,
.admin-modal {
    --color-text:    var(--app-text);
    --color-muted:   var(--app-muted);
    --color-border:  var(--app-border);
    --color-bg:      var(--app-bg);
    --color-surface: var(--app-surface);
    --color-primary: var(--app-accent);
    --color-danger:  var(--app-danger);
    --font-mono:     'DM Mono', 'Courier New', monospace;
}


/* ══════════════════════════════════════════════════════════════════════════
   3. PAGE LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */
.admin-page {
    max-width: var(--app-max-w);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-title    { font-size: 1.5rem; font-weight: 700; color: var(--color-text); margin: 0; }
.page-subtitle { font-size: 0.875rem; color: var(--color-muted); margin: 0.25rem 0 0; }


/* ══════════════════════════════════════════════════════════════════════════
   4. TAB NAVIGATION
   ══════════════════════════════════════════════════════════════════════════ */
.tab-nav           { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1.5rem; }
.tab-btn           { padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 500; color: var(--color-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; transition: color 0.15s, border-color 0.15s; }
.tab-btn:hover     { color: var(--color-text); }
.tab-btn--active   { color: var(--color-primary); border-bottom-color: var(--color-primary); }


/* ══════════════════════════════════════════════════════════════════════════
   5. SETTINGS CARD
   ══════════════════════════════════════════════════════════════════════════ */
.settings-card              { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 0.75rem; padding: 1.5rem; }
.settings-card__title       { font-size: 1rem; font-weight: 700; margin: 0 0 0.25rem; }
.settings-card__desc        { font-size: 0.8rem; color: var(--color-muted); margin: 0 0 1.25rem; }
.settings-card__subtitle    { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); margin: 1.5rem 0 0.75rem; border-top: 1px solid var(--color-border); padding-top: 1rem; }
.settings-card__subtitle:first-child { border-top: none; padding-top: 0; margin-top: 0; }


/* ══════════════════════════════════════════════════════════════════════════
   6. FORM ELEMENTS
   !important on focus rules — Bootstrap's _forms.scss and _reboot.scss
   both override outline/box-shadow at high specificity.
   ══════════════════════════════════════════════════════════════════════════ */
.form-grid        { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.form-group       { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group--full { grid-column: 1 / -1; }
.form-group--toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
}

.form-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text); }

.form-input {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border) !important;
    border-radius: 0.5rem !important;
    background: var(--color-bg) !important;
    color: var(--color-text) !important;
    width: 100%;
    box-sizing: border-box;
    box-shadow: none !important;
    transition: border-color 0.15s, box-shadow 0.15s;
    /* Bootstrap sets font-family: inherit which is fine */
}

.form-input:focus {
    outline: none !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
    background: var(--app-surface) !important;
}

/* Select arrow fix — Bootstrap removes native arrow on some resets */
select.form-input {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    cursor: pointer;
}

.form-input--mono {
    font-family: var(--font-mono) !important;
    font-size: 0.8rem !important;
    line-height: 1.65 !important;
    white-space: pre !important;
    word-break: normal !important;
    overflow-x: auto !important;
    tab-size: 2;
}

.form-input--disabled { opacity: 0.6 !important; cursor: not-allowed !important; }
.form-error           { font-size: 0.75rem; color: var(--color-danger); }
.hint                 { font-size: 0.72rem; color: var(--color-muted); font-weight: 400; }
.required             { color: var(--color-danger); }


/* ══════════════════════════════════════════════════════════════════════════
   7. COLOR PICKER
   ══════════════════════════════════════════════════════════════════════════ */
.color-field         { display: flex; align-items: center; gap: 0.5rem; }
.color-field__swatch { width: 2.25rem; height: 2.25rem; border-radius: 0.375rem; border: 1px solid var(--color-border); cursor: pointer; padding: 0; flex-shrink: 0; }
.color-field__text   { flex: 1; }


/* ══════════════════════════════════════════════════════════════════════════
   8. TOGGLE (iOS-style)
   ══════════════════════════════════════════════════════════════════════════ */
.toggle               { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input         { opacity: 0; width: 0; height: 0; }
.toggle__track        { position: absolute; inset: 0; background: var(--color-border); border-radius: 999px; cursor: pointer; transition: background 0.2s; }
.toggle__track::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle__track              { background: var(--color-primary); }
.toggle input:checked + .toggle__track::before      { transform: translateX(18px); }

.toggle-list              { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--color-border); border-radius: 0.5rem; overflow: hidden; }
.toggle-row               { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 1rem; background: var(--color-surface); border-bottom: 1px solid var(--color-border); gap: 1rem; }
.toggle-row:last-child    { border-bottom: none; }
.toggle-row__label        { font-size: 0.875rem; font-weight: 600; display: block; }
.toggle-row__desc         { font-size: 0.78rem; color: var(--color-muted); display: block; margin-top: 0.1rem; }


/* ══════════════════════════════════════════════════════════════════════════
   9. CHECKBOX ROWS
   ══════════════════════════════════════════════════════════════════════════ */
.checkbox-row-group { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-row       { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.checkbox-row input { accent-color: var(--color-primary); width: 15px; height: 15px; flex-shrink: 0; }


/* ══════════════════════════════════════════════════════════════════════════
   10. SAVE BAR
   ══════════════════════════════════════════════════════════════════════════ */
.save-bar { position: sticky; bottom: 0; background: var(--color-bg); border-top: 1px solid var(--color-border); padding: 1rem 0; margin-top: 1.5rem; display: flex; justify-content: flex-end; z-index: 10; }


/* ══════════════════════════════════════════════════════════════════════════
   11. BUTTONS
   !important on modal footer buttons — Bootstrap's .btn specificity wins
   without it and renders the wrong background/border.
   ══════════════════════════════════════════════════════════════════════════ */
.btn          { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.1rem; font-size: 0.875rem; font-weight: 600; border-radius: 0.5rem; border: 1px solid transparent; cursor: pointer; transition: opacity 0.15s, background 0.15s; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary       { background: var(--color-primary) !important; border-color: var(--color-primary) !important; color: #fff !important; }
.btn--primary:hover { opacity: 0.88; }

.btn--ghost         { background: transparent !important; border-color: var(--color-border) !important; color: var(--color-text) !important; }
.btn--ghost:hover   { background: var(--color-bg) !important; }

.btn--danger        { background: var(--color-danger) !important; border-color: var(--color-danger) !important; color: #fff !important; }
.btn--danger:hover  { opacity: 0.88; }

.btn:hover { box-shadow: none !important; }

.btn-icon           { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 0.375rem; border: 1px solid var(--color-border); background: transparent; cursor: pointer; transition: background 0.15s, color 0.15s; color: var(--color-muted); }
.btn-icon--edit:hover   { background: var(--color-primary) !important; color: #fff !important; border-color: var(--color-primary) !important; }
.btn-icon--delete:hover { background: var(--color-danger) !important;  color: #fff !important; border-color: var(--color-danger) !important; }
.btn-icon--more         { color: var(--color-muted); }
.btn-icon--more:hover   { background: var(--color-bg) !important; border-color: var(--color-border) !important; color: var(--color-text) !important; }


/* ══════════════════════════════════════════════════════════════════════════
   12. DATA TABLE
   ══════════════════════════════════════════════════════════════════════════ */
.data-table-wrap            { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 0.75rem; }
.data-table                 { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th              { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); background: var(--color-bg); border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.data-table td              { padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td     { background: rgba(59, 130, 246, 0.04); }
.row--deleted td            { opacity: 0.45; }
.row--inactive td           { opacity: 0.5; }
.empty-row                  { text-align: center; color: var(--color-muted); padding: 2.5rem !important; font-size: 0.875rem; }
.text-right                 { text-align: right !important; }


/* ══════════════════════════════════════════════════════════════════════════
   13. BADGES
   ══════════════════════════════════════════════════════════════════════════ */
.badge         { display: inline-block; padding: 0.15rem 0.5rem; font-size: 0.7rem; font-weight: 700; border-radius: 999px; white-space: nowrap; border: none !important; }
.badge--blue   { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge--purple { background: #ede9fe !important; color: #6d28d9 !important; }
.badge--green  { background: #dcfce7 !important; color: #15803d !important; }
.badge--gray   { background: #e2e8f0 !important; color: #475569 !important; }

.badge-code { font-family: var(--font-mono, monospace); font-size: 0.75rem; background: var(--color-bg); border: 1px solid var(--color-border) !important; border-radius: 0.25rem; padding: 0.1rem 0.4rem; }
.cap-badges { display: flex; flex-wrap: wrap; gap: 0.25rem; }


/* ══════════════════════════════════════════════════════════════════════════
   14. STATUS DOTS
   ══════════════════════════════════════════════════════════════════════════ */
.status-dot               { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; }
.status-dot::before       { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot--green::before { background: #22c55e; }
.status-dot--gray::before  { background: #94a3b8; }
.status-dot--red::before   { background: #ef4444; }


/* ══════════════════════════════════════════════════════════════════════════
   15. ADMIN MODAL
   Prefixed .admin-modal-* to avoid collision with Bootstrap's .modal-backdrop.
   ══════════════════════════════════════════════════════════════════════════ */
.admin-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.56) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1060 !important;
    padding: 1rem !important;
}

.admin-modal {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.875rem;
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
}

.admin-modal--sm { max-width: 400px; }
.admin-modal--lg { max-width: 680px; }

.admin-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    background: var(--app-surface);
    z-index: 1;
}

.admin-modal__title { font-size: 1rem; font-weight: 700; margin: 0; color: var(--app-text); }

.admin-modal__close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--app-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    box-shadow: none !important;
}
.admin-modal__close:hover { color: var(--app-text); }

.admin-modal__body   { padding: 1.5rem; }

.admin-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.25rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--app-border);
}


/* ══════════════════════════════════════════════════════════════════════════
   16. INFO BANNERS & ALERTS
   ══════════════════════════════════════════════════════════════════════════ */
.info-banner          { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.85rem; margin-top: 1rem; }
.info-banner--warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

.alert         { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }


/* ══════════════════════════════════════════════════════════════════════════
   17. PROVIDER AVATAR
   ══════════════════════════════════════════════════════════════════════════ */
.provider-avatar {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    flex-shrink: 0;
}

.provider-avatar--blue   { background: #dbeafe; color: #1d4ed8; }
.provider-avatar--green  { background: #dcfce7; color: #15803d; }
.provider-avatar--amber  { background: #fef3c7; color: #92400e; }
.provider-avatar--purple { background: #ede9fe; color: #6d28d9; }
.provider-avatar--pink   { background: #fce7f3; color: #9d174d; }


/* ══════════════════════════════════════════════════════════════════════════
   18. PAYMENT PROVIDERS — DEFAULTS BAR
   ══════════════════════════════════════════════════════════════════════════ */
.provider-defaults-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.625rem;
}

.provider-defaults-bar__item  { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }

.provider-defaults-bar__label {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--color-muted);
    padding-right: 0.25rem; margin-right: 0.25rem;
    border-right: 1px solid var(--color-border);
}

.provider-defaults-bar__avatar {
    width: 22px; height: 22px;
    border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
    flex-shrink: 0;
}

.provider-defaults-bar__name { font-weight: 600; color: var(--color-text); }


/* ══════════════════════════════════════════════════════════════════════════
   19. PAYMENT PROVIDERS — CREDENTIAL STACK
   ══════════════════════════════════════════════════════════════════════════ */
.cred-stack { display: flex; flex-direction: column; gap: 3px; }

.cred-item {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.78rem;
    font-family: var(--font-mono, monospace);
}

.cred-item--set   { color: #15803d; }
.cred-item--unset { color: var(--color-muted); }

/* Credential stored indicator inside modal */
.cred-indicator {
    display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.75rem;
    color: #15803d;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 0.375rem;
    padding: 0.3rem 0.6rem;
    margin-bottom: 0.4rem;
}


/* ══════════════════════════════════════════════════════════════════════════
   20. PAYMENT PROVIDERS — ROLE BADGES
   ══════════════════════════════════════════════════════════════════════════ */
.role-badges { display: flex; flex-wrap: wrap; gap: 3px; }

.role-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    border-radius: 999px; white-space: nowrap;
}

.role-badge--default { background: #dbeafe; color: #1d4ed8; }
.role-badge--intl    { background: #ede9fe; color: #6d28d9; }


/* ══════════════════════════════════════════════════════════════════════════
   21. PAYMENT PROVIDERS — ACTION MENU (three-dot context menu)
   ══════════════════════════════════════════════════════════════════════════ */
.action-group { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.action-menu  { position: relative; }

.action-menu__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    min-width: 185px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    z-index: 200;
    overflow: hidden;
}

.action-menu__item {
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.875rem;
    font-size: 0.8rem; font-weight: 500;
    color: var(--color-text);
    background: none; border: none;
    cursor: pointer; text-align: left;
    transition: background 0.12s;
}

.action-menu__item:hover         { background: var(--color-bg); }
.action-menu__item--active       { color: var(--color-primary); font-weight: 600; }
.action-menu__item + .action-menu__item { border-top: 1px solid var(--color-border); }


/* ══════════════════════════════════════════════════════════════════════════
   22. UTILITIES
   ══════════════════════════════════════════════════════════════════════════ */
.hidden      { display: none !important; }
.mt-4        { margin-top: 1rem; }
.font-medium { font-weight: 600; }
.text-sm     { font-size: 0.875rem; }
.text-muted  { color: var(--color-muted); }

/* ==========================================================================
   4. PRESTIGE AVATAR RINGS & VERIFIED BADGES (merged from profile-prestige.css)
   ========================================================================== */

/* ==========================================================================
   Briefs Subscriber Prestige System — Rings & Verification Seals
   ========================================================================== */

.bb-ring {
  border-radius: 9999px !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.bb-ring--personal {
  box-shadow:
    0 0 0 2px var(--app-surface, var(--surface, #ffffff)),
    0 0 0 4.5px #0B5FFF,
    0 6px 14px -3px rgba(11, 95, 255, 0.28) !important;
}

.bb-ring--business {
  box-shadow:
    0 0 0 2px var(--app-surface, var(--surface, #ffffff)),
    0 0 0 4.5px #D97706,
    0 6px 14px -3px rgba(217, 119, 6, 0.28) !important;
}

.bb-ring--sm.bb-ring--personal {
  box-shadow:
    0 0 0 1.5px var(--app-surface, var(--surface, #ffffff)),
    0 0 0 3px #0B5FFF !important;
}

.bb-ring--sm.bb-ring--business {
  box-shadow:
    0 0 0 1.5px var(--app-surface, var(--surface, #ffffff)),
    0 0 0 3px #D97706 !important;
}

.bb-pbadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.14em;
  margin-left: 4px;
  flex-shrink: 0;
  line-height: 1;
}

.bb-pbadge svg {
  display: block;
}

/* ==========================================================================
   5. SHARED OVERLAYS & FLOATING CREATE BUTTON (merged from ui-overlays.css)
   ========================================================================== */

/* ==========================================================================
   Overlays shared across pages: subscribe dialog, share dialog, floating
   create button. Linked by resources/views/components/overlay-styles.blade.php.
   These live directly under <body>, so they only rely on the --app-* tokens.
   ========================================================================== */

/* ── Subscribe dialog (components/subscribe-dialog) ───────────────────────
   Teleported to <body>, so it can't use the .bf scope; tokens still apply. */
[x-cloak] { display: none !important; }
.bsd {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bsd__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.bsd__card {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 32px 28px 24px;
    border-radius: 20px;
    background:
        radial-gradient(120% 80% at 50% 0%, var(--app-accent-soft), transparent 60%),
        var(--app-surface);
    color: var(--app-text);
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
    animation: bsd-in .18s ease-out;
}
@keyframes bsd-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.bsd .bsd__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-muted);
    cursor: pointer;
}
.bsd__close:hover { background: var(--app-surface-2); color: var(--app-text); }
.bsd__close .material-icons { font-size: 20px; line-height: 1; }
.bsd__photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--app-surface-3);
    box-shadow: 0 0 0 4px var(--app-surface);
}
.bsd .bsd__title {
    margin: 14px 0 4px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.25;
    color: var(--app-text);
}
.bsd__by { margin: 0; color: var(--app-muted); font-size: 14px; }
.bsd__by strong { color: var(--app-text); }
.bsd__bio { margin: 12px 0 0; color: var(--app-text-2); font-size: 15px; line-height: 1.5; }
.bsd__form { margin-top: 22px; text-align: left; }
.bsd .bsd__input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--app-border-2);
    border-radius: 12px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 16px;   /* no zoom on iOS */
    outline: none;
}
.bsd__input:focus { border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-accent-soft); }
.bsd__input[aria-invalid="true"] { border-color: var(--app-danger); }
.bsd .bsd__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    margin-top: 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--app-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.bsd__submit:hover { filter: brightness(.95); }
.bsd__submit:disabled { opacity: .7; cursor: progress; }
.bsd .bsd__submit--ghost { background: transparent; border-color: var(--app-border-2); color: var(--app-text); }
.bsd__submit:focus-visible, .bsd__close:focus-visible { outline: 1.5px solid color-mix(in srgb, var(--app-accent) 45%, transparent); outline-offset: 2px; }
.bsd__error { margin: 10px 0 0; color: var(--app-danger); font-size: 14px; }
.bsd__note { margin: 12px 0 0; color: var(--app-muted); font-size: 13px; text-align: center; }
.bsd__done { margin-top: 20px; }
.bsd__done-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}
.bsd__done-icon .material-icons { line-height: 1; }
.bsd__done h3 { margin: 12px 0 4px; font-size: 18px; font-weight: 800; color: var(--app-text); }
.bsd__done p { margin: 0; color: var(--app-text-2); font-size: 15px; }

/* ── Share dialog (components/share-dialog) ───────────────────────────── */
.bsh { text-align: left; padding: 24px; }
.bsd .bsh__title {
    margin: 0 40px 16px 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--app-text);
}
.bsh__preview {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-surface);
}
.bsh__preview-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}
.bsh__preview-icon .material-icons { line-height: 1; }
.bsh__preview-text { display: flex; flex-direction: column; min-width: 0; }
.bsh__subject {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--app-text);
    font-weight: 700;
    font-size: 15px;
    line-height: 1.35;
}
.bsh__meta { color: var(--app-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bsh__copy {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding: 5px 5px 5px 14px;
    border: 1px solid var(--app-border-2);
    border-radius: 999px;
    background: var(--app-surface-2);
}
.bsh__copy input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--app-text-2);
    font-size: 14px;
}
.bsd .bsh__copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--app-text);
    color: var(--app-surface);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color .15s;
}
.bsd .bsh__copy-btn.is-copied { background: var(--app-success); color: #fff; }
.bsh__copy-btn .material-icons { font-size: 17px; line-height: 1; }

.bsh__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 18px;
}
.bsh__net {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 2px;
    border-radius: 12px;
    color: var(--app-text-2);
    font-size: 12px;
    text-align: center;
    transition: background-color .15s;
}
.bsh__net:hover { background: var(--app-surface-2); color: var(--app-text); text-decoration: none; }
.bsh__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    transition: transform .15s;
}
.bsh__net:hover .bsh__icon { transform: translateY(-2px); }
.bsh__icon .material-icons { font-size: 22px; line-height: 1; }
.bsh__icon--x  { background: #000; }
.bsh__icon--li { background: #0a66c2; }
.bsh__icon--fb { background: #1877f2; }
.bsh__icon--wa { background: #25d366; }
.bsh__icon--tg { background: #229ed9; }
.bsh__icon--em { background: var(--app-muted); }
html[data-theme="dark"] .bsh__icon--x { background: #fff; color: #000; }
.bsd .bsh__more { margin-top: 14px; }
.bsh__more .material-icons { font-size: 18px; line-height: 1; }

@media (max-width: 420px) {
    .bsh__grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Floating create button (campaign/components/action) ──────────────── */
.bb-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    transition: transform .25s ease, opacity .25s ease;
}
.bb-fab.is-hidden { transform: translateY(16px) scale(.9); opacity: 0; pointer-events: none; }
.bb-fab__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50% !important;
    background: var(--app-accent);
    color: #fff;
    box-shadow: 0 8px 24px rgba(24, 119, 242, .35), 0 2px 6px rgba(0, 0, 0, .15);
    cursor: pointer;
    transition: transform .2s ease, filter .15s;
}
.bb-fab__btn:hover { filter: brightness(1.05); }
.bb-fab__btn:focus { outline: none; }
.bb-fab__btn:focus-visible { outline: 1.5px solid color-mix(in srgb, var(--app-accent) 50%, transparent); outline-offset: 3px; }
.bb-fab__btn .material-icons { font-size: 28px; line-height: 1; transition: transform .2s ease; }
.bb-fab.is-open .bb-fab__btn .material-icons { transform: rotate(45deg); }

.bb-fab__menu {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    animation: bb-fab-in .15s ease-out;
}
.bb-fab__menu[hidden] { display: none; }
@keyframes bb-fab-in { from { opacity: 0; transform: translateY(6px); } }
.bb-fab__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--app-text);
    font-weight: 600;
    font-size: 15px;
}
.bb-fab__item:hover, .bb-fab__item:focus-visible { background: var(--app-surface-2); color: var(--app-text); text-decoration: none; outline: none; }
.bb-fab__item .material-icons { color: var(--app-accent); font-size: 20px; line-height: 1; }

@media (max-width: 767.98px) {
    .bb-fab { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .bb-fab, .bb-fab__btn, .bb-fab__btn .material-icons, .bsh__icon { transition: none; }
    .bb-fab__menu, .bsd__card { animation: none; }
}

/* Hide CKEditor 5 "Powered by CKEditor" focus balloon globally */
.ck.ck-powered-by,
.ck.ck-balloon-panel.ck-powered-by-balloon,
.ck-powered-by-balloon,
.ck-powered-by {
    display: none !important;
}

/* ==========================================================================
   AI PLATFORMS & AI PROVIDERS CONFIG MODALS (.ai-cfg-modal)
   ========================================================================== */

.admin-modal.ai-cfg-modal {
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: 0 24px 64px rgba(15, 18, 22, .24);
}

.ai-cfg-modal__header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface);
    flex-shrink: 0;
}

.ai-cfg-modal__sub {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--app-muted);
    line-height: 1.4;
}

.ai-cfg-modal__form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.ai-cfg-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px 22px;
    scrollbar-width: thin;
    scrollbar-color: var(--app-border-2) transparent;
}

.ai-cfg-modal__footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 14px 22px;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-2);
}

/* Quick Platform Presets Bar */
.ai-preset-bar {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
}

.ai-preset-bar__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ai-preset-bar__label span {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--app-text-2);
}

.ai-preset-bar__label small {
    font-size: 11.5px;
    color: var(--app-muted);
}

.ai-preset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-preset-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--app-border-2);
    background: var(--app-surface);
    color: var(--app-text-2);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .12s;
}

.ai-preset-pill:hover {
    background: var(--app-surface-3);
    border-color: var(--app-text-2);
    color: var(--app-text);
}

.ai-preset-pill.is-active {
    background: var(--app-text);
    border-color: var(--app-text);
    color: var(--app-surface);
}

/* Section Card inside Modal */
.ai-cfg-section {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
}

.ai-cfg-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--app-text-2);
}

.ai-cfg-modal .form-input {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border-2);
    color: var(--app-text);
    border-radius: 10px;
}

.ai-cfg-modal .form-input:focus {
    background: var(--app-surface) !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 3px var(--app-accent-soft) !important;
}

/* Available Models Discovery Header & Actions */
.ai-models-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ai-models-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--app-muted);
}

.ai-models-count {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}

.ai-models-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ai-btn-fetch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 9px;
    border: 1px solid var(--app-accent);
    background: var(--app-accent);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, opacity .15s;
}

.ai-btn-fetch:hover:not(:disabled) {
    background: var(--app-accent-hover);
    border-color: var(--app-accent-hover);
}

.ai-btn-fetch:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.ai-btn-subtle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid var(--app-border-2);
    background: var(--app-surface-2);
    color: var(--app-text-2);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}

.ai-btn-subtle:hover {
    background: var(--app-surface-3);
    border-color: var(--app-text-2);
    color: var(--app-text);
}

.ai-key-override {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-key-override .form-input {
    flex: 1 1 0;
    min-width: 0;
}

/* Discovery Status Banner */
.ai-discovery-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
}

.ai-discovery-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.ai-discovery-banner--live {
    background: color-mix(in srgb, var(--app-success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--app-success) 35%, transparent);
    color: var(--app-success);
}

.ai-discovery-banner--catalog {
    background: var(--app-accent-soft);
    border: 1px solid var(--app-accent-line);
    color: var(--app-accent);
}

.ai-discovery-banner--error {
    background: color-mix(in srgb, var(--app-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--app-danger) 35%, transparent);
    color: var(--app-danger);
}

/* Interactive Model Chips Picker */
.ai-model-picker {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    margin-bottom: 10px;
}

.ai-model-picker__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11.5px;
    color: var(--app-muted);
}

.ai-model-picker__bulk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-link-btn {
    border: 0;
    padding: 0;
    background: none;
    color: var(--app-accent);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.ai-link-btn:hover {
    text-decoration: underline;
}

.ai-model-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    padding: 2px 0;
}

.ai-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 29px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--app-border-2);
    background: var(--app-surface);
    color: var(--app-text-2);
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}

.ai-model-chip:hover {
    border-color: var(--app-accent);
    color: var(--app-text);
}

.ai-model-chip.is-selected {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    font-weight: 600;
}

.ai-model-empty {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px dashed var(--app-border-2);
    background: var(--app-surface-2);
    color: var(--app-muted);
    font-size: 12.5px;
    margin-bottom: 10px;
}

.ai-custom-model-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-custom-model-row .form-input {
    flex: 1 1 0;
    min-width: 0;
    height: 34px;
    font-size: 12.5px;
}

/* Capabilities 2-Column Card Grid */
.ai-cap-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 600px) {
    .ai-cap-grid {
        grid-template-columns: 1fr;
    }
}

.ai-cap-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.ai-cap-card--full {
    grid-column: 1 / -1;
}

.ai-cap-card:hover {
    border-color: var(--app-border-2);
    background: var(--app-surface);
}

.ai-cap-card.is-checked {
    border-color: var(--app-accent-line);
    background: var(--app-accent-soft);
}

.ai-cap-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--app-accent);
    flex-shrink: 0;
    cursor: pointer;
}

.ai-cap-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ai-cap-card__body strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text);
    line-height: 1.3;
}

.ai-cap-card__body small {
    font-size: 11.5px;
    color: var(--app-muted);
    line-height: 1.35;
    margin-top: 2px;
}

/* Collapsible Advanced JSON Toggle */
.ai-json-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--app-text);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.ai-json-caret {
    color: var(--app-muted);
    transition: transform .15s ease;
}

.ai-json-caret.is-open {
    transform: rotate(90deg);
}

/* Payment Providers Modern Modal Companions */
.pp-modal-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pp-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

.pp-modal-icon--danger {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

.pp-cred-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    vertical-align: middle;
}

html[data-theme="dark"] .pp-cred-badge {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

.pp-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pp-input-wrap .form-input {
    padding-right: 38px;
}

.pp-eye-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--app-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.pp-eye-btn:hover {
    background: var(--app-surface-3);
    color: var(--app-text);
}

.pp-json-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pp-json-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pp-json-textarea {
    min-height: 150px;
    line-height: 1.55;
    resize: vertical;
}

.pp-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, color .15s;
}

.pp-close-btn:hover {
    background: var(--app-surface-2) !important;
}

/* ==========================================================================
   Global Focus Ring Polish (suppress bold click outlines; subtle :focus-visible)
   ========================================================================== */
:is(a, button, summary, [role="button"], [role="tab"], [tabindex]):focus,
.btn:focus,
.btn.focus,
.nav-link:focus,
.dropdown-item:focus,
.page-link:focus,
.close:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
}

/* Remove Bootstrap's lingering shadow/ring after mouse click */
.btn:focus:not(:focus-visible),
.btn.focus:not(:focus-visible),
.btn:active:focus:not(:focus-visible),
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    box-shadow: none !important;
}

/* Ultra-subtle hairline indicator only for keyboard navigation */
:is(a, button, summary, [role="button"], [role="tab"], [tabindex]:not([tabindex="-1"])):focus-visible,
.btn:focus-visible {
    outline: 1.5px solid color-mix(in srgb, var(--app-accent, #1877F2) 42%, transparent) !important;
    outline-offset: 2px;
    box-shadow: none !important;
}

/* Clean, refined focus border for Bootstrap form inputs & search fields */
:is(.form-control, .custom-select):focus {
    border-color: color-mix(in srgb, var(--app-accent, #1877F2) 55%, var(--app-border)) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-accent, #1877F2) 14%, transparent) !important;
}

/* Form inputs inside custom search bars highlight their wrapper pill instead */
:is(.search-form, .bb-search-header, .contacts-search-wrap, .bf-search) input:focus,
:is(.search-form, .bb-search-header, .contacts-search-wrap, .bf-search) input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
