/* ==========================================================================
   bodek.css — the ONE shared stylesheet for every Bodek site
   (accounts, files, forms, dev, admin, tools, support).

   Source of truth: /var/www/bodek/shared/assets/bodek.css
   Served on every host as  /shared/bodek.css  through a symlink
   public/shared -> /var/www/bodek/shared/assets  (see ../README.md).

   Load order on every page:
       bootstrap.min.css  ->  bootstrap-icons  ->  /shared/bodek.css  ->  site css
   Site CSS may override anything here; keep ONLY site-specific rules there.

   Theme: Bootstrap 5.3 `data-bs-theme` on <html>. A page without the
   attribute gets the dark look (the historic Bodek default).

   Sections
     1. Design tokens (light + dark)
     2. Base + legacy element colours
     3. Navbar, brand, user menu, avatars
     4. App grid menu + product marks
     5. Buttons
     6. Forms + search inputs
     7. Cards, tables, badges
     8. Dropdowns
     9. Modals + close button
    10. Callouts + toasts
    11. Page building blocks (hero, crumbs, headings, tiles, lists)
    12. Empty states
    13. Footer
    14. Prose (article typography)
    15. Settings layout + back button
    16. Shared product components (header search, storage backend tiles)
    17. Utilities
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* Brand */
    --bd-brand: #57A7FF;               /* Bodek blue: logos, marks, highlights */
    --bd-brand-rgb: 87, 167, 255;
    --bd-accent: #0d6efd;              /* interactive accent (buttons, focus rings) */
    --bd-accent-rgb: 13, 110, 253;
    --bd-accent-hover: #0b5ed7;
    --bd-danger: #dc3545;
    --bd-danger-hover: #bb2d3b;
    --bd-success: #198754;
    --bd-success-hover: #157347;
    --bd-warning: #ffc107;
    --bd-info: #0dcaf0;

    /* Shape */
    --bd-radius-xs: 6px;
    --bd-radius-sm: 9px;
    --bd-radius: 12px;
    --bd-radius-md: 14px;
    --bd-radius-lg: 18px;
    --bd-radius-pill: 999px;

    /* Spacing scale */
    --bd-space-1: 4px;
    --bd-space-2: 8px;
    --bd-space-3: 12px;
    --bd-space-4: 16px;
    --bd-space-5: 24px;
    --bd-space-6: 32px;
    --bd-space-7: 48px;

    /* Type */
    --bd-font: Arial, sans-serif;
    --bd-font-mono: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    /* Layout */
    --bd-navbar-h: 70px;
    --bd-prose-max: 760px;

    /* Motion */
    --bd-ease: .15s ease;
}

/* Dark (default) */
:root, [data-bs-theme="dark"] {
    --bd-bg: #121212;
    --bd-surface: #1e1e1e;             /* cards, navbar */
    --bd-surface-2: #252525;           /* inputs, dropdowns */
    --bd-surface-modal: #1c1c1f;
    --bd-surface-sunken: rgba(125, 140, 160, 0.08);
    --bd-border: #333;
    --bd-border-soft: rgba(125, 140, 160, 0.22);
    --bd-text: #e0e0e0;
    --bd-muted: #a3a3aa;
    --bd-hover: rgba(125, 140, 160, 0.18);
    --bd-active: rgba(125, 140, 160, 0.28);
    --bd-input-bg: #252525;
    --bd-input-color: #e0e0e0;
    --bd-input-border: #333;
    --bd-link: #57A7FF;
    --bd-link-rgb: 87, 167, 255;
    --bd-code-bg: rgba(127, 127, 127, 0.18);
    --bd-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --bd-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    --bd-shadow-menu: 0 10px 32px rgba(0, 0, 0, 0.28);
    --bd-shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.45);

    /* Bootstrap link colours follow the brand (sites used #6ea8fe / #4d9bff / #57a7ff before) */
    --bs-link-color: #57A7FF;
    --bs-link-color-rgb: 87, 167, 255;
    --bs-link-hover-color: #8cc3ff;
    --bs-link-hover-color-rgb: 140, 195, 255;
}

[data-bs-theme="light"] {
    --bd-bg: #f4f6fa;
    --bd-surface: #ffffff;
    --bd-surface-2: #f6f7f9;
    --bd-surface-modal: #ffffff;
    --bd-surface-sunken: #f6f7f9;
    --bd-border: #e3e6ea;
    --bd-border-soft: rgba(15, 23, 42, 0.12);
    --bd-text: #1a1a1a;
    --bd-muted: #5f6570;
    --bd-hover: rgba(15, 23, 42, 0.06);
    --bd-active: rgba(15, 23, 42, 0.1);
    --bd-input-bg: #fff;
    --bd-input-color: #1a1a1a;
    --bd-input-border: #ccd2dc;
    --bd-link: #0b5ed7;
    --bd-link-rgb: 11, 94, 215;
    --bd-code-bg: rgba(15, 23, 42, 0.07);
    --bd-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --bd-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --bd-shadow-menu: 0 10px 32px rgba(15, 23, 42, 0.12);
    --bd-shadow-modal: 0 20px 60px rgba(15, 23, 42, 0.18);

    --bs-link-color: #0b5ed7;
    --bs-link-color-rgb: 11, 94, 215;
    --bs-link-hover-color: #0a4fb5;
    --bs-link-hover-color-rgb: 10, 79, 181;
}


/* ==========================================================================
   2. BASE + LEGACY ELEMENT COLOURS
   ========================================================================== */
