/* ---------------------------------------------------------------------------
 * Api2Pdf application stylesheet
 *
 * Layered on top of Bootstrap 5 + Bootstrap Icons. Uses CSS custom properties
 * as design tokens so component overrides stay readable. No legacy frameworks
 * (font-awesome, simple-line-icons, bootstrap-social, custom credit-card-form
 * stack) — those have been removed.
 * --------------------------------------------------------------------------- */

:root {
    /* Brand */
    --ap-primary: #2563eb;
    --ap-primary-hover: #1d4ed8;
    --ap-primary-soft: #eff6ff;

    /* Wordmark accent: the canonical "PDF" cyan in the api2PDF mark.
     * Intentionally separate from --ap-primary so links/buttons stay
     * the brand blue while only the "PDF" half of the wordmark is cyan. */
    --ap-brand-accent: #00a3cf;

    /* Neutrals */
    --ap-bg: #e7ecf4;
    --ap-bg-subtle: #eef2f8;
    --ap-surface: #ffffff;
    --ap-border: #d8dfea;
    --ap-border-strong: #c2cad6;
    --ap-text: #14213d;
    --ap-text-muted: #5b6b85;

    /* Sidebar */
    --ap-sidebar-bg: #0f172a;
    --ap-sidebar-bg-hover: rgba(255, 255, 255, 0.08);
    --ap-sidebar-bg-active: rgba(37, 99, 235, 0.18);
    --ap-sidebar-text: #c5cfdf;
    --ap-sidebar-text-active: #ffffff;

    /* Effects */
    --ap-radius: 0.75rem;
    --ap-radius-sm: 0.5rem;
    --ap-radius-lg: 1rem;
    --ap-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.04);
    --ap-shadow: 0 6px 20px -4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
    --ap-shadow-lg: 0 24px 50px -12px rgba(15, 23, 42, 0.18);

    /* Bootstrap variable overrides */
    --bs-primary: var(--ap-primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: var(--ap-primary);
    --bs-link-hover-color: var(--ap-primary-hover);
    --bs-body-color: var(--ap-text);
    --bs-body-bg: var(--ap-bg);
    --bs-border-color: var(--ap-border);
    --bs-border-radius: var(--ap-radius-sm);
}

/* --- Reset / typography ---------------------------------------------------- */

html, body {
    height: 100%;
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--ap-bg);
    color: var(--ap-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ap-text);
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.btn,
a.nav-link,
a.dropdown-item,
a.list-group-item,
a.alert-link,
a.page-link {
    text-decoration: none;
}

a.btn:hover,
a.nav-link:hover,
a.dropdown-item:hover,
a.list-group-item:hover,
a.alert-link:hover,
a.page-link:hover {
    text-decoration: none;
}

/* --- App shell ------------------------------------------------------------- */

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

.api2pdf-content {
    min-width: 0;
    background: var(--ap-bg);
}

/* --- Sidebar --------------------------------------------------------------- */

.api2pdf-sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: var(--ap-sidebar-bg);
    color: var(--ap-sidebar-text);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.25rem 1rem;
}

.api2pdf-sidebar .brand-mark {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.25rem 0.5rem 1.5rem;
    text-decoration: none;
}

.api2pdf-sidebar .brand-mark img {
    max-height: 32px;
    width: auto;
}

/* --- Brand wordmark ------------------------------------------------------- */

.brand-text {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    line-height: 1;
    text-decoration: none;
}

.brand-text:hover,
.brand-text:focus {
    text-decoration: none;
}

/* Default: dark "api2" + red "PDF" matching the canonical brand mark
 * (renders on the white topbar, offcanvas, and public auth shell). */
.brand-text .brand-text-base {
    color: var(--ap-text);
}

.brand-text .brand-text-accent {
    color: var(--ap-brand-accent);
}

.brand-text-topbar {
    font-size: 1.25rem;
}

/* Dark sidebar override: invert "api2" to white so it stays legible
 * on the navy background. "PDF" stays cyan against the dark bg.
 * The gap:0 is critical -- the parent .brand-mark sets gap:0.625rem
 * for the legacy image+text layout, which pulls the two wordmark
 * spans apart and reads as "api2 PDF" instead of "api2PDF". */
.api2pdf-sidebar .brand-mark.brand-text {
    padding: 0.25rem 0.5rem 1.5rem;
    display: inline-flex;
    gap: 0;
}

.api2pdf-sidebar .brand-text .brand-text-base {
    color: #ffffff;
}

.auth-brand.brand-text {
    font-size: 1.75rem;
    text-align: center;
    display: block;
}

