:root {
    --rd-primary: #3F51B5;
    --rd-primary-2: #005f99;
    --rd-primary-dark: #003366;
    --rd-bg: #f5f8ff;
    --rd-surface: #ffffff;
    --rd-surface-2: #eef5ff;
    --rd-text: #0f172a;
    --rd-muted: #64748b;
    --rd-border: rgba(15, 23, 42, .10);
    --rd-danger: #dc2626;
    --rd-success: #16a34a;
    --rd-warning: #d97706;
    --rd-radius-sm: 12px;
    --rd-radius: 18px;
    --rd-radius-lg: 26px;
    --rd-shadow: 0 18px 48px rgba(15, 23, 42, .08);
    --rd-shadow-soft: 0 10px 28px rgba(15, 23, 42, .06);
    --rd-sidebar-width: 286px;
    --rd-header-height: 72px;
    --rd-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --rd-font-size:14px; --rd-heading-scale:1.22; --rd-text-h1:2.215rem; --rd-text-h2:1.816rem; --rd-text-h3:1.488rem; --rd-text-h4:1.22rem; --rd-body-weight:450; --rd-heading-weight:750;
    --rd-body-leading:1.58; --rd-heading-leading:1.16; --rd-body-tracking:0em; --rd-heading-tracking:-.025em;
    --rd-button-radius:14px; --rd-card-radius:22px; --rd-accent:#7c3aed; --rd-info:#0284c7;
    --rd-nav-bg:#3F51B5; --rd-nav-text:#ffffff;
    --rd-chart-1:#3F51B5;--rd-chart-2:#7c3aed;--rd-chart-3:#0891b2;--rd-chart-4:#16a34a;--rd-chart-5:#f59e0b;--rd-chart-6:#ef4444;--rd-chart-7:#ec4899;--rd-chart-8:#64748b;
}

[data-theme="dark"] {
    --rd-bg: #08111f;
    --rd-surface: #0f1b2d;
    --rd-surface-2: #12243d;
    --rd-text: #e5eefb;
    --rd-muted: #9aa8bd;
    --rd-border: rgba(148, 163, 184, .18);
    --rd-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    --rd-shadow-soft: 0 10px 28px rgba(0, 0, 0, .22);
}

/* Product download chooser lives outside the page wrapper, so it needs its own
   token-based theme boundary for consistent contrast in both color modes. */