body { background-color: var(--bd-bg); color: var(--bd-text); font-family: var(--bd-font); padding-top: 0; }
.spinner-border { margin-left: 5px; }

/* Historic dark-theme text colour on bare elements (kept so existing pages look
   the same; zero-specificity prefix so any class still wins). Scoped to dark:
   in light mode h6/small/li used to stay #e0e0e0 on white, which was unreadable. */
:where(:root:not([data-bs-theme="light"])) :is(h2, h5, h6, p, label, small, td, li) { color: #e0e0e0; }
:where(:root:not([data-bs-theme="light"])) .table { color: #e0e0e0; }
[data-bs-theme="light"] :is(h2, h5, label, p, td) { color: #1a1a1a; }


/* ==========================================================================
   3. NAVBAR, BRAND, USER MENU, AVATARS
   <nav class="navbar bf-navbar px-3"><div class="container-fluid d-flex align-items-center gap-2">
     <a class="navbar-brand d-flex align-items-center gap-2 me-2" href="/">
       <img class="bf-logo bf-logo-dark" src="/images/bodek.png"><img class="bf-logo bf-logo-light" src="/images/bodek_black.png">
       <span class="bd-brand-sub">Product</span></a> …
   ========================================================================== */
/* Sticky on every page; z-index above content, below Bootstrap modals (1055+). */
.bf-navbar {
    background-color: var(--bd-surface); border-bottom: 1px solid var(--bd-border);
    position: sticky; top: 0; z-index: 1030;
    padding-top: 12px; padding-bottom: 12px; min-height: var(--bd-navbar-h);
}
.bf-navbar .navbar-brand, .bf-navbar .dropdown-toggle { color: var(--bd-text); }
.bf-navbar .navbar-brand { padding-top: 0; padding-bottom: 0; flex-shrink: 1; min-width: 0; }
.bf-logo { height: 44px; width: auto; max-height: 100%; display: block; }
.bf-logo-light { display: none; }
.bf-logo.bd-logo-wordmark { height: 40px; } /* "Bodek Solutions" wordmark (accounts, admin, support): blue, works on both themes */
[data-bs-theme="light"] .bf-logo-dark { display: none; }
[data-bs-theme="light"] .bf-logo-light { display: inline; }
.bf-avatar-initial { display: inline-block; text-align: center; background: var(--bd-accent); color: #fff; border-radius: 50%; font-weight: 600; }
.bf-auth-card { border-radius: 16px; }

/* Product name after the Bodek logo ("Bodek | Tools") */
.bd-brand-sub {
    padding-left: .6rem; border-left: 1px solid var(--bd-border);
    color: var(--bd-muted); font-weight: 600; white-space: nowrap; line-height: 1.6;
}
/* Plain text links in the navbar (Docs, Console, All tools…) */
.bd-navlink { color: var(--bd-text); opacity: .85; text-decoration: none; white-space: nowrap; }
.bd-navlink:hover, .bd-navlink.active, .bd-navlink[aria-current="page"] { opacity: 1; color: var(--bd-text); }

.bf-navbar .bf-usermenu img,
.bf-navbar .bf-avatar-initial { width: 32px !important; height: 32px !important; line-height: 32px !important; flex-shrink: 0; }
@media (max-width: 767px) {
    .bf-navbar { padding: 6px 10px !important; min-height: 60px; }
    .bf-logo { height: 32px !important; max-width: 150px; object-fit: contain; }
    .bf-navbar .bf-usermenu img,
    .bf-navbar .bf-avatar-initial { width: 28px !important; height: 28px !important; line-height: 28px !important; }
    .bf-navbar .container-fluid, .bf-navbar > .container { flex-wrap: nowrap; }
}

/* Header user-menu trigger: hover background matches buttons/dropdowns */
.bf-usermenu {
    padding: 4px 10px 4px 4px;
    border-radius: var(--bd-radius-pill);
    color: var(--bs-body-color);
    text-decoration: none;
    outline: none;
    transition: background-color var(--bd-ease);
}
.bf-usermenu:hover, .bf-usermenu:focus, .bf-usermenu:focus-visible,
.bf-usermenu[aria-expanded="true"] {
    background-color: var(--bd-hover);
    color: var(--bs-body-color);
    text-decoration: none;
}
[data-bs-theme="light"] .bf-usermenu:hover,
[data-bs-theme="light"] .bf-usermenu:focus,
[data-bs-theme="light"] .bf-usermenu:focus-visible,
[data-bs-theme="light"] .bf-usermenu[aria-expanded="true"] { background-color: rgba(15, 23, 42, 0.07); }
.bf-usermenu:focus { box-shadow: none; }
.bf-usermenu:focus-visible { box-shadow: 0 0 0 2px rgba(var(--bd-accent-rgb), 0.45); }
.bf-usermenu .dropdown-toggle::after, .bf-usermenu::after { display: none !important; }

/* Avatar sizes without inline styles (needed on CSP sites without 'unsafe-inline') */
.bd-av { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.bd-av-24 { width: 24px; height: 24px; line-height: 24px; font-size: .8rem; }
.bd-av-32 { width: 32px; height: 32px; line-height: 32px; }
.bd-av-40 { width: 40px; height: 40px; line-height: 40px; font-size: 1.1rem; }
.bd-menu-label { letter-spacing: .06em; }
.bd-usermenu-list { min-width: 280px; }


/* ==========================================================================
   4. APP GRID MENU + PRODUCT MARKS
   <button class="btn btn-action btn-sm bd-appgrid-btn" data-bs-toggle="dropdown"><i class="bi bi-grid-3x3-gap-fill"></i></button>
   <div class="dropdown-menu dropdown-menu-end bd-apps-menu">
     <div class="bd-apps-label">Bodek apps</div>
     <div class="bd-apps-grid">
       <a class="bd-app-tile" href="…">
         <img class="bd-mark" src="/shared/logos/files-192.png" alt="">          real logo
         <span class="bd-mark bd-mark-glyph"><i class="bi bi-…"></i></span>     no logo yet
         <span class="bd-app-tile-name">Files</span></a>
   ========================================================================== */
/* A product mark: the real logo image, or a glyph drawn at the same size + colour */
.bd-mark {
    --bd-mark-size: 40px;
    width: var(--bd-mark-size); height: var(--bd-mark-size);
    flex-shrink: 0; object-fit: contain; display: inline-block;
}
.bd-mark-glyph {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--bd-brand); line-height: 1;
    font-size: calc(var(--bd-mark-size) * 0.8);
}
.bd-mark-glyph .bi, .bd-mark-glyph .bi::before { line-height: 1; vertical-align: 0; }
.bd-mark-sm { --bd-mark-size: 22px; }
.bd-mark-md { --bd-mark-size: 32px; }
.bd-mark-lg { --bd-mark-size: 48px; }
.bd-mark-xl { --bd-mark-size: 56px; }

.bd-appgrid-btn {
    width: 36px; height: 36px; padding: 0 !important;
    display: inline-flex !important; align-items: center; justify-content: center;
}
.bd-apps-menu { padding: 14px !important; min-width: 290px; }
.bd-apps-label { padding: 0 4px 8px; font-size: .75rem; color: var(--bd-muted); text-transform: uppercase; letter-spacing: .06em; }
.bd-apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bd-app-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 14px 8px; border-radius: var(--bd-radius);
    border: 1px solid transparent; background: transparent;
    color: var(--bs-body-color) !important; text-decoration: none;
    min-height: 96px; text-align: center;
    transition: background .12s, border-color .12s, transform .08s;
}
.bd-app-tile:hover, .bd-app-tile:focus-visible { background: var(--bd-hover); border-color: var(--bs-primary-border-subtle, #9ec5fe); text-decoration: none; outline: none; }
.bd-app-tile:active { transform: scale(0.98); }
.bd-app-tile-name { font-size: .85rem; font-weight: 500; line-height: 1.2; }


/* ==========================================================================
   5. BUTTONS
   Pills with NO background or border by default; a soft gray fill appears on
   hover. Colour variants only retint text + hover. Add `btn-solid` for a
   filled call-to-action.
   ========================================================================== */
.btn-primary { background-color: var(--bd-accent); border: none; } /* legacy; .btn below resets real buttons */

.btn {
    border-radius: var(--bd-radius-pill);
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    padding: 7px 16px;
    font-weight: 500;
    line-height: 1.3;
    transition: background-color var(--bd-ease), color var(--bd-ease), box-shadow var(--bd-ease);
    box-shadow: none;
}
.btn:hover,
.btn:focus-visible {
    background-color: var(--bd-hover);
    color: inherit;
    box-shadow: none;
    outline: none;
}
.btn:focus-visible { box-shadow: 0 0 0 2px rgba(var(--bd-accent-rgb), 0.45); } /* keyboard focus ring */
.btn:active { background-color: var(--bd-active); box-shadow: none; }
.btn:disabled, .btn.disabled { opacity: .55; background: transparent !important; }

/* Colour variants: just retint text and hover */
.btn-primary           { color: var(--accent, var(--bd-accent)); }
.btn-primary:hover,
.btn-primary:focus-visible { background-color: rgba(var(--bd-accent-rgb), 0.16); color: var(--accent, var(--bd-accent)); }

.btn-danger            { color: var(--bd-danger); }
.btn-danger:hover,
.btn-danger:focus-visible  { background-color: rgba(220, 53, 69, 0.16); color: var(--bd-danger); }

.btn-success           { color: var(--bd-success); }
.btn-success:hover,
.btn-success:focus-visible { background-color: rgba(25, 135, 84, 0.16); color: var(--bd-success); }

.btn-secondary         { color: #889; }
.btn-secondary:hover,
.btn-secondary:focus-visible { background-color: var(--bd-hover); color: inherit; }

/* Bootstrap btn-outline-* — treated the same as their solid siblings */
.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-info { color: inherit; }
.btn-outline-primary:hover,
.btn-outline-primary:focus-visible { background-color: rgba(var(--bd-accent-rgb), 0.16); color: var(--accent, var(--bd-accent)); }
.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible { background-color: var(--bd-hover); }
.btn-outline-success:hover,
.btn-outline-success:focus-visible { background-color: rgba(25, 135, 84, 0.16); color: var(--bd-success); }
.btn-outline-info:hover,
.btn-outline-info:focus-visible { background-color: rgba(13, 202, 240, 0.16); color: var(--bd-info); }
/* Destructive outline buttons read as destructive (were plain text before) */
.btn-outline-danger { color: var(--bd-danger); }
.btn-outline-danger:hover,
.btn-outline-danger:focus-visible { background-color: rgba(220, 53, 69, 0.16); color: var(--bd-danger); }

/* Strong filled CTA */
.btn-solid, .btn-primary.btn-solid {
    background-color: var(--accent, var(--bd-accent));
    color: #fff;
}
.btn-solid:hover, .btn-primary.btn-solid:hover,
.btn-solid:focus-visible, .btn-primary.btn-solid:focus-visible {
    background-color: var(--bd-accent-hover);
    color: #fff;
}
.btn-danger.btn-solid { background-color: var(--bd-danger); color: #fff; }
.btn-danger.btn-solid:hover, .btn-danger.btn-solid:focus-visible { background-color: var(--bd-danger-hover); color: #fff; }
.btn-success.btn-solid { background-color: var(--bd-success); color: #fff; }
.btn-success.btn-solid:hover, .btn-success.btn-solid:focus-visible { background-color: var(--bd-success-hover); color: #fff; }

/* Ghost action button (icon + label) */
.btn-action {
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: var(--bd-radius-pill) !important;
    padding: 7px 16px !important;
}
.btn-action:hover { background-color: var(--bd-hover) !important; color: inherit !important; }
.btn-action.text-danger:hover { background-color: rgba(220, 53, 69, 0.16) !important; color: var(--bd-danger) !important; }

/* Smaller buttons keep the pill */
.btn-sm { padding: 4px 12px; font-size: .88rem; }

/* Round icon-only button: <a class="btn btn-action bd-icon-btn"><i class="bi bi-search"></i></a> */
.bd-icon-btn {
    width: 38px; height: 38px; padding: 0 !important;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50% !important; flex-shrink: 0;
}
.bd-icon-btn.btn-sm { width: 32px; height: 32px; }

/* Buttons used as dropdown TRIGGERS keep the pill */
.dropdown-toggle.btn { border-radius: var(--bd-radius-pill); }


/* ==========================================================================
   6. FORMS + SEARCH INPUTS
   ========================================================================== */
input.form-control, select.form-select, textarea.form-control {
    background-color: var(--bd-input-bg); color: var(--bd-input-color); border-color: var(--bd-input-border);
}
input.form-control:focus, textarea.form-control:focus { background-color: var(--bd-input-bg); color: var(--bd-input-color); }

/* Pill search field with a leading icon.
   <form class="bd-search"><i class="bi bi-search"></i><input type="search" …></form> */
.bd-search { position: relative; display: flex; align-items: center; }
.bd-search > .bi {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--bd-muted); pointer-events: none; font-size: .95rem; line-height: 1;
}
.bd-search input {
    width: 100%; min-width: 0; height: 40px; padding: 0 16px 0 38px;
    border-radius: var(--bd-radius-pill); border: 1px solid transparent;
    background: rgba(125, 140, 160, 0.10); color: inherit;
    transition: border-color var(--bd-ease), background var(--bd-ease), box-shadow var(--bd-ease);
}
.bd-search input::placeholder { color: var(--bd-muted); }
.bd-search input:focus {
    outline: none; border-color: rgba(var(--bd-accent-rgb), 0.5);
    background: var(--bd-input-bg); box-shadow: 0 0 0 .2rem rgba(var(--bd-accent-rgb), 0.15);
}
/* Large variant with a submit button (hero, search pages) */
.bd-search-lg { gap: 8px; }
.bd-search-lg > .bi { left: 18px; font-size: 1.05rem; }
.bd-search-lg input {
    flex: 1; height: 52px; padding-left: 46px; font-size: 1.05rem;
    background: var(--bd-surface); border-color: var(--bd-border); box-shadow: var(--bd-shadow-sm);
}
.bd-search-lg .btn { height: 52px; padding-inline: 1.4rem; flex-shrink: 0; }
@media (max-width: 575px) {
    .bd-search-lg input { height: 46px; font-size: 1rem; }
    .bd-search-lg .btn { height: 46px; padding-inline: 1rem; }
}


/* ==========================================================================
   7. CARDS, TABLES, BADGES
   ========================================================================== */
.card { background-color: var(--bd-surface); border: none; }
[data-bs-theme="light"] .card, [data-bs-theme="light"] .bf-auth-card { background-color: #ffffff; border: 1px solid var(--bd-border); }

/* Generic surface card */
.bd-card {
    background: var(--bd-surface); border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius-md); padding: 20px;
}
.bd-card-title { font-weight: 600; margin-bottom: 1rem; }

.table th, .table td { border-color: var(--bd-border); }

/* Clean data table: uppercase headers, row hover */
.bd-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.bd-table th {
    text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--bd-muted); padding: 10px 12px; border-bottom: 1px solid var(--bd-border); white-space: nowrap;
}
.bd-table td { padding: 12px; border-bottom: 1px solid var(--bd-border); vertical-align: middle; }
.bd-table tbody tr { transition: background-color .12s; }
.bd-table tbody tr:hover { background: var(--bd-surface-sunken); }
.bd-table tr:last-child td { border-bottom: none; }


/* ==========================================================================
   8. DROPDOWNS — soft rounded card
   ========================================================================== */
.dropdown-menu {
    border: none;
    border-radius: var(--bd-radius-md);
    padding: 6px;
    box-shadow: var(--bd-shadow-menu);
    background-color: var(--bd-surface-2);
}
[data-bs-theme="light"] .dropdown-menu { background-color: #fff; }
.dropdown-item {
    color: var(--bd-text);
    border-radius: var(--bd-radius-sm);
    padding: 8px 12px;
    transition: background-color .12s ease;
}
.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--bd-hover);
    color: inherit;
}
[data-bs-theme="light"] .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-item:focus { color: #1a1a1a; }
.dropdown-divider { margin: 6px 4px; opacity: .35; }
.dropdown-header { padding: 8px 12px 4px; }
/* No caret on dropdown triggers anywhere in Bodek */
.dropdown-toggle::after { display: none !important; }


/* ==========================================================================
   9. MODALS + CLOSE BUTTON
   ========================================================================== */
.modal-content {
    border: none;
    border-radius: var(--bd-radius-lg);
    background-color: var(--bd-surface-modal);
    box-shadow: var(--bd-shadow-modal);
    overflow: hidden;
}
.modal-header { border: none; padding: 22px 24px 4px; background-color: transparent; }
.modal-title { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { padding: 14px 24px 18px; font-size: 0.95rem; background-color: transparent; }
.modal-body .form-label { font-size: 0.85rem; color: #aab; margin-bottom: 6px; }
[data-bs-theme="light"] .modal-body .form-label { color: #6b7280; }
.modal-footer { border: none; padding: 6px 18px 18px; gap: 8px; justify-content: flex-end; background-color: transparent; }
.modal-backdrop.show { opacity: .55; }

/* Inputs inside a modal: rounded, soft border, gentle focus glow */
.modal-content .form-control, .modal-content .form-select {
    border-radius: var(--bd-radius);
    padding: 11px 14px;
    border: 1px solid rgba(125, 140, 160, 0.25);
    background-color: rgba(125, 140, 160, 0.08);
    color: #e6e6e6;
    transition: border-color var(--bd-ease), box-shadow var(--bd-ease), background-color var(--bd-ease);
}
.modal-content .form-control:focus, .modal-content .form-select:focus {
    border-color: var(--accent, var(--bd-accent));
    background-color: rgba(125, 140, 160, 0.10);
    box-shadow: 0 0 0 3px rgba(var(--bd-accent-rgb), 0.18);
    outline: none;
}
.modal-content .form-control.is-invalid {
    border-color: var(--bd-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.18);
}
[data-bs-theme="light"] .modal-content .form-control,
[data-bs-theme="light"] .modal-content .form-select {
    background-color: #f6f7f9;
    border-color: rgba(15, 23, 42, 0.12);
    color: #1a1a1a;
}
[data-bs-theme="light"] .modal-content .form-control:focus,
[data-bs-theme="light"] .modal-content .form-select:focus { background-color: #fff; }

/* Close button: icon-circle treatment */
.btn-close {
    width: 28px; height: 28px; padding: 0; margin: 0;
    background-image: none; background-color: transparent;
    border-radius: 50%; opacity: 1;
    display: inline-flex; align-items: center; justify-content: center;
    position: relative;
    transition: background-color var(--bd-ease);
}
.btn-close::before {
    content: ""; display: block; width: 12px; height: 12px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M2.146 2.854a.5.5 0 01.708 0L8 7.293l5.146-5.147a.5.5 0 11.708.708L8.707 8l5.147 5.146a.5.5 0 11-.708.708L8 8.707l-5.146 5.147a.5.5 0 11-.708-.708L7.293 8 2.146 2.854a.5.5 0 010-.708z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M2.146 2.854a.5.5 0 01.708 0L8 7.293l5.146-5.147a.5.5 0 11.708.708L8.707 8l5.147 5.146a.5.5 0 11-.708.708L8 8.707l-5.146 5.147a.5.5 0 11-.708-.708L7.293 8 2.146 2.854a.5.5 0 010-.708z'/></svg>") center / contain no-repeat;
    color: #aab;
}
.btn-close:hover { background-color: var(--bd-hover); }
.btn-close:hover::before { color: #fff; }
[data-bs-theme="light"] .btn-close::before { color: #6b7280; }
[data-bs-theme="light"] .btn-close:hover { background-color: rgba(15, 23, 42, 0.07); }
[data-bs-theme="light"] .btn-close:hover::before { color: #1a1a1a; }


/* ==========================================================================
   10. CALLOUTS + TOASTS
   ========================================================================== */
.bd-callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; margin: 1rem 0;
    border-radius: var(--bd-radius); border: 1px solid var(--bd-border-soft);
    border-left: 4px solid var(--bd-brand); background: rgba(var(--bd-brand-rgb), 0.07);
}
.bd-callout > .bi { font-size: 1.2rem; color: var(--bd-brand); line-height: 1.4; }
.bd-callout-warning { border-left-color: var(--bd-warning); background: rgba(255, 193, 7, 0.08); }
.bd-callout-warning > .bi { color: #d19a00; }
.bd-callout-danger  { border-left-color: var(--bd-danger); background: rgba(220, 53, 69, 0.07); }
.bd-callout-danger > .bi { color: var(--bd-danger); }
.bd-callout-success { border-left-color: var(--bd-success); background: rgba(25, 135, 84, 0.08); }
.bd-callout-success > .bi { color: var(--bd-success); }

/* Toast stack (bottom-right) */
.bd-toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 1090; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.bd-toast {
    background: var(--bd-surface-modal); color: var(--bd-text);
    border: 1px solid var(--bd-border-soft); border-left: 3px solid var(--bd-success);
    border-radius: var(--bd-radius-sm); padding: 11px 16px; font-size: .9rem; box-shadow: var(--bd-shadow);
}


/* ==========================================================================
   11. PAGE BUILDING BLOCKS
   ========================================================================== */
.bd-page { padding-top: 28px; }
.bd-section { margin-top: 2.5rem; }
.bd-h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; letter-spacing: -.01em; color: var(--bd-text); }
.bd-kicker { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bd-muted); }

/* Hero band with a soft brand glow */
.bd-hero {
    padding: 4rem 0 3rem; text-align: center;
    background: radial-gradient(1200px 320px at 50% 0, rgba(var(--bd-brand-rgb), .16), transparent);
}
.bd-hero h1 { font-weight: 700; font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.02em; margin-bottom: .5rem; }
.bd-hero .bd-hero-lead { max-width: 640px; margin: 0 auto; font-size: 1.08rem; color: var(--bd-muted); }
.bd-hero .bd-search { max-width: 640px; margin: 1.75rem auto 0; }
@media (max-width: 575px) { .bd-hero { padding: 2.5rem 0 2rem; } }

/* Breadcrumbs */
.bd-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: .88rem; }
.bd-crumbs li { color: var(--bd-muted); min-width: 0; }
.bd-crumbs li + li::before { content: "\203A"; margin-right: .35rem; opacity: .7; }
.bd-crumbs a { color: var(--bd-muted); text-decoration: none; }
.bd-crumbs a:hover { color: var(--bd-text); text-decoration: underline; }

/* Page title row with a mark */
.bd-page-head { display: flex; gap: 16px; align-items: center; margin-bottom: 1.75rem; }
.bd-page-head h1 { font-weight: 700; margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.02em; }
.bd-page-head p { color: var(--bd-muted); margin: .25rem 0 0; }
.bd-page-icon { font-size: 2.2rem; color: var(--bd-brand); line-height: 1; }

/* Clickable tiles in a responsive grid */
.bd-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.bd-tile {
    display: flex; flex-direction: column; gap: 6px; padding: 20px;
    border: 1px solid var(--bd-border); border-radius: var(--bd-radius-md);
    background: var(--bd-surface); color: inherit !important; text-decoration: none !important;
    transition: border-color var(--bd-ease), transform var(--bd-ease), box-shadow var(--bd-ease);
}
.bd-tile:hover, .bd-tile:focus-visible { border-color: rgba(var(--bd-brand-rgb), .7); transform: translateY(-2px); box-shadow: var(--bd-shadow); outline: none; }
.bd-tile > .bi { font-size: 1.5rem; color: var(--bd-brand); line-height: 1; }
.bd-tile .bd-mark { margin-bottom: 6px; }
.bd-tile-title { font-weight: 700; font-size: 1.02rem; }
.bd-tile-desc { color: var(--bd-muted); font-size: .9rem; flex: 1; line-height: 1.45; }
.bd-tile-meta { color: var(--bd-muted); font-size: .8rem; }

/* Linked list inside one card */
.bd-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--bd-border); border-radius: var(--bd-radius-md); background: var(--bd-surface); overflow: hidden; }
.bd-list > li { margin: 0; }
.bd-list > li + li { border-top: 1px solid var(--bd-border); }
.bd-list a { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; color: inherit; text-decoration: none; transition: background-color .12s; }
.bd-list a:hover, .bd-list a:focus-visible { background: rgba(var(--bd-brand-rgb), .07); text-decoration: none; outline: none; }
.bd-list-title { font-weight: 600; color: var(--bd-link); }
.bd-list-sum { color: var(--bd-muted); font-size: .9rem; line-height: 1.45; }
.bd-list-compact a { padding: 11px 16px; }

/* Side panel (table of contents, related links) */
.bd-aside { border: 1px solid var(--bd-border); border-radius: var(--bd-radius-md); background: var(--bd-surface); padding: 16px 18px; }
.bd-aside + .bd-aside { margin-top: 16px; }
.bd-aside-title { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bd-muted); margin-bottom: .6rem; }


/* ==========================================================================
   12. EMPTY STATES
   ========================================================================== */
.bd-empty { text-align: center; padding: 3.5rem 1rem; }
.bd-empty > .bi { display: inline-block; font-size: 2.6rem; color: var(--bd-muted); opacity: .8; margin-bottom: .5rem; }
.bd-empty-inline {
    text-align: center; padding: 2rem 1.25rem; color: var(--bd-muted);
    border: 1px dashed var(--bd-border); border-radius: var(--bd-radius-md);
}
.bd-empty-inline p { color: var(--bd-muted); }
.bd-empty-inline > .bi { display: block; font-size: 2rem; margin-bottom: .5rem; }


/* ==========================================================================
   13. FOOTER
   ========================================================================== */
.bd-footer {
    border-top: 1px solid var(--bd-border); margin-top: 4rem; padding: 1.5rem 0;
    color: var(--bd-muted); font-size: .88rem; flex-shrink: 0;
}
.bd-footer a { color: var(--bd-muted); text-decoration: none; }
.bd-footer a:hover { color: var(--bd-text); text-decoration: underline; }
.bd-footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }

/* Sticky-footer page shell: <body class="bd-shell"> … <main> … <footer class="bd-footer"> */
.bd-shell { display: flex; flex-direction: column; min-height: 100vh; }
.bd-shell > main { flex: 1 0 auto; }


/* ==========================================================================
   14. PROSE — long-form article typography (help articles, docs, previews)
   <div class="bd-prose"> rendered Markdown </div>
   ========================================================================== */
.bd-prose { font-size: 1.04rem; line-height: 1.72; color: var(--bd-text); overflow-wrap: break-word; }
.bd-prose > :first-child { margin-top: 0; }
.bd-prose :is(p, li, td, th, h2, h3, h4, h5, h6, small, label) { color: inherit; }
.bd-prose :is(p, ul, ol, dl, table, pre, blockquote, figure) { margin: 0 0 1.1rem; }
.bd-prose h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; margin: 2.4rem 0 .8rem; scroll-margin-top: 96px; }
.bd-prose h3 { font-size: 1.15rem; font-weight: 700; margin: 1.8rem 0 .6rem; scroll-margin-top: 96px; }
.bd-prose h4 { font-size: 1rem; font-weight: 700; margin: 1.4rem 0 .5rem; scroll-margin-top: 96px; }
.bd-prose h2 + h3 { margin-top: 1rem; }
.bd-prose a { color: var(--bd-link); text-decoration: underline; text-decoration-color: rgba(var(--bd-link-rgb), .4); text-underline-offset: 3px; }
.bd-prose a:hover { text-decoration-color: currentColor; }
.bd-prose strong { font-weight: 700; }
.bd-prose ul, .bd-prose ol { padding-left: 1.5rem; }
.bd-prose li { margin: .3rem 0; padding-left: .2rem; }
.bd-prose li > ul, .bd-prose li > ol, .bd-prose li > p { margin: .3rem 0; }
.bd-prose ul > li::marker { color: var(--bd-brand); }
.bd-prose ol > li::marker { color: var(--bd-muted); font-weight: 700; }
.bd-prose hr { border: 0; border-top: 1px solid var(--bd-border); margin: 2rem 0; opacity: 1; }
.bd-prose img { max-width: 100%; height: auto; border-radius: var(--bd-radius); border: 1px solid var(--bd-border); display: block; margin: 1.25rem 0; }
.bd-prose code {
    font-family: var(--bd-font-mono); font-size: .88em;
    background: var(--bd-code-bg); color: inherit; padding: .12rem .4rem; border-radius: var(--bd-radius-xs);
    overflow-wrap: anywhere;
}
.bd-prose pre {
    background: var(--bd-surface); border: 1px solid var(--bd-border); border-radius: var(--bd-radius);
    padding: 14px 16px; overflow-x: auto; font-size: .88rem; line-height: 1.55;
}
.bd-prose pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.bd-prose kbd {
    font-family: var(--bd-font-mono); font-size: .82em; color: inherit;
    background: var(--bd-surface); border: 1px solid var(--bd-border); border-bottom-width: 2px;
    border-radius: var(--bd-radius-xs); padding: .06rem .42rem; box-shadow: none;
}
.bd-prose table {
    width: 100%; border-collapse: separate; border-spacing: 0; font-size: .94rem;
    border: 1px solid var(--bd-border); border-radius: var(--bd-radius); overflow: hidden;
}
.bd-prose thead th { background: var(--bd-surface-sunken); font-weight: 700; text-align: left; }
.bd-prose th, .bd-prose td { padding: .6rem .85rem; vertical-align: top; border-bottom: 1px solid var(--bd-border); }
.bd-prose th + th, .bd-prose td + td { border-left: 1px solid var(--bd-border); }
.bd-prose tbody tr:last-child td { border-bottom: 0; }
/* Blockquote = callout */
.bd-prose blockquote {
    padding: 12px 16px; margin: 1.25rem 0;
    border: 1px solid var(--bd-border-soft); border-left: 4px solid var(--bd-brand);
    border-radius: var(--bd-radius); background: rgba(var(--bd-brand-rgb), .07); color: inherit;
}
.bd-prose blockquote > :last-child { margin-bottom: 0; }
@media (max-width: 575px) {
    .bd-prose { font-size: 1rem; line-height: 1.68; }
    .bd-prose h2 { font-size: 1.25rem; margin-top: 2rem; }
}
@media (max-width: 767px) {
    /* wide tables scroll sideways instead of breaking the layout */
    .bd-prose table { display: block; overflow-x: auto; width: auto; max-width: 100%; }
}


/* ==========================================================================
   15. SETTINGS LAYOUT + BACK BUTTON (accounts, files, forms)
   Left tabs on desktop, drill-down on mobile.
   ========================================================================== */
.settings-layout { display: flex; gap: 28px; align-items: flex-start; }
.settings-tabs { flex: 0 0 220px; flex-direction: column; gap: 4px; position: sticky; top: 80px; }
.settings-tabs .nav-link { text-align: left; color: var(--text, #ddd); border-radius: 10px; display: flex; align-items: center; }
.settings-tabs .nav-link .drill-caret { display: none; margin-left: auto; }
.settings-panes { flex: 1; min-width: 0; }
.btn-back.settings-back { display: none; }

/* Icon-only back button with a hover circle. */
.btn-back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border: none; background: transparent;
    color: var(--text, #ddd); border-radius: 50%; cursor: pointer;
    transition: background var(--bd-ease), color var(--bd-ease); flex-shrink: 0;
}
.btn-back i { font-size: 1.25rem; line-height: 1; }
.btn-back:hover, .btn-back:focus-visible { background: rgba(125,140,160,0.18); color: var(--text, #fff); outline: none; }
[data-bs-theme="light"] .btn-back { color: #333; }
[data-bs-theme="light"] .btn-back:hover { background: rgba(0,0,0,0.07); }
/* Keep .btn-back a 40x40 circle even with the .btn pill rules. */
.btn-back, button.btn-back, a.btn-back {
    width: 40px !important; height: 40px !important; padding: 0 !important;
    border-radius: 50% !important;
}

@media (max-width: 767px) {
    .settings-layout { flex-direction: column; gap: 0; }
    .settings-tabs { flex-basis: auto; width: 100%; position: static; }
    .settings-tabs .nav-link {
        display: flex; align-items: center;
        padding: 14px 16px; border-bottom: 0; border-radius: 10px;
        margin-bottom: 4px; font-size: 1.08rem;
    }
    .settings-tabs .nav-link i:first-child { font-size: 1.4rem; margin-right: 6px; }
    .settings-tabs .nav-link .drill-caret { display: inline; color: #889; font-size: 1.1rem; }
    .settings-tabs .nav-link.active { background: transparent; color: var(--text, #ddd); }
    .settings-panes { width: 100%; }
    /* Default (list) view: show tabs, hide panes */
    .settings-panes section[data-pane] { display: none !important; }
    /* Drill-in view: hide the list, show the active pane + back button */
    .settings-layout.drill-in .settings-tabs { display: none; }
    .settings-layout.drill-in .settings-panes section[data-pane]:not(.d-none) { display: block !important; }
    .settings-layout.drill-in .btn-back.settings-back { display: inline-flex; margin-bottom: 16px; }
    .settings-page-title { font-size: 1.5rem; }
    .container.settings-container { padding-bottom: 40px; }
    .member-row { flex-wrap: wrap; }
    .member-actions { width: 100%; }
}


/* ==========================================================================
   16. SHARED PRODUCT COMPONENTS
   ========================================================================== */
/* ---- Header search (files, forms) */
.bf-header-search { min-width: 0; }
.bf-search-wrap { position: relative; }
.bf-search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--bs-secondary-color, #8a94a6); font-size: 0.95rem; pointer-events: none;
}
.bf-search-input {
    height: 40px; border-radius: var(--bd-radius-pill); padding-left: 38px; padding-right: 36px;
    background: rgba(125, 140, 160, 0.10);
    border: 1px solid transparent; transition: border-color .15s, background .15s, box-shadow .15s;
}
/* Suppress the native clear button so our X and the platform X don't stack. */
.bf-search-input::-webkit-search-cancel-button,
.bf-search-input::-webkit-search-decoration,
.bf-search-input::-webkit-search-results-button,
.bf-search-input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.bf-search-input::-ms-clear { display: none; width: 0; height: 0; }
.bf-search-input::placeholder { color: var(--bs-secondary-color, #8a94a6); }
.bf-search-input:focus {
    background: var(--bs-body-bg, #fff); border-color: rgba(13, 110, 253, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15); outline: none;
}
[data-bs-theme="dark"] .bf-search-input:focus { background: rgba(125,140,160,0.18); }
.bf-search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: var(--bs-secondary-color, #8a94a6);
    padding: 6px 8px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.bf-search-clear:hover { background: rgba(125, 140, 160, 0.15); }
.bf-search-suggest {
    width: 100%; margin-top: 4px; max-height: 320px; overflow-y: auto;
    padding: 4px 0; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.bf-search-suggest.show { display: block; }
.bf-search-suggest .suggest-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
    cursor: pointer; color: inherit; text-decoration: none; font-size: 0.92rem;
}
.bf-search-suggest .suggest-item:hover, .bf-search-suggest .suggest-item.active { background: rgba(125,140,160,0.12); }
.bf-search-suggest .suggest-header {
    display:flex; justify-content:space-between; align-items:center;
    padding: 6px 14px; color: var(--bs-secondary-color,#8a94a6);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em;
}
.bf-search-suggest .suggest-clear { font-size: 0.7rem; }
@media (max-width: 575px) {
    .bf-search-input { height: 36px; font-size: 0.92rem; }
    .bf-header-search { max-width: 100% !important; }
    .bf-navbar .navbar-brand img { max-height: 24px; }
}
@media (max-width: 767px) {
    .bf-search-suggest .suggest-item { font-size: 1rem; padding: 12px 16px; }
    .bf-search-suggest .suggest-header { font-size: 0.85rem; padding: 10px 16px 4px; }
}

/* ---- Storage backend picker tiles (files + forms settings) */
.bf-backend-tile {
    display: flex; align-items: center; gap: 14px;
    width: 100%; text-align: left;
    padding: 14px 16px; border-radius: 10px;
    background: rgba(125, 140, 160, 0.08);
    border: 2px solid transparent;
    cursor: pointer; transition: background .12s, border-color .12s;
}
.bf-backend-tile:hover { background: rgba(125, 140, 160, 0.15); }
.bf-backend-tile.selected {
    background: rgba(13, 110, 253, 0.15);
    border-color: rgba(13, 110, 253, 0.5);
}
.bf-backend-tile > i { font-size: 1.6rem; color: var(--accent, #0d6efd); flex-shrink: 0; }
.bf-backend-name { font-weight: 600; }
.bf-backend-desc { font-size: 0.85rem; color: var(--bs-secondary-color, #8a94a6); margin-top: 2px; }
.bf-backend-tile .bf-backend-img,
.bf-backend-icon-lg .bf-backend-img {
    height: 1.6rem; width: auto; max-width: 2.4rem;
    object-fit: contain; flex-shrink: 0;
}
.bf-backend-icon-lg { display: inline-flex; align-items: center; font-size: 1.5rem; }
.bf-backend-icon-lg i { font-size: 1.5rem; color: var(--accent, #0d6efd); }


/* ==========================================================================
   17. UTILITIES
   ========================================================================== */
.bd-muted { color: var(--bd-muted) !important; }
.bd-brand-text { color: var(--bd-brand) !important; }
.bd-narrow { max-width: 860px; }
.bd-prose-width { max-width: var(--bd-prose-max); }
.bd-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bd-skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 1100; background: var(--bd-surface); padding: .4rem .7rem; border-radius: 8px; }
.bd-scroll-x { overflow-x: auto; scrollbar-width: none; }
.bd-scroll-x::-webkit-scrollbar { display: none; }