/* Same gap-zeroing for the public auth shell -- .auth-brand inherits
 * gap:0.5rem from .auth-card .auth-brand for the old logo+text layout. */
.auth-card .auth-brand.brand-text {
    gap: 0;
    justify-content: center;
}

.api2pdf-sidebar .nav-link {
    color: var(--ap-sidebar-text);
    border-radius: var(--ap-radius-sm);
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.125rem;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.api2pdf-sidebar .nav-link i.bi {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.api2pdf-sidebar .nav-link:hover {
    color: var(--ap-sidebar-text-active);
    background: var(--ap-sidebar-bg-hover);
}

.api2pdf-sidebar .nav-link.active {
    color: var(--ap-sidebar-text-active);
    background: var(--ap-sidebar-bg-active);
}

.api2pdf-sidebar .nav-link.active i.bi {
    opacity: 1;
}

.api2pdf-sidebar .sidebar-section {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem 0.75rem 0.5rem;
}

.api2pdf-sidebar .sub-nav {
    padding-left: 1.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    margin-left: 1rem;
}

.api2pdf-sidebar .sub-nav .nav-link {
    font-size: 0.875rem;
    padding: 0.4rem 0.625rem;
    color: rgba(255, 255, 255, 0.7);
    gap: 0;
}

.api2pdf-sidebar .sub-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.06);
}

/* --- Topbar ---------------------------------------------------------------- */

.api2pdf-topbar {
    background: var(--ap-surface);
    border-bottom: 1px solid var(--ap-border);
    padding: 0.625rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 64px;
}

.api2pdf-topbar .topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.api2pdf-topbar .balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: var(--ap-primary-soft);
    color: var(--ap-primary-hover);
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    transition: filter 0.15s ease;
}

.api2pdf-topbar .balance-pill:hover {
    filter: brightness(0.97);
    text-decoration: none;
}

.api2pdf-topbar .balance-pill.balance-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: rgba(180, 83, 9, 0.24);
}

.api2pdf-topbar .balance-pill.balance-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: rgba(153, 27, 27, 0.24);
}

.api2pdf-topbar .user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem 0.375rem 0.375rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--ap-text);
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.api2pdf-topbar .user-menu-toggle:hover,
.api2pdf-topbar .user-menu-toggle[aria-expanded="true"] {
    background: var(--ap-bg);
    border-color: var(--ap-border);
}

.api2pdf-topbar .user-menu-toggle::after {
    margin-left: 0.25rem;
}

.api2pdf-topbar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.api2pdf-topbar .topbar-user-name {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .api2pdf-topbar {
        padding: 0.5rem 1rem;
        min-height: 56px;
    }

    .api2pdf-topbar .topbar-user-name {
        display: none;
    }
}

/* --- Main content area ----------------------------------------------------- */

.api2pdf-main {
    padding: 1.75rem 1.75rem 2.5rem;
}

@media (max-width: 575.98px) {
    .api2pdf-main {
        padding: 1rem 1rem 2rem;
    }
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-header .page-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.page-header .page-subtitle {
    color: var(--ap-text-muted);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

.page-header .page-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 575.98px) {
    .page-header .page-actions {
        margin-left: 0;
        width: 100%;
    }

    .page-header .page-actions > .btn {
        flex: 1 1 auto;
    }
}

/* --- Cards ----------------------------------------------------------------- */

.card {
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    box-shadow: var(--ap-shadow);
}

.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ap-border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card .card-header .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card .card-header .card-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 575.98px) {
    .card .card-header .card-actions {
        margin-left: 0;
        width: 100%;
    }

    .card .card-header .card-actions > .btn {
        flex: 1 1 auto;
    }
}

.card .card-body {
    padding: 1.25rem;
}

.card .card-footer {
    background: transparent;
    border-top: 1px solid var(--ap-border);
    padding: 0.875rem 1.25rem;
}

/* Stat / metric card variant. */
.stat-card {
    height: 100%;
}

.stat-card .stat-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ap-text-muted);
    margin-bottom: 0.375rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
    margin: 0;
}

.stat-card .stat-meta {
    color: var(--ap-text-muted);
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

/* --- Tables ---------------------------------------------------------------- */

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    table-layout: auto;
}

.table > :not(caption) > * > * {
    padding: 0.875rem 1rem;
}

.table thead th {
    background: var(--ap-bg-subtle);
    color: var(--ap-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    border-bottom: 1px solid var(--ap-border);
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--ap-border);
}

.table tbody tr:last-child {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: rgba(15, 23, 42, 0.02);
}