.product-download-modal .modal-content {
    overflow: hidden;
    color: var(--rd-text);
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: 22px;
    box-shadow: var(--rd-shadow);
}
.product-download-modal .modal-header,
.product-download-modal .modal-footer {
    color: var(--rd-text);
    background: var(--rd-surface);
    border-color: var(--rd-border);
}
.product-download-modal .modal-title {
    color: var(--rd-text);
}
.product-download-modal .modal-title span {
    color: var(--rd-primary) !important;
}
.product-download-modal .modal-body {
    color: var(--rd-text);
    background: var(--rd-surface);
}
.product-download-modal .text-muted {
    color: var(--rd-muted) !important;
}
.product-download-option {
    width: 100%;
    color: var(--rd-text);
    text-decoration: none;
    background: var(--rd-surface-2);
    border: 1px solid var(--rd-border);
    border-radius: 14px;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.product-download-option i {
    color: var(--rd-primary);
}
.product-download-option:hover,
.product-download-option:focus-visible {
    color: #fff;
    background: var(--rd-primary);
    border-color: var(--rd-primary);
    transform: translateY(-1px);
}
.product-download-option:hover i,
.product-download-option:focus-visible i {
    color: #fff;
}
.product-download-close {
    padding: 9px 18px;
    color: var(--rd-text);
    background: var(--rd-surface-2);
    border: 1px solid var(--rd-border);
    border-radius: 999px;
    font-weight: 700;
}
.product-download-close:hover {
    background: color-mix(in srgb, var(--rd-primary) 12%, var(--rd-surface-2));
    border-color: color-mix(in srgb, var(--rd-primary) 45%, var(--rd-border));
}
[data-theme="dark"] .product-download-modal .btn-close {
    filter: invert(1) grayscale(1) brightness(1.9);
}
[data-theme="dark"] .product-download-modal .modal-title span,
[data-theme="dark"] .product-download-option i {
    color: #aab4ff !important;
}
[data-theme="dark"] .product-download-option:hover i,
[data-theme="dark"] .product-download-option:focus-visible i {
    color: #fff !important;
}

html { font-size:var(--rd-font-size); }
body { font-family:var(--rd-font); font-size:1rem; font-weight:var(--rd-body-weight); line-height:var(--rd-body-leading); letter-spacing:var(--rd-body-tracking); background:var(--rd-bg); color:var(--rd-text); -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
h1,h2,h3,h4,h5,h6 { font-family:var(--rd-font); font-weight:var(--rd-heading-weight); line-height:var(--rd-heading-leading); letter-spacing:var(--rd-heading-tracking); }
h1{font-size:var(--rd-text-h1)} h2{font-size:var(--rd-text-h2)} h3{font-size:var(--rd-text-h3)} h4{font-size:var(--rd-text-h4)} h5{font-size:1rem} h6{font-size:.875rem}

.td-navbar { background:#3F51B5 !important; box-shadow:0 10px 30px color-mix(in srgb,#3F51B5 24%,transparent); min-height:var(--rd-header-height); }
.td-navbar .navbar-brand span, .td-navbar .nav-link { color: #fff !important; }
.td-navbar .nav-link { font-weight: 650; font-size: .92rem; border-radius: 999px; padding: .58rem .82rem; opacity: .9; }
.td-navbar .nav-link:hover, .td-navbar .nav-link.active { background: rgba(255,255,255,.16); opacity: 1; }
.td-theme-toggle { border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; min-height: 36px; padding: 0 .75rem; font-weight: 700; display:inline-flex; align-items:center; gap:6px; cursor:pointer; transition:.18s ease; }
.td-theme-toggle:hover { background: rgba(255,255,255,.22); }
/* Icon visibility by theme */
[data-theme="light"] .td-icon-dark { display:none; }
[data-theme="dark"]  .td-icon-light { display:none; }
/* Default (before JS runs) hide dark icon */
html:not([data-theme="dark"]) .td-icon-dark { display:none; }
html:not([data-theme="light"]) .td-icon-light { display:none; }
/* ---------------------------------------------------------------------------
   Accent bar under the header.

   This used to be a viewport-fixed strip pinned at (header-height - 4px) with
   z-index 1031 - above the navbar's 1030. On desktop the navbar is exactly
   --rd-header-height tall so the two lined up. On mobile the navbar GROWS when
   the collapse menu opens, but the strip stayed at 68px and painted straight
   across the first menu item ("Home"), clipping it.

   It is now drawn as the navbar's own bottom edge, so it tracks the real
   navbar height whether the menu is open or closed.

   Do NOT add `position: relative` to .td-navbar here. Bootstrap gives the
   header `position: fixed` via .fixed-top, and both selectors have the same
   specificity - because this file loads after bootstrap.min.css, a position
   declared here silently wins, un-sticking the header and dropping it back
   into normal flow (which then double-counts the header-height padding and
   leaves a white band under it). A fixed element is already a containing
   block for absolutely positioned children, so ::after anchors correctly
   without any help.
--------------------------------------------------------------------------- */
.td-navbar::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    height: 4px;
    pointer-events: none;
    background: linear-gradient(90deg, var(--rd-primary-dark), var(--rd-primary-2), var(--rd-primary-dark));
}
/* Kept so any page still rendering the standalone element reserves no space. */
.td-accent-bar { display: none; }

/* --- Mobile nav (below the lg breakpoint, where the menu collapses) --- */
@media (max-width: 991.98px) {
    /* The open menu scrolls internally instead of running off-screen on short
       viewports, and clears the accent bar at the bottom of the brand row. */
    .td-navbar .navbar-collapse {
        max-height: calc(100vh - var(--rd-header-height));
        overflow-y: auto;
        overscroll-behavior: contain;
        margin-top: 4px;
        padding-bottom: .5rem;
    }
    .td-navbar .navbar-nav { gap: 2px; }
    .td-navbar .nav-link {
        padding: .72rem 1rem;
        border-radius: 12px;
    }
    /* Full-width tap targets read better than pill-width ones in a stacked list. */
    .td-navbar .nav-item { width: 100%; }
    .td-navbar .td-theme-toggle {
        width: 100%;
        justify-content: center;
        margin-top: .5rem;
        min-height: 42px;
    }
}

.rd-shell { min-height: 100vh; background: radial-gradient(circle at top right, rgba(63,81,181,.16), transparent 28rem), var(--rd-bg); padding-top: var(--rd-header-height); color: var(--rd-text); }
.rd-sidebar { position: fixed; top: var(--rd-header-height); left: 0; bottom: 0; width: var(--rd-sidebar-width); padding: 22px; background: rgba(255,255,255,.86); backdrop-filter: blur(20px); border-right: 1px solid var(--rd-border); display: flex; flex-direction: column; z-index: 20; overflow-y: auto; }
[data-theme="dark"] .rd-sidebar { background: rgba(15, 27, 45, .90); }
[data-theme="dark"] .rd-sidebar,
[data-theme="dark"] .rd-sidebar-brand strong,
[data-theme="dark"] .rd-menu-toggle { color: var(--rd-text) !important; }
[data-theme="dark"] .rd-menu-link:not(.active),
[data-theme="dark"] .rd-submenu a:not(.active),
[data-theme="dark"] .rd-sidebar-brand span { color: var(--rd-muted) !important; }
.rd-sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 10px 8px 20px; border-bottom: 1px solid var(--rd-border); margin-bottom: 18px; }
.rd-brand-mark { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color: #fff; font-weight: 900; letter-spacing: -.05em; box-shadow: 0 14px 26px rgba(63,81,181,.25); }
.rd-sidebar-brand strong { display:block; font-size:.98rem; }
.rd-sidebar-brand span { color: var(--rd-muted); font-size:.78rem; }
.rd-menu { display: grid; gap: 10px; }
.rd-menu-link, .rd-submenu a, .rd-menu-toggle { width:100%; display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--rd-muted); font-weight:760; font-size:.9rem; border:0; background:transparent; border-radius:16px; padding:12px 13px; transition:.18s ease; text-align:left; }
.rd-menu-link:hover, .rd-submenu a:hover, .rd-menu-toggle:hover { background: var(--rd-surface-2); color:var(--rd-text); transform: translateX(2px); }
.rd-menu-link.active, .rd-submenu a.active { background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color:#fff; box-shadow: 0 14px 30px rgba(63,81,181,.28); }
.rd-menu-icon { width:30px; height:30px; display:grid; place-items:center; border-radius:11px; background:rgba(63,81,181,.10); color:currentColor; }
.rd-menu-section { display:grid; gap: 6px; }
.rd-menu-toggle { justify-content:space-between; padding: 10px 12px; color: var(--rd-text); }
.rd-submenu { display:grid; gap:5px; margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--rd-border); }
.rd-submenu a { padding: 9px 12px; font-size: .84rem; }
.rd-sidebar-footer { margin-top:auto; display:grid; gap:12px; padding-top:18px; }
.rd-mini-card { background: var(--rd-surface); border:1px solid var(--rd-border); border-radius:18px; padding:14px; box-shadow: var(--rd-shadow-soft); }
.rd-mini-card span { display:block; color:var(--rd-muted); font-size:.76rem; }
.rd-mini-card strong { font-size:.9rem; }
.rd-logout { color: var(--rd-danger); border:1px solid rgba(220,38,38,.22); border-radius:14px; padding:10px; text-align:center; text-decoration:none; font-weight:800; }
.rd-logout:hover { background: rgba(220,38,38,.08); }

.rd-main { margin-left: var(--rd-sidebar-width); padding: 34px; }
.rd-topbar { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; margin-bottom:26px; }
.rd-eyebrow { display:inline-flex; padding:6px 10px; border-radius:999px; background:rgba(63,81,181,.1); color:var(--rd-primary); font-weight:900; font-size:.72rem; letter-spacing:.06em; text-transform:uppercase; margin-bottom:10px; }
.rd-topbar h1 { margin:0; font-size:clamp(1.65rem,2.3vw,2.25rem); font-weight:var(--rd-heading-weight); letter-spacing:var(--rd-heading-tracking); }
.rd-topbar p { margin:7px 0 0; color:var(--rd-muted); max-width:720px; font-size:.92rem; }
.rd-actions { display:flex; gap:10px; flex-wrap:wrap; }
.rd-btn { border:0; min-height:42px; padding:0 15px; border-radius:var(--rd-button-radius); font-weight:800; font-size:.86rem; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; gap:8px; cursor:pointer; transition:.18s ease; }
.rd-btn:hover { transform: translateY(-1px); }
.rd-btn:disabled { opacity:.65; cursor:not-allowed; transform:none; }
.rd-btn-primary { background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color:#fff; box-shadow:0 14px 30px rgba(63,81,181,.24); }
.rd-btn-ghost { background: var(--rd-surface); color: var(--rd-text); border:1px solid var(--rd-border); }
.w-100 { width: 100%; }

.rd-stat-grid { display:grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.rd-stat-card, .rd-panel { background:color-mix(in srgb,var(--rd-surface) 94%,transparent); border:1px solid var(--rd-border); border-radius:var(--rd-card-radius); box-shadow:var(--rd-shadow); }
[data-theme="dark"] .rd-stat-card, [data-theme="dark"] .rd-panel { background: rgba(15,27,45,.92); }
.rd-stat-card { padding:22px; position:relative; overflow:hidden; }
.rd-stat-card:before { content:""; position:absolute; inset:auto -20px -36px auto; width:96px; height:96px; border-radius:999px; background:rgba(63,81,181,.08); }
.rd-stat-card.primary { background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color:#fff; }
.rd-stat-card span { display:block; color:var(--rd-muted); font-weight:800; font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; }
.rd-stat-card.primary span, .rd-stat-card.primary small { color:rgba(255,255,255,.78); }
.rd-stat-card strong { display:block; margin:10px 0 4px; font-size:2rem; line-height:1; letter-spacing:-.05em; }
.rd-stat-card small { color:var(--rd-muted); }
.rd-grid-2 { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:18px; margin-top:18px; }
.rd-grid-form-table { display:grid; grid-template-columns: 370px minmax(0,1fr); gap:18px; align-items:start; }
.align-start { align-items:start; }
.rd-panel { padding:22px; }
.rd-panel-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:18px; }
.rd-panel-head h2 { margin:0; font-weight:900; font-size:1.05rem; letter-spacing:-.02em; }
.rd-panel-head p { margin:4px 0 0; color:var(--rd-muted); font-size:.88rem; }
.rd-panel-head a { color:var(--rd-primary); font-weight:850; text-decoration:none; font-size:.86rem; }
.rd-form { display:grid; gap:16px; }
.rd-field { display:grid; gap:8px; }
.rd-field label { color:var(--rd-text); font-size:.82rem; font-weight:850; }
.rd-control { width:100%; border:1px solid var(--rd-border); background:var(--rd-surface); color:var(--rd-text); border-radius:14px; min-height:44px; padding:10px 12px; outline:none; transition:.18s ease; }
.rd-control:focus { border-color:rgba(63,81,181,.55); box-shadow:0 0 0 4px rgba(63,81,181,.10); }
.rd-control.is-invalid { border-color: rgba(220,38,38,.7); }
.rd-field-error { color:var(--rd-danger); font-size:.78rem; font-weight:700; }
.rd-summary-box, .rd-readonly-field { border:1px solid var(--rd-border); background:var(--rd-surface-2); border-radius:18px; padding:15px; display:grid; gap:5px; }
.rd-summary-box span, .rd-readonly-field span { color:var(--rd-muted); font-size:.76rem; font-weight:800; text-transform:uppercase; }
.rd-summary-box strong, .rd-readonly-field strong { font-size:1rem; }
.rd-form-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:14px; }
.rd-table-wrap { overflow:auto; border-radius:18px; border:1px solid var(--rd-border); }
.rd-table { width:100%; border-collapse:separate; border-spacing:0; min-width:650px; }
.rd-table th { background:var(--rd-surface-2); color:var(--rd-muted); font-size:.75rem; text-transform:uppercase; letter-spacing:.05em; padding:13px 14px; }
.rd-table td { padding:13px 14px; border-top:1px solid var(--rd-border); font-size:.88rem; vertical-align:middle; }
.rd-table code { background:var(--rd-surface-2); color:var(--rd-primary); border-radius:8px; padding:4px 6px; }
.rd-pill, .rd-status { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; background:rgba(63,81,181,.1); color:var(--rd-primary); font-weight:850; font-size:.75rem; }
.rd-balance-list, .rd-category-metrics, .rd-info-list { display:grid; gap:12px; }
.rd-balance-row, .rd-metric-line { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px; border:1px solid var(--rd-border); border-radius:18px; background:var(--rd-surface); }
.rd-balance-row span { display:block; color:var(--rd-muted); font-size:.78rem; }
.rd-balance-row b { font-size:1.25rem; }
.rd-category-metrics h3 { font-size:.82rem; text-transform:uppercase; letter-spacing:.06em; color:var(--rd-muted); margin:0; }
.rd-empty, .rd-empty-table { text-align:center; color:var(--rd-muted); padding:28px; }
.rd-empty { border:1px dashed var(--rd-border); border-radius:18px; display:grid; place-items:center; gap:6px; }
.rd-empty i { font-size:1.4rem; color:var(--rd-primary); }
.rd-empty strong { color:var(--rd-text); }
.rd-empty.slim { padding:14px; }
.rd-positive { color:var(--rd-success); font-weight:850; }
.rd-negative { color:var(--rd-danger); font-weight:850; }
.rd-info-list p { margin:0; color:var(--rd-muted); display:flex; gap:10px; align-items:flex-start; }
.rd-info-list i { color:var(--rd-success); }
.rd-toast { position: fixed; top: calc(var(--rd-header-height) + 18px); right: 24px; z-index: 9999; min-width:280px; max-width:420px; padding:14px 16px; border-radius:16px; background:var(--rd-text); color:#fff; box-shadow:var(--rd-shadow); transform:translateY(-10px); opacity:0; pointer-events:none; transition:.2s ease; font-weight:750; }
.rd-toast.show { opacity:1; transform:translateY(0); }
.rd-toast.success { background:var(--rd-success); }
.rd-toast.error { background:var(--rd-danger); }
.td-alert-popup { border-radius:24px !important; padding:24px !important; box-shadow:0 28px 80px rgba(15,23,42,.24) !important; border:1px solid var(--rd-border) !important; }
.td-alert-title { font-family:var(--rd-font) !important; font-size:1.25rem !important; font-weight:900 !important; letter-spacing:-.025em !important; }
.td-alert-message { font-family:var(--rd-font) !important; color:var(--rd-muted) !important; font-size:.9rem !important; line-height:1.6 !important; }
.td-alert-confirm,.td-alert-cancel { min-height:44px; padding:0 18px; border:0; border-radius:13px; font-family:var(--rd-font); font-size:.86rem; font-weight:850; margin:5px; transition:.16s ease; }
.td-alert-confirm { color:#fff; background:linear-gradient(135deg,var(--rd-primary),var(--rd-primary-2)); box-shadow:0 10px 24px rgba(63,81,181,.22); }
.td-alert-confirm--danger { background:linear-gradient(135deg,#ef4444,#b91c1c); box-shadow:0 10px 24px rgba(220,38,38,.22); }
.td-alert-cancel { color:var(--rd-text); background:var(--rd-surface-2); border:1px solid var(--rd-border); }
.td-alert-confirm:hover,.td-alert-cancel:hover { transform:translateY(-1px); filter:brightness(.98); }
.td-alert-toast { border-radius:16px !important; border:1px solid var(--rd-border) !important; box-shadow:var(--rd-shadow) !important; font-family:var(--rd-font) !important; }
.rd-footer { margin-left:var(--rd-sidebar-width); background:var(--rd-surface); border-top:1px solid var(--rd-border); padding:14px 34px; display:flex; justify-content:space-between; gap:16px; color:var(--rd-muted); font-size:.78rem; }

.auth-page, .auth-page label, .auth-page input, .auth-page select, .auth-page textarea, .auth-page button, .auth-page p, .auth-page a { font-size: .9rem; }
.auth-page h1, .auth-page h2, .auth-page h3, .auth-page h4 { font-size: 1.25rem; }
.auth-page .form-control-lg, .auth-page .form-select-lg, .auth-page .btn-lg { font-size: .9rem; padding: .7rem .9rem; }

@media (max-width: 1180px) { .rd-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .rd-grid-form-table { grid-template-columns:1fr; } }
@media (max-width: 992px) { :root { --rd-sidebar-width: 0px; } .rd-sidebar { position:relative; top:auto; width:auto; margin:86px 16px 0; border:1px solid var(--rd-border); border-radius:24px; } .rd-shell { padding-top:0; } .rd-main { margin-left:0; padding:18px; } .rd-grid-2, .rd-stat-grid { grid-template-columns:1fr; } .rd-topbar { flex-direction:column; } .rd-footer { margin-left:0; flex-direction:column; padding:14px 18px; } }
/* RBAC Admin Console */
.rbac-role-list { display: grid; gap: 12px; }
.rbac-role-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; border:1px solid var(--rd-border); border-radius:var(--rd-radius-md); background:var(--rd-surface-soft); }
.rbac-role-item strong { display:block; color:var(--rd-text); font-size:14px; }
.rbac-role-item span { display:block; color:var(--rd-muted); font-size:12px; margin-top:3px; }
.rbac-role-item code { color:var(--rd-primary); background:rgba(37,99,235,.08); padding:4px 8px; border-radius:999px; font-size:11px; }
.rbac-chip-list { display:flex; flex-wrap:wrap; gap:8px; }
.rbac-chip { display:inline-flex; align-items:center; padding:7px 10px; border-radius:999px; background:rgba(37,99,235,.08); color:var(--rd-primary); font-size:12px; font-weight:700; }
.rbac-permission-table td small { display:block; color:var(--rd-muted); margin-top:3px; }
.rbac-permission-table input[type="checkbox"] { width:18px; height:18px; accent-color:var(--rd-primary); }
.rd-link { color:var(--rd-primary); font-weight:700; text-decoration:none; }
.rd-link:hover { text-decoration:underline; }
.rd-pill { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; background:var(--rd-surface-soft); color:var(--rd-text); font-size:11px; font-weight:800; letter-spacing:.03em; }
.mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }

/* RBAC session management refinements */
.rd-action-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.rd-action-row.compact { gap:8px; }
.rd-btn-danger { background:#dc2626; color:#fff; box-shadow:0 14px 30px rgba(220,38,38,.18); }
.rd-btn-sm { min-height:34px; padding:0 12px; border-radius:10px; font-size:.78rem; }
.rd-link.danger, button.rd-link.danger { color:#dc2626; border:0; background:transparent; padding:0; font:inherit; cursor:pointer; font-weight:800; }
.rd-link.danger:hover { text-decoration:underline; }

/* Developer module refinements */
.rd-checkbox-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; }
.rd-check { display:flex; align-items:center; gap:10px; border:1px solid var(--rd-border); background:var(--rd-surface); border-radius:14px; padding:12px; color:var(--rd-text); font-weight:800; font-size:.84rem; cursor:pointer; transition:.18s ease; }
.rd-check:hover { background:var(--rd-surface-2); transform:translateY(-1px); }
.rd-check input { width:17px; height:17px; accent-color:var(--rd-primary); }
.rd-table small { color:var(--rd-muted); }
.rd-summary-box small { color:var(--rd-muted); }
.rd-control[rows] { min-height:auto; resize:vertical; }
@media (max-width: 720px) { .rd-checkbox-grid, .rd-form-grid { grid-template-columns:1fr; } }

/* --------------------------------------------------------------------------
   Dashboard UI Refinement v3: modal-first workflows, responsive tables, polish
   -------------------------------------------------------------------------- */
:root {
    --rd-space-1: 4px;
    --rd-space-2: 8px;
    --rd-space-3: 12px;
    --rd-space-4: 16px;
    --rd-space-5: 20px;
    --rd-space-6: 24px;
    --rd-space-8: 32px;
    --rd-radius-md: 16px;
    --rd-radius-xl: 30px;
    --rd-ease: cubic-bezier(.2,.8,.2,1);
}

.rd-main { max-width: 1480px; }
.rd-topbar {
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-lg);
    background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(238,245,255,.78));
    box-shadow: var(--rd-shadow-soft);
    padding: clamp(20px, 3vw, 32px);
    margin-bottom: 24px;
}
[data-theme="dark"] .rd-topbar { background: linear-gradient(135deg, rgba(15,27,45,.92), rgba(18,36,61,.78)); }
.rd-topbar h1 { letter-spacing: -.04em; line-height: 1; }
.rd-topbar p { max-width: 780px; }
.rd-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.rd-btn {
    min-height: 42px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    font-weight: 800;
    transition: transform .18s var(--rd-ease), box-shadow .18s var(--rd-ease), background .18s var(--rd-ease);
}
.rd-btn:hover { transform: translateY(-1px); }
.rd-btn:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.rd-btn-primary { background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color:#fff; box-shadow: 0 16px 30px rgba(63,81,181,.22); }
.rd-btn-ghost, .rd-btn-soft { background: var(--rd-surface); border-color: var(--rd-border); color: var(--rd-text); }
.rd-btn-ghost:hover, .rd-btn-soft:hover { background: var(--rd-surface-2); }
.rd-btn-loading { position: relative; pointer-events:none; }
.rd-btn-loading::before { content:""; width:15px; height:15px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; animation:rdSpin .7s linear infinite; }
@keyframes rdSpin { to { transform: rotate(360deg); } }

.rd-panel {
    border: 1px solid var(--rd-border);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(18px);
    border-radius: var(--rd-radius-lg);
    box-shadow: var(--rd-shadow-soft);
    overflow: hidden;
}
[data-theme="dark"] .rd-panel { background: rgba(15,27,45,.88); }
.rd-panel-head { padding-bottom: 16px; border-bottom: 1px solid var(--rd-border); margin-bottom: 18px; }
.rd-panel-head h2 { letter-spacing: -.02em; }
.rd-panel-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.rd-table-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.rd-search { max-width: 320px; }
.rd-search .rd-control { min-height: 40px; }

.rd-modal .modal-content {
    border: 1px solid var(--rd-border);
    border-radius: 26px;
    background: var(--rd-surface);
    color: var(--rd-text);
    box-shadow: var(--rd-shadow);
    overflow: hidden;
}
.rd-modal .modal-header { border-bottom: 1px solid var(--rd-border); padding: 20px 24px; }
.rd-modal .modal-title { font-weight: 900; letter-spacing: -.03em; }
.rd-modal .modal-body { padding: 24px; }
.rd-modal .modal-footer { border-top: 1px solid var(--rd-border); padding: 18px 24px; background: var(--rd-surface-2); }
.rd-modal .btn-close { filter: none; }
[data-theme="dark"] .rd-modal .btn-close { filter: invert(1); }
.rd-modal-lead { color: var(--rd-muted); margin: 4px 0 0; font-size: .9rem; }
.rd-modal .rd-form { display:grid; gap:16px; }
.rd-form-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rd-form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rd-field { display:grid; gap:8px; }
.rd-field label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rd-muted); font-weight: 900; }
.rd-control {
    border: 1px solid var(--rd-border);
    border-radius: 14px;
    background: var(--rd-surface);
    color: var(--rd-text);
    min-height: 46px;
    padding: 10px 13px;
    outline: none;
    transition: border .18s var(--rd-ease), box-shadow .18s var(--rd-ease), background .18s var(--rd-ease);
}
.rd-control:focus { border-color: rgba(63,81,181,.55); box-shadow: 0 0 0 4px rgba(63,81,181,.12); }
.rd-control.is-invalid { border-color: var(--rd-danger); box-shadow: 0 0 0 4px rgba(220,38,38,.1); }
.rd-field-error { color: var(--rd-danger); font-size: .78rem; font-weight: 800; }
.rd-form-help { color: var(--rd-muted); font-size:.82rem; }

.rd-table-wrap { overflow-x:auto; border-radius: 18px; border: 1px solid var(--rd-border); background: var(--rd-surface); }
.rd-table { min-width: 760px; margin:0; width:100%; border-collapse: separate; border-spacing:0; }
.rd-table th { position: sticky; top: 0; background: var(--rd-surface-2); color: var(--rd-muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.08em; z-index:1; }
.rd-table th, .rd-table td { padding: 15px 16px; vertical-align: middle; border-bottom: 1px solid var(--rd-border); }
.rd-table tbody tr { transition: background .16s var(--rd-ease); }
.rd-table tbody tr:hover { background: rgba(63,81,181,.035); }
.rd-table tbody tr:last-child td { border-bottom:0; }
.rd-table code { background: rgba(63,81,181,.08); color: var(--rd-primary); border-radius: 10px; padding: 4px 7px; font-size:.82em; }
.rd-empty-table, .rd-empty { color: var(--rd-muted); }
.rd-empty-state { display:grid; place-items:center; gap:10px; min-height: 190px; text-align:center; color:var(--rd-muted); }
.rd-empty-state i { font-size: 2rem; color: var(--rd-primary); }
.rd-empty-state strong { color:var(--rd-text); font-size: 1rem; }
.rd-status { display:inline-flex; align-items:center; gap:6px; border-radius:999px; background: rgba(22,163,74,.1); color: var(--rd-success); font-size:.75rem; font-weight:900; padding:6px 10px; }
.rd-pill { white-space:nowrap; }

.rd-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.rd-summary-card { border:1px solid var(--rd-border); background:var(--rd-surface); border-radius:20px; padding:16px; }
.rd-summary-card span { color:var(--rd-muted); font-size:.76rem; font-weight:850; text-transform:uppercase; letter-spacing:.06em; display:block; }
.rd-summary-card strong { font-size:1.05rem; margin-top:6px; display:block; }

.rd-mobile-bar { display:none; position: sticky; top: calc(var(--rd-header-height) + 8px); z-index: 25; padding: 0 18px 12px; }
.rd-mobile-nav-toggle { width:100%; min-height:44px; }
.rd-sidebar-backdrop { display:none; }

@media (max-width: 992px) {
    .rd-mobile-bar { display:block; }
    .rd-shell { padding-top: var(--rd-header-height); }
    .rd-sidebar { position: fixed; top: var(--rd-header-height); left: 0; bottom: 0; width: min(86vw, 320px); margin: 0; border-radius: 0 24px 24px 0; transform: translateX(-105%); transition: transform .22s var(--rd-ease); z-index: 1040; }
    .rd-sidebar.is-open { transform: translateX(0); }
    .rd-sidebar-backdrop { display:block; position:fixed; inset:var(--rd-header-height) 0 0 0; background:rgba(2,6,23,.45); opacity:0; pointer-events:none; transition:.22s var(--rd-ease); z-index:1030; }
    .rd-sidebar-backdrop.is-open { opacity:1; pointer-events:auto; }
    .rd-main { padding: 18px; }
}
@media (max-width: 720px) {
    .rd-topbar { padding: 20px; }
    .rd-actions, .rd-action-row { width:100%; }
    .rd-actions .rd-btn, .rd-action-row .rd-btn { width:100%; }
    .rd-form-grid, .rd-form-grid.three, .rd-summary-grid { grid-template-columns:1fr; }
    .rd-modal .modal-dialog { margin: 10px; }
    .rd-table-wrap { border: 0; background: transparent; overflow: visible; }
    .rd-table { min-width: 0; border-collapse: collapse; }
    .rd-table thead { display:none; }
    .rd-table, .rd-table tbody, .rd-table tr, .rd-table td { display:block; width:100%; }
    .rd-table tr { background: var(--rd-surface); border:1px solid var(--rd-border); border-radius:18px; padding: 10px 12px; margin-bottom:12px; box-shadow: var(--rd-shadow-soft); }
    .rd-table td { border:0; display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding: 9px 0; text-align:right; }
    .rd-table td::before { content: attr(data-label); color:var(--rd-muted); font-weight:900; text-align:left; text-transform:uppercase; letter-spacing:.05em; font-size:.68rem; max-width:45%; }
    .rd-table td.rd-empty-table { display:block; text-align:center; }
    .rd-table td.rd-empty-table::before { display:none; }
}
.rd-stats-grid { display:grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
@media (max-width:1180px){ .rd-stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width:720px){ .rd-stats-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Modal overflow fix: keep actions visible and make modal body scrollable
   -------------------------------------------------------------------------- */
.rd-modal {
    --rd-modal-max-height: calc(100dvh - 32px);
}

.rd-modal .modal-dialog {
    max-height: var(--rd-modal-max-height);
    display: flex;
    align-items: center;
}

.rd-modal .modal-content {
    max-height: var(--rd-modal-max-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Many dashboard modals place modal-body and modal-footer inside the form.
   The form must also become a flex column so the body can scroll while the
   footer stays visible. */
.rd-modal .modal-content > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.rd-modal .modal-header,
.rd-modal .modal-footer {
    flex: 0 0 auto;
}

.rd-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 28px;
}

.rd-modal .modal-footer {
    position: relative;
    z-index: 2;
    box-shadow: 0 -10px 24px rgba(15, 23, 42, .06);
}

[data-theme="dark"] .rd-modal .modal-footer {
    box-shadow: 0 -10px 24px rgba(0, 0, 0, .25);
}

/* Large permission tables inside modals should scroll inside the modal body,
   not push the submit button below the viewport. */
.rd-modal .modal-body .rd-table-wrap {
    max-height: min(58dvh, 560px);
    overflow: auto;
}

.rd-modal .modal-body::-webkit-scrollbar,
.rd-modal .modal-body .rd-table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.rd-modal .modal-body::-webkit-scrollbar-thumb,
.rd-modal .modal-body .rd-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .35);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

@media (max-width: 720px) {
    .rd-modal {
        --rd-modal-max-height: calc(100dvh - 20px);
    }

    .rd-modal .modal-dialog {
        align-items: flex-start;
        margin: 10px;
    }

    .rd-modal .modal-content {
        border-radius: 22px;
    }

    .rd-modal .modal-header,
    .rd-modal .modal-body,
    .rd-modal .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .rd-modal .modal-footer {
        gap: 10px;
    }

    .rd-modal .modal-footer .rd-btn {
        flex: 1 1 auto;
    }
}

/* ---------- Action menu (dot / "Menu ›" button) ---------- */
.rd-action-cell { width: 1%; white-space: nowrap; text-align: center; }
.rd-dot-menu { position: relative; display: inline-block; }
.rd-dot-btn {
    /* auto-width so "Menu ›" text isn't clipped */
    width: auto; min-width: 34px; height: 34px;
    padding: 0 10px; border-radius: 10px;
    border: 1px solid var(--rd-border); background: var(--rd-surface);
    color: var(--rd-text); font-size: .84rem; line-height: 1;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    gap: 5px; transition: .15s ease; font-weight: 700; white-space: nowrap;
}
.rd-dot-btn:hover { background: var(--rd-surface-2); border-color: rgba(63,81,181,.35); color: var(--rd-primary); }
.rd-dot-btn[aria-expanded="true"] { background: var(--rd-surface-2); border-color: rgba(63,81,181,.35); color: var(--rd-primary); }
.rd-dot-dropdown {
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 170px; background: var(--rd-surface);
    border: 1px solid var(--rd-border); border-radius: 14px;
    box-shadow: var(--rd-shadow); z-index: 9999;
    padding: 6px; display: none; flex-direction: column; gap: 2px;
}
.rd-dot-dropdown.is-open { display: flex; }
.rd-dot-dropdown.is-open.rd-dot-floating {
    position: fixed;
    inset: auto;
    right: auto;
    z-index: 10050;
}
.rd-dot-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 12px; border-radius: 10px; border: 0;
    background: transparent; color: var(--rd-text);
    font-size: .84rem; font-weight: 600; cursor: pointer;
    text-align: left; width: 100%; transition: .15s ease;
    text-decoration: none;
}
.rd-dot-item:hover { background: var(--rd-surface-2); color: var(--rd-primary); }
.rd-dot-item--danger { color: #c0392b; }
.rd-dot-item--danger:hover { background: #fff5f5; color: #c0392b; }
.rd-dot-divider { height: 1px; background: var(--rd-border); margin: 4px 6px; }

/* ---------- PIN Success Modal ---------- */
.rd-success-pin-preview { background: var(--rd-surface-2); border: 1px solid var(--rd-border); border-radius: 16px; padding: 16px; }
.rd-success-pin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 340px; overflow-y: auto; }
.rd-success-pin-chip {
    background: var(--rd-surface); border: 1px solid var(--rd-border);
    border-radius: 12px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.rd-success-pin-chip code { color: var(--rd-primary); font-weight: 900; font-size: .9rem; }
.rd-success-pin-chip small { color: var(--rd-muted); font-size: .72rem; }

/* ---------- Global Search ---------- */
.rd-global-search { margin-bottom: 16px; }
.rd-global-search-wrap { position: relative; display: flex; align-items: center; }
.rd-global-search-icon { position: absolute; left: 12px; color: var(--rd-muted); font-size: .85rem; pointer-events: none; }
.rd-global-search-input { padding-left: 34px !important; padding-right: 34px !important; min-height: 40px; border-radius: 14px; font-size: .85rem; }
.rd-global-search-clear { position: absolute; right: 10px; color: var(--rd-muted); cursor: pointer; display: flex; align-items: center; padding: 2px; border-radius: 50%; transition: .15s ease; }
.rd-global-search-clear:hover { color: var(--rd-text); background: var(--rd-surface-2); }
.rd-global-search-hint { font-size: .74rem; color: var(--rd-muted); margin-top: 5px; min-height: 14px; padding: 0 2px; }
/* Highlight matching text */
.rd-search-highlight { background: rgba(63,81,181,.18); color: var(--rd-primary); border-radius: 3px; font-weight: 900; padding: 0 2px; }
/* Rows hidden by global search */
tr[data-search-hidden] { display: none !important; }

/* ---------- Admin module refinement ---------- */
.admin-stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.admin-module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.admin-module-card { display: grid; gap: 10px; min-height: 172px; padding: 22px; border: 1px solid var(--rd-border); border-radius: var(--rd-radius-lg); background: var(--rd-surface); color: var(--rd-text); text-decoration: none; box-shadow: var(--rd-shadow-soft); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.admin-module-card:hover { transform: translateY(-3px); box-shadow: var(--rd-shadow); border-color: rgba(63,81,181,.32); }
.admin-module-card i { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); box-shadow: 0 14px 30px rgba(63,81,181,.22); font-size: 1.25rem; }
.admin-module-card strong { font-size: 1rem; letter-spacing: -.02em; }
.admin-module-card span { color: var(--rd-muted); font-size: .88rem; line-height: 1.45; }
.admin-tool-list { display: grid; gap: 12px; }
.admin-tool-list a { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--rd-border); background: var(--rd-surface-2); color: var(--rd-text); border-radius: 18px; text-decoration: none; transition: .18s ease; }
.admin-tool-list a:hover { transform: translateX(3px); border-color: rgba(63,81,181,.28); }
.admin-tool-list i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; background: rgba(63,81,181,.11); color: var(--rd-primary); }
.admin-tool-list strong { display: block; }
.admin-tool-list small { display: block; color: var(--rd-muted); margin-top: 2px; }
.rd-filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(160px, 220px) auto auto; gap: 12px; align-items: center; }
.rd-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 18px; flex-wrap: wrap; }
.rd-page-numbers { display: flex; gap: 6px; flex-wrap: wrap; }
.rd-page-link, .rd-page-number { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--rd-border); border-radius: 12px; color: var(--rd-text); text-decoration: none; font-weight: 800; background: var(--rd-surface); transition: .18s ease; }
.rd-page-link:hover, .rd-page-number:hover { border-color: rgba(63,81,181,.32); color: var(--rd-primary); transform: translateY(-1px); }
.rd-page-number.active { background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-2)); color: #fff; border-color: transparent; box-shadow: 0 12px 24px rgba(63,81,181,.22); }
.rd-page-link.disabled { pointer-events: none; opacity: .45; }
.rd-pagination-meta { text-align: right; color: var(--rd-muted); font-size: .84rem; margin-top: 8px; }
.rd-pill.success { background: rgba(22,163,74,.12); color: var(--rd-success); }
.rd-pill.warning { background: rgba(217,119,6,.12); color: var(--rd-warning); }
.rd-pill.danger { background: rgba(220,38,38,.12); color: var(--rd-danger, #dc2626); }
.rd-transaction-row--credit { box-shadow: inset 3px 0 0 rgba(22,163,74,.72); }
.rd-transaction-row--debit { box-shadow: inset 3px 0 0 rgba(220,38,38,.72); }
.rd-transaction-row--neutral { box-shadow: inset 3px 0 0 rgba(100,116,139,.55); }
.rd-transaction-amount { white-space: nowrap; }
.rd-transaction-amount.is-credit { color: var(--rd-success, #15803d); }
.rd-transaction-amount.is-debit { color: var(--rd-danger, #dc2626); }
.rd-transaction-amount.is-neutral { color: var(--rd-muted); }
[data-theme="dark"] .rd-transaction-amount.is-credit { color: #4ade80; }
[data-theme="dark"] .rd-transaction-amount.is-debit { color: #f87171; }
.rd-check-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rd-check { display: flex !important; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--rd-border); border-radius: 14px; background: var(--rd-surface-2); text-transform: none !important; letter-spacing: 0 !important; color: var(--rd-text) !important; }

@media (max-width: 1280px) {
    .admin-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .admin-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .admin-stats-grid, .admin-module-grid { grid-template-columns: 1fr; }
    .rd-filter-bar { grid-template-columns: 1fr; }
    .rd-pagination { justify-content: flex-start; }
    .rd-pagination-meta { text-align: left; }
    .rd-check-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
    .rd-check-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Dashboard layout alignment and background correction
   Fixes: content shifted too far left on large screens, dashboard footer
   alignment, and overly black dark-mode surfaces.
   -------------------------------------------------------------------------- */
:root {
    --rd-dashboard-max-width: 1480px;
}

/* Keep dark mode within the brand direction without turning the dashboard
   into a flat black canvas. */
[data-theme="dark"] {
    --rd-bg: #101f35;
    --rd-surface: #14243a;
    --rd-surface-2: #1a304d;
    --rd-text: #eef5ff;
    --rd-muted: #b3c0d4;
    --rd-border: rgba(191, 219, 254, .16);
}

body {
    min-height: 100vh;
    background: var(--rd-bg) !important;
}

.rd-shell {
    width: 100%;
    min-height: calc(100vh - var(--rd-header-height));
    background:
        radial-gradient(circle at top right, rgba(63,81,181,.13), transparent 30rem),
        linear-gradient(180deg, rgba(255,255,255,.72), rgba(245,248,255,.96)),
        var(--rd-bg) !important;
}

[data-theme="dark"] .rd-shell {
    background:
        radial-gradient(circle at top right, rgba(79,140,255,.22), transparent 30rem),
        linear-gradient(180deg, rgba(16,31,53,.96), rgba(10,23,40,.98)),
        var(--rd-bg) !important;
}

/* Bootstrap and legacy utility classes otherwise reintroduce dark ink on
   dark surfaces. Scope the correction to dark appearance only. */
[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-body,
[data-theme="dark"] .modal-title,
[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .table { color: var(--rd-text) !important; }
[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text { color: var(--rd-muted) !important; }
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item { background-color: var(--rd-surface); color: var(--rd-text); border-color: var(--rd-border); }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--rd-muted); opacity: .82; }

/* Center the dashboard content inside the space that remains after the fixed
   sidebar instead of letting the content hug the sidebar on wide screens. */
.rd-main {
    box-sizing: border-box;
    width: min(var(--rd-dashboard-max-width), calc(100vw - var(--rd-sidebar-width)));
    max-width: var(--rd-dashboard-max-width);
    margin-left: calc(
        var(--rd-sidebar-width) +
        max(0px, (100vw - var(--rd-sidebar-width) - var(--rd-dashboard-max-width)) / 2)
    ) !important;
    margin-right: auto !important;
    padding: clamp(22px, 2.4vw, 38px);
}

.rd-topbar {
    align-items: center;
}

.rd-topbar > div:first-child {
    min-width: 0;
}

.rd-topbar h1,
.rd-topbar p {
    text-align: left;
}

.rd-action-row,
.rd-actions {
    justify-content: flex-end;
}

.rd-stat-card,
.rd-summary-card,
.admin-module-card {
    text-align: left;
}

/* Dashboard footer should align with the dashboard content area, not with the
   public website footer. */
.dashboard-footer {
    box-sizing: border-box;
    width: min(var(--rd-dashboard-max-width), calc(100vw - var(--rd-sidebar-width)));
    max-width: var(--rd-dashboard-max-width);
    margin-left: calc(
        var(--rd-sidebar-width) +
        max(0px, (100vw - var(--rd-sidebar-width) - var(--rd-dashboard-max-width)) / 2)
    ) !important;
    margin-right: auto !important;
    background: var(--rd-surface);
    border-top: 1px solid var(--rd-border);
    color: var(--rd-muted);
    padding: 14px clamp(22px, 2.4vw, 38px);
    font-size: .78rem;
}

.dashboard-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

@media (max-width: 992px) {
    .rd-main,
    .dashboard-footer {
        width: 100%;
        max-width: none;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 18px;
        padding-right: 18px;
    }

    .rd-topbar {
        align-items: flex-start;
    }

    .rd-action-row,
    .rd-actions {
        justify-content: flex-start;
    }

    .dashboard-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media (max-width: 720px) {
    .rd-topbar h1,
    .rd-topbar p {
        text-align: left;
    }

    .rd-topbar {
        border-radius: 22px;
    }
}

/* Admin RBAC and user management refinements */
.rd-rbac-layout { display:grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap:24px; align-items:start; }
.rd-role-browser { position:sticky; top:calc(var(--rd-header-height) + 24px); max-height:calc(100vh - var(--rd-header-height) - 48px); overflow:auto; }
.rd-role-list { display:grid; gap:10px; }
.rd-role-card { width:100%; border:1px solid var(--rd-border); background:var(--rd-surface); color:var(--rd-text); border-radius:16px; padding:14px; display:flex; align-items:center; justify-content:space-between; gap:16px; text-align:left; transition:.18s ease; }
.rd-role-card:hover { transform:translateY(-1px); border-color:rgba(63,81,181,.35); box-shadow:var(--rd-shadow-soft); }
.rd-role-card.active { background:linear-gradient(135deg, rgba(63,81,181,.12), rgba(77,163,255,.08)); border-color:rgba(63,81,181,.55); }
.rd-role-card strong { display:block; font-size:.92rem; font-weight:900; }
.rd-role-card small { display:block; color:var(--rd-muted); margin-top:4px; overflow-wrap:anywhere; }
.rd-role-card em { min-width:34px; height:34px; border-radius:999px; display:grid; place-items:center; background:var(--rd-primary); color:#fff; font-style:normal; font-size:.78rem; font-weight:900; }
.rd-text-wrap, .rd-table td, .rd-table small { overflow-wrap:anywhere; word-break:break-word; }
.rd-muted-text { color:var(--rd-muted); font-size:.82rem; font-weight:800; }
.rd-role-chips, .rd-chip-list { display:flex; flex-wrap:wrap; gap:6px; max-width:360px; }
.rd-role-checkbox-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.rd-role-check { align-items:flex-start; }
.rd-role-check span { display:grid; gap:3px; }
.rd-role-check small { color:var(--rd-muted); overflow-wrap:anywhere; }
.rd-role-permission-note { border:1px solid var(--rd-border); border-radius:16px; padding:14px; background:var(--rd-surface-2); display:grid; gap:4px; }
.rd-role-permission-note span { color:var(--rd-muted); font-size:.86rem; overflow-wrap:anywhere; }
.rd-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.rd-detail-grid > div { border:1px solid var(--rd-border); border-radius:16px; padding:14px; background:var(--rd-surface-2); min-width:0; }
.rd-detail-grid span { display:block; color:var(--rd-muted); font-size:.74rem; text-transform:uppercase; letter-spacing:.06em; font-weight:900; margin-bottom:5px; }
.rd-detail-grid strong { display:block; color:var(--rd-text); overflow-wrap:anywhere; }
.rd-pill.success, .rd-status.success { background:rgba(22,163,74,.12); color:#16a34a; }
.rd-pill.warning, .rd-status.warning { background:rgba(245,158,11,.13); color:#b45309; }
.rd-table .rd-action-row { min-width:max-content; }
@media (max-width: 1100px) { .rd-rbac-layout { grid-template-columns:1fr; } .rd-role-browser { position:relative; top:auto; max-height:none; } }
@media (max-width: 720px) { .rd-role-checkbox-list, .rd-detail-grid { grid-template-columns:1fr; } .rd-role-chips { max-width:100%; } }

/* Table overflow and permission switch refinements */
.rd-table-fixed { table-layout: fixed; width: 100%; }
.rd-table td, .rd-table th { vertical-align: top; }
.rd-text-wrap, .rd-table td { overflow-wrap: anywhere; word-break: break-word; }
.rd-user-table th:nth-child(1), .rd-user-table td:nth-child(1) { min-width: 180px; }
.rd-user-table th:nth-child(2), .rd-user-table td:nth-child(2) { min-width: 220px; }
.rd-user-table th:nth-child(4), .rd-user-table td:nth-child(4) { min-width: 220px; }
.rd-chip-list { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.rd-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.rd-switch input { position: absolute; opacity: 0; pointer-events: none; }
.rd-switch span { width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .2s ease; flex: 0 0 auto; }
.rd-switch span::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; box-shadow: 0 2px 5px rgba(15,23,42,.25); transition: transform .2s ease; }
.rd-switch input:checked + span { background: var(--td-primary, #2563eb); }
.rd-switch input:checked + span::after { transform: translateX(18px); }
.rd-switch em { font-style: normal; font-size: 12px; color: var(--td-muted, #64748b); font-weight: 700; }
.rd-filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.rd-filter-bar .rd-btn { min-height: 42px; justify-content: center; }
@media (max-width: 768px) {
  .rd-filter-bar { grid-template-columns: 1fr; }
  .rd-user-table td, .rd-user-table th { white-space: normal; }
}

/* ==========================================================================
   Settings Page – Section dividers, repeatable DnD lists, logo upload zone
   ========================================================================== */

/* Section header row: label + action button side-by-side */
.rd-section-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 10px;
    border-top: 1px solid var(--rd-border);
    margin-top: 8px;
}
.rd-section-divider:first-child { border-top: 0; margin-top: 0; }
.rd-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 900;
    color: var(--rd-text);
    letter-spacing: -.01em;
    margin: 0;
}
.rd-section-label i { color: var(--rd-primary); }

/* ── Repeatable list container ── */
.rd-repeatable-list {
    display: grid;
    gap: 8px;
}

/* ── A single draggable row ── */
.rd-repeat-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: 16px;
    transition: box-shadow .18s ease, border-color .18s ease, opacity .18s ease;
    position: relative;
}
.rd-repeat-item:hover { border-color: rgba(63,81,181,.28); }

/* dragging state */
.rd-repeat-item.rd-dragging {
    opacity: .45;
    box-shadow: none;
    border-style: dashed;
}
/* drag-over drop target */
.rd-repeat-item.rd-drag-over {
    border-color: var(--rd-primary);
    box-shadow: 0 0 0 3px rgba(63,81,181,.14);
}

/* ── Drag handle ── */
.rd-drag-handle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 44px;
    color: var(--rd-muted);
    cursor: grab;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: color .15s ease, background .15s ease;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.rd-drag-handle:hover { color: var(--rd-primary); background: rgba(63,81,181,.06); }
.rd-drag-handle:active { cursor: grabbing; }

/* ── Field area inside each row ── */
.rd-repeat-fields {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Remove button ── */
.rd-remove-row {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--rd-border);
    background: transparent;
    color: var(--rd-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .9rem;
    transition: .15s ease;
    align-self: center;
}
.rd-remove-row:hover {
    background: rgba(220,38,38,.08);
    border-color: rgba(220,38,38,.35);
    color: var(--rd-danger);
}

/* empty-list placeholder shown when all rows removed */
.rd-repeat-empty {
    text-align: center;
    padding: 20px;
    border: 1px dashed var(--rd-border);
    border-radius: 14px;
    color: var(--rd-muted);
    font-size: .84rem;
    display: none;
}
.rd-repeatable-list:empty + .rd-repeat-empty,
.rd-repeatable-list[data-empty] + .rd-repeat-empty { display: block; }

/* ── Logo / file upload drop zone ── */
.rd-upload-zone {
    display: block;
    position: relative;
    border: 2px dashed var(--rd-border);
    border-radius: 20px;
    background: var(--rd-surface);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s ease, background .2s ease;
    min-height: 140px;
}
.rd-upload-zone:hover,
.rd-upload-zone.rd-drag-active {
    border-color: var(--rd-primary);
    background: rgba(63,81,181,.04);
}
.rd-upload-zone.rd-drag-active { box-shadow: 0 0 0 4px rgba(63,81,181,.12); }

/* visually hidden native input */
.rd-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

/* inner content wrapper */
.rd-upload-zone-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 20px;
}

/* placeholder (no image yet) */
.rd-upload-zone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: var(--rd-muted);
    pointer-events: none;
}
.rd-upload-zone-placeholder i {
    font-size: 2.2rem;
    color: var(--rd-primary);
    opacity: .7;
}
.rd-upload-zone-placeholder strong { color: var(--rd-text); font-size: .9rem; }
.rd-upload-zone-placeholder span { font-size: .82rem; }
.rd-upload-zone-placeholder small { font-size: .74rem; color: var(--rd-muted); margin-top: 2px; }

/* existing image preview */
.rd-upload-preview {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 10px;
    display: block;
}

/* overlay on top of existing image */
.rd-upload-zone-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(0,0,0,.52);
    color: #fff;
    opacity: 0;
    transition: opacity .2s ease;
    border-radius: 18px;
    pointer-events: none;
    font-size: .84rem;
    text-align: center;
}
.rd-upload-zone-overlay i { font-size: 1.6rem; }
.rd-upload-zone:hover .rd-upload-zone-overlay,
.rd-upload-zone.rd-drag-active .rd-upload-zone-overlay { opacity: 1; }

/* selected file name badge */
.rd-upload-zone-selected {
    text-align: center;
    padding: 8px 14px;
    font-size: .8rem;
    font-weight: 800;
    color: var(--rd-primary);
    background: rgba(63,81,181,.07);
    border-top: 1px solid var(--rd-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

/* ── Responsive tweaks ── */
@media (max-width: 640px) {
    .rd-repeat-item { flex-wrap: wrap; }
    .rd-drag-handle { height: 36px; }
    .rd-remove-row  { align-self: flex-start; margin-top: 4px; }
}

/* ==========================================================================
   Pagination Bar – page-size selector + nav row
   ========================================================================== */
.rd-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 18px;
}
.rd-page-size-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rd-page-size-label {
    font-size: .82rem;
    color: var(--rd-muted);
    white-space: nowrap;
    font-weight: 700;
}
.rd-page-size-select {
    min-height: 36px !important;
    padding: 0 10px !important;
    font-size: .82rem !important;
    width: auto !important;
    min-width: 72px;
    border-radius: 10px !important;
}
@media (max-width: 640px) {
    .rd-pagination-bar { flex-direction: column; align-items: flex-start; }
    .rd-pagination { justify-content: flex-start; }
}

/* ==========================================================================
   Search-only filter bar variant
   ========================================================================== */
.rd-filter-bar--search-only {
    grid-template-columns: 1fr auto auto auto !important;
    align-items: center;
}
.rd-search-input { flex: 1; }
@media (max-width: 640px) {
    .rd-filter-bar--search-only { grid-template-columns: 1fr !important; }
}

/* ==========================================================================
   Export Transactions button – styled green accent
   ========================================================================== */
.rd-btn-export {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff !important;
    border: 0;
    box-shadow: 0 8px 20px rgba(22,163,74,.22);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 900;
    font-size: .88rem;
    cursor: pointer;
    transition: .18s ease;
}
.rd-btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(22,163,74,.30);
    color: #fff !important;
}

/* ==========================================================================
   App Customisation – compact upload-zone variant (--sm)
   ========================================================================== */
.rd-upload-zone--sm {
    min-height: 120px;
    border-radius: 14px;
}
.rd-upload-zone--sm .rd-upload-zone-inner {
    min-height: 110px;
}
.rd-upload-zone--sm .rd-upload-zone-placeholder i {
    font-size: 1.6rem;
}
.rd-upload-zone--sm .rd-upload-zone-placeholder strong { font-size: .82rem; }
.rd-upload-zone--sm .rd-upload-zone-placeholder span  { font-size: .76rem; }
.rd-upload-zone--sm .rd-upload-zone-placeholder small { font-size: .7rem; }

/* ==========================================================================
   Bank Account add-button disabled state
   ========================================================================== */
[data-add-row].rd-add-disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(.6);
}

/* ==========================================================================
   Number formatting helpers
   ========================================================================== */
.rd-positive { color: var(--rd-success, #16a34a); font-weight: 800; }
.rd-negative { color: #dc2626; font-weight: 800; }

/* ==========================================================================
   Detail List — clean key/value rows for all detail modals
   ========================================================================== */
.rd-detail-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:0; }
.rd-detail-row { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--rd-border); }
.rd-detail-row:last-child { border-bottom:none; padding-bottom:0; }
.rd-detail-row:first-child { padding-top:0; }
.rd-detail-label { font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--rd-muted); white-space:nowrap; min-width:110px; padding-top:2px; flex-shrink:0; }
.rd-detail-value { font-size:.92rem; font-weight:600; color:var(--rd-text, #1e293b); text-align:right; word-break:break-all; flex:1; }
.rd-detail-value code { font-family:ui-monospace,monospace; font-size:.85rem; background:var(--rd-surface-2); padding:3px 7px; border-radius:6px; word-break:break-all; }
.rd-detail-value .rd-pill { font-size:.72rem; }
.rd-detail-section { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.07em; color:var(--rd-primary); margin:16px 0 4px; display:flex; align-items:center; gap:6px; }
.rd-detail-section:first-child { margin-top:0; }

/* Modal header badge strip */
.rd-modal-badge-strip { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }

/* Icon-only action button */
.rd-icon-btn { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; border:1px solid var(--rd-border); border-radius:8px; background:none; cursor:pointer; color:var(--rd-muted); font-size:.95rem; flex-shrink:0; transition:background .15s,color .15s,border-color .15s; padding:0; }
.rd-icon-btn:hover { background:var(--rd-primary); color:#fff; border-color:var(--rd-primary); }
.rd-action-cell { white-space:nowrap; width:1%; }

/* Settings full-width overrides */
.rd-settings-stack { display:flex; flex-direction:column; gap:18px; }
.rd-api-key-wrap { display:flex; align-items:center; gap:10px; }
.rd-api-key-mask { font-family:ui-monospace,monospace; font-size:.85rem; letter-spacing:.12em; color:var(--rd-muted); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-api-key-real { font-family:ui-monospace,monospace; font-size:.78rem; word-break:break-all; flex:1; }
.rd-reveal-form { display:flex; gap:8px; margin-top:10px; align-items:center; flex-wrap:wrap; }
.rd-reveal-form input { flex:1; min-width:0; }
.rd-settings-row { display:grid; grid-template-columns:1fr 1fr 1fr; gap:18px; }
@media(max-width:768px) { .rd-settings-row { grid-template-columns:1fr; } }

/* ==========================================================================
   Blog Form – section dividers, slug toggle, tags, image preview, SEO counters
   ========================================================================== */
.rd-form-section { margin: 6px 0 -4px; padding-top: 14px; border-top: 1px solid var(--rd-border); }
.rd-form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.rd-form-section h6 { display:flex; align-items:center; gap:8px; margin:0 0 2px; font-size:.88rem; font-weight:900; color:var(--rd-text); }
.rd-form-section h6 i { color: var(--rd-primary); }

.rd-input-group { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.rd-input-group .rd-control { flex:1; min-width:160px; }
.rd-checkbox-inline { display:flex; align-items:center; gap:6px; font-size:.78rem; font-weight:700; color:var(--rd-muted); white-space:nowrap; cursor:pointer; }
.rd-checkbox-inline input { width:auto; min-height:auto; }

.rd-tag-suggestions { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.rd-tag-chip { border:1px solid var(--rd-border); background:var(--rd-surface-2); color:var(--rd-muted); border-radius:999px; padding:4px 10px; font-size:.74rem; font-weight:800; cursor:pointer; transition:.15s ease; }
.rd-tag-chip:hover { border-color:var(--rd-primary); color:var(--rd-primary); background:rgba(63,81,181,.06); }

.rd-image-preview { margin-top:8px; width:100%; max-width:280px; height:120px; border-radius:14px; border:1px solid var(--rd-border); background-color:var(--rd-surface-2); background-size:cover; background-position:center; background-repeat:no-repeat; }

.rd-char-counter { float:right; font-weight:700; color:var(--rd-muted); }
.rd-char-counter.rd-char-over { color: var(--rd-danger); }

.rd-pill.info, .rd-status.info { background:rgba(63,81,181,.12); color:var(--rd-primary); }

/* TinyMCE inside modals: keep the toolbar usable on small screens */
.rd-richtext-wrap .tox-tinymce { border-radius: 14px; border-color: var(--rd-border); }
.rd-modal .tox-tinymce-aux { z-index: 1080; }

/* ==========================================================================
   Blog Preview Modal
   ========================================================================== */
.rd-blog-preview-image { width:100%; height:220px; border-radius:16px; background-color:var(--rd-surface-2); background-size:cover; background-position:center; background-repeat:no-repeat; margin-bottom:14px; }
.rd-blog-preview-title { margin:4px 0 8px; font-weight:900; }
.rd-blog-preview-excerpt { color:var(--rd-muted); font-weight:700; }
.rd-blog-preview-content { line-height:1.7; }
.rd-blog-preview-content img { max-width:100%; border-radius:10px; }
.rd-blog-preview-content table { width:100%; border-collapse:collapse; }
.rd-blog-preview-content table, .rd-blog-preview-content th, .rd-blog-preview-content td { border:1px solid var(--rd-border); padding:6px 10px; }

.rd-seo-card { border:1px solid var(--rd-border); border-radius:14px; padding:14px; background:var(--rd-surface-2); }
.rd-seo-title { color:#1a0dab; font-size:1.05rem; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-seo-desc { color:var(--rd-muted); font-size:.86rem; margin-top:4px; }

/* Published component treatments — driven by the global design theme. */
[data-card-style="outlined"] .rd-panel,
[data-card-style="outlined"] .rd-stat-card { box-shadow:none; border-width:1.5px; }
[data-card-style="flat"] .rd-panel,
[data-card-style="flat"] .rd-stat-card { box-shadow:none; border-color:transparent; }
[data-button-style="solid"] .rd-btn-primary { background:var(--rd-primary); }
[data-button-style="soft"] .rd-btn-primary { background:var(--rd-surface-2); color:var(--rd-primary); box-shadow:none; }

/* ==========================================================================
   Application-wide dark appearance compatibility
   Bootstrap and older page templates contain light utility classes. Mapping
   them back to design tokens keeps every surface readable without changing
   intentionally branded/photographic sections.
   ========================================================================== */
[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-color: var(--rd-text);
    --bs-body-bg: var(--rd-bg);
    --bs-secondary-color: var(--rd-muted);
    --bs-tertiary-bg: var(--rd-surface-2);
    --bs-border-color: var(--rd-border);
    --bs-card-color: var(--rd-text);
    --bs-card-bg: var(--rd-surface);
}
[data-theme="dark"] body,
[data-theme="dark"] main { background-color:var(--rd-bg); color:var(--rd-text); }
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light,
[data-theme="dark"] .card,
[data-theme="dark"] .card-body,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .accordion-item,
[data-theme="dark"] .accordion-button,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .popover { background-color:var(--rd-surface)!important; color:var(--rd-text)!important; border-color:var(--rd-border)!important; }
[data-theme="dark"] .accordion-button:not(.collapsed),
[data-theme="dark"] .nav-tabs .nav-link.active,
[data-theme="dark"] .list-group-item.active { background-color:var(--rd-surface-2)!important; color:var(--rd-text)!important; }
[data-theme="dark"] .card-header,
[data-theme="dark"] .table-light,
[data-theme="dark"] thead,
[data-theme="dark"] .pagination .page-link { background-color:var(--rd-surface-2)!important; color:var(--rd-text)!important; border-color:var(--rd-border)!important; }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select { background-color:var(--rd-surface)!important; color:var(--rd-text)!important; border-color:var(--rd-border)!important; }
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] { background-color:var(--rd-surface-2)!important; color:var(--rd-muted)!important; }
[data-theme="dark"] .nav-link:not(.td-navbar .nav-link),
[data-theme="dark"] .btn-link { color:color-mix(in srgb,var(--rd-primary) 74%,#fff)!important; }
[data-theme="dark"] hr,
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end { border-color:var(--rd-border)!important; }
[data-theme="dark"] .shadow,
[data-theme="dark"] .shadow-sm,
[data-theme="dark"] .shadow-lg { box-shadow:0 18px 42px rgba(0,0,0,.25)!important; }
[data-theme="dark"] iframe { color-scheme:light; }
.cms-image-field .rd-upload-zone{min-height:120px}.cms-image-field .rd-upload-zone-inner{min-height:120px}.cms-image-field .rd-upload-preview{max-width:100%;max-height:110px;object-fit:contain;border-radius:10px}.cms-image-field.is-uploading{opacity:.65;pointer-events:none}

/* Sidebar sub-item label inside a role's permission group (subaccount modal). */
.subaccount-permission-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 6px;
}
.subaccount-permission-sub span {
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .02em;
    color: var(--rd-muted);
}
.subaccount-permission-sub span::before { content: "\21B3"; margin-right: 7px; opacity: .55; }
.subaccount-permission-sub::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rd-border);
}