.table .actions-col {
    width: 1%;
    white-space: nowrap;
    text-align: end;
}

/* Wide list tables (eg. /admin/customers, /admin/permissions) opt in to a
 * truncating layout instead of horizontal scroll. The fixed table-layout
 * lets us cap individual column widths via a <colgroup>, and truncate-cell
 * clips the cell content with an ellipsis so long names / emails never
 * push the table beyond its container. Pair with <div class="table-fluid">
 * in place of <div class="table-responsive">.
 *
 * Important: keep the td as display: table-cell. Forcing display: block
 * here removes the cell from the table flow and stacks every truncated
 * column vertically. */
.table-fluid {
    width: 100%;
    overflow: hidden;
}

.table-fluid > .table {
    table-layout: fixed;
    width: 100%;
}

.table-fluid .truncate-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* When a table sits directly inside .card-body p-0 it should round into the card. */
.card-body.p-0 > .table-responsive:first-child:last-child .table,
.card-body.p-0 > .table:first-child:last-child {
    margin-bottom: 0;
}

/* --- Forms ----------------------------------------------------------------- */

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ap-text);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    background-color: var(--ap-surface);
    border-color: var(--ap-border-strong);
    border-radius: var(--ap-radius-sm);
    padding: 0.5rem 0.75rem;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--ap-bg-subtle);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--ap-surface);
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-group .input-group-text {
    background: var(--ap-surface);
    border-color: var(--ap-border-strong);
    color: var(--ap-text-muted);
}

.form-section + .form-section {
    margin-top: 1.5rem;
}

.form-section-title {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ap-text-muted);
    margin-bottom: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.25rem;
}

.form-actions .form-actions-spacer {
    flex: 1 1 auto;
}

@media (max-width: 575.98px) {
    .form-actions > .btn,
    .form-actions > form > .btn {
        flex: 1 1 100%;
    }

    .form-actions .form-actions-spacer {
        display: none;
    }
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
    font-weight: 500;
    border-radius: var(--ap-radius-sm);
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--ap-primary);
    --bs-btn-border-color: var(--ap-primary);
    --bs-btn-hover-bg: var(--ap-primary-hover);
    --bs-btn-hover-border-color: var(--ap-primary-hover);
    --bs-btn-active-bg: var(--ap-primary-hover);
    --bs-btn-active-border-color: var(--ap-primary-hover);
    --bs-btn-disabled-bg: var(--ap-primary);
    --bs-btn-disabled-border-color: var(--ap-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--ap-primary);
    --bs-btn-border-color: var(--ap-primary);
    --bs-btn-hover-bg: var(--ap-primary);
    --bs-btn-hover-border-color: var(--ap-primary);
    --bs-btn-active-bg: var(--ap-primary-hover);
    --bs-btn-active-border-color: var(--ap-primary-hover);
}

.btn-light {
    --bs-btn-bg: var(--ap-surface);
    --bs-btn-border-color: var(--ap-border-strong);
    --bs-btn-hover-bg: var(--ap-bg);
    --bs-btn-hover-border-color: var(--ap-border-strong);
    --bs-btn-active-bg: var(--ap-bg);
    --bs-btn-active-border-color: var(--ap-border-strong);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-link {
    --bs-btn-color: var(--ap-primary);
    --bs-btn-hover-color: var(--ap-primary-hover);
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    text-decoration: none;
}

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

/* OAuth provider buttons (replaces deleted bootstrap-social.css). */
.btn-oauth {
    background: var(--ap-surface);
    border: 1px solid var(--ap-border-strong);
    color: var(--ap-text);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--ap-radius-sm);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-oauth:hover {
    background: var(--ap-bg);
    border-color: var(--ap-border-strong);
    text-decoration: none;
}

.btn-oauth i.bi {
    font-size: 1.125rem;
}

.btn-oauth.btn-oauth-github i.bi {
    color: #24292f;
}

.btn-oauth.btn-oauth-google i.bi {
    color: #ea4335;
}

/* --- Badges ---------------------------------------------------------------- */

.badge {
    border-radius: 999px;
    padding: 0.35em 0.65em;
    font-weight: 500;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.badge-status::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* --- Pagination ------------------------------------------------------------ */

.pagination {
    --bs-pagination-color: var(--ap-text);
    --bs-pagination-bg: transparent;
    --bs-pagination-border-color: var(--ap-border);
    --bs-pagination-hover-bg: var(--ap-bg);
    --bs-pagination-hover-border-color: var(--ap-border);
    --bs-pagination-active-bg: var(--ap-primary);
    --bs-pagination-active-border-color: var(--ap-primary);
    --bs-pagination-border-radius: var(--ap-radius-sm);
    margin: 1rem 0 0;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: var(--ap-radius-sm) !important;
    border: 1px solid var(--ap-border);
    margin: 0;
}

/* --- Alerts ---------------------------------------------------------------- */

.alert {
    border-radius: var(--ap-radius);
    border: 1px solid transparent;
}

.alert-warning {
    background: #fef3c7;
    border-color: rgba(180, 83, 9, 0.18);
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border-color: rgba(153, 27, 27, 0.18);
    color: #991b1b;
}

.impersonation-banner {
    border-left: 4px solid #f59e0b;
    margin-bottom: 1.25rem;
}

/* --- Modals ---------------------------------------------------------------- */

.modal-content {
    border-radius: var(--ap-radius);
    border: 1px solid var(--ap-border);
    box-shadow: var(--ap-shadow-lg);
}

.modal-header {
    border-bottom-color: var(--ap-border);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top-color: var(--ap-border);
    padding: 0.875rem 1.25rem;
    gap: 0.5rem;
}

/* --- Tabs ------------------------------------------------------------------ */

.nav-tabs {
    border-bottom: 1px solid var(--ap-border);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.625rem 0.25rem;
    color: var(--ap-text-muted);
    font-weight: 500;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
    color: var(--ap-text);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--ap-primary);
    background: transparent;
    border-color: var(--ap-primary);
}

/* --- List groups (used as side rails on admin detail views) ---------------- */

.list-group-item-action {
    border-color: var(--ap-border);
    color: var(--ap-text);
}

.list-group-item-action.active {
    background: var(--ap-primary);
    border-color: var(--ap-primary);
}

.list-group-item-action button {
    background: none;
    border: none;
}

/* --- Toasts ---------------------------------------------------------------- */

.toast-container {
    z-index: 1200;
}

/* --- Public auth shell ----------------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    background:
        radial-gradient(ellipse at top left, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(99, 102, 241, 0.16), transparent 55%),
        #0f172a;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--ap-surface);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow-lg);
    padding: 2.25rem;
}

.auth-card .auth-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.auth-card .auth-brand img {
    height: 32px;
}

.auth-card h1.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-card .auth-subtitle {
    color: var(--ap-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.auth-card .auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--ap-text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 1.5rem 0 1rem;
}

.auth-card .auth-divider::before,
.auth-card .auth-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--ap-border);
}

.auth-card .auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--ap-text-muted);
    font-size: 0.875rem;
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 1.5rem;
        border-radius: var(--ap-radius);
    }
}

/* --- Mobile offcanvas (sidebar mirror) ------------------------------------ */

.offcanvas.offcanvas-sidebar {
    background: var(--ap-sidebar-bg);
    color: var(--ap-sidebar-text);
    width: 280px;
}

.offcanvas.offcanvas-sidebar .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.offcanvas.offcanvas-sidebar .offcanvas-title {
    color: #fff;
}

.offcanvas.offcanvas-sidebar .btn-close {
    filter: invert(1) grayscale(100%) brightness(2);
}

.offcanvas.offcanvas-sidebar .nav-link {
    color: var(--ap-sidebar-text);
    border-radius: var(--ap-radius-sm);
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.offcanvas.offcanvas-sidebar .nav-link i.bi {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.offcanvas.offcanvas-sidebar .nav-link:hover,
.offcanvas.offcanvas-sidebar .nav-link.active {
    color: #fff;
    background: var(--ap-sidebar-bg-hover);
}

.offcanvas.offcanvas-sidebar .sidebar-section {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem 0.75rem 0.5rem;
}

/* --- htmx loading indicator ------------------------------------------------ */

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
    align-items: center;
}

/* --- Misc small helpers ---------------------------------------------------- */

.kbd-key {
    display: inline-block;
    padding: 0.1em 0.45em;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.8em;
    color: var(--ap-text);
    background: var(--ap-bg);
    border: 1px solid var(--ap-border);
    border-radius: 0.375rem;
}

.copy-target {
    font-family: ui-monospace, SFMono-Regular, monospace;
    background: var(--ap-bg);
    border: 1px solid var(--ap-border);
    padding: 0.1em 0.5em;
    border-radius: 0.375rem;
    font-size: 0.875em;
    word-break: break-all;
}

/* Reset legacy global utilities used in old views so they no longer break BS5. */
.float-right { float: right !important; }
.float-left { float: left !important; }
