/* RQ ERP design tokens — ARCHITECTURE.md Section 14/15 */
:root {
    /* "Tactile Enterprise POS" palette — cobalt/cyan accent on a slate
       structural-chrome top nav, emerald success, amber caution. Token
       NAMES are kept exactly as before (only values changed) so none of
       the 145 view files that style through these had to be touched to
       pick up the new look. */
    --rq-primary: #2563EB;
    --rq-secondary: #0284C7;
    --rq-dark: #0F172A;
    --rq-bg: #F8FAFC;
    --rq-surface: #FFFFFF;
    --rq-text: #172B4D;
    --rq-text-muted: #5B6B85;
    --rq-border: #E2E8F0;
    --rq-success: #059669;
    --rq-warning: #F59E0B;
    --rq-danger: #D64550;
    --rq-info: #3B82C4;
    --rq-sidebar-bg: #FFFFFF;
    --rq-sidebar-text: #5B6B85;
    --rq-sidebar-heading: #97A3BC;
    --rq-sidebar-active: #2563EB;
    --rq-sidebar-active-bg: #EAF2FB;
    --rq-sidebar-border: #EDF1F7;

    /* Structural chrome — the persistent dark top-nav bar (row 1 + row 2
       of .rq-topnav). Deliberately NOT redefined under the dark-mode
       blocks below: the chrome bar stays the same deep slate regardless
       of the app's own light/dark content theme, matching the reference
       design's "always-dark structural chrome" look. */
    --rq-chrome-900: #0F172A;
    --rq-chrome-800: #1E293B;
    --rq-chrome-fg: #E2E8F0;
    --rq-chrome-fg-muted: #94A3B8;
    --rq-chrome-active-bg: rgba(37, 99, 235, .22);

    /* Radius scale — 4px standard controls, 8px containers/cards, pill
       reserved for small status badges only (already how .badge.rounded-pill
       is used app-wide, no change needed there). */
    --rq-radius-sm: .25rem;
    --rq-radius-md: .5rem;
    --rq-radius-full: 9999px;

    /* Bilingual type pair: IBM Plex Sans Arabic + IBM Plex Sans are the
       same type family, drawn together specifically so Arabic and Latin
       text share comparable weight/x-height at the same font-size — the
       usual "Arabic looks smaller/heavier than the English next to it"
       problem a generic Arabic-compatible fallback stack (e.g. Tahoma)
       doesn't solve. One token, so swapping the pair later is a one-line
       change; loaded via <link> in each layout's <head>, not @import
       here (avoids a render-blocking chained request).
       See PdfService.php for the separate, unrelated PDF font stack. */
    --rq-font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;

    /* Spacing scale — replaces ad-hoc rem literals for anything new;
       existing hardcoded values are left alone (not a mass find/replace)
       and migrate opportunistically as their rules are next touched. */
    --rq-space-1: .25rem;
    --rq-space-2: .5rem;
    --rq-space-3: .75rem;
    --rq-space-4: 1rem;
    --rq-space-5: 1.5rem;
    --rq-space-6: 2rem;

    /* Type scale — same rationale as spacing: new/touched rules use
       these, existing untouched rules keep their literal values. */
    --rq-font-size-xs: .75rem;
    --rq-font-size-sm: .8125rem;
    --rq-font-size-base: .9375rem;
    --rq-font-size-lg: 1.0625rem;
    --rq-font-size-xl: 1.25rem;
    --rq-font-size-2xl: 1.5rem;
    --rq-line-height-tight: 1.2;
    --rq-line-height-base: 1.5;

    /* Dark-palette VALUES live here once, in a plain always-on :root
       block, so they can never drift between the two contexts that
       apply them ("@media (prefers-color-scheme: dark)" for
       system-default dark mode, and ":root[data-theme=\"dark\"]" for an
       explicit user choice — CSS has no way to write both conditions as
       one rule, but both can reference these instead of hand-duplicating
       the actual colors). */
    --rq-dark-bg: #0F1B30;
    --rq-dark-surface: #16233C;
    --rq-dark-text: #E7ECF5;
    --rq-dark-text-muted: #93A2BE;
    --rq-dark-border: #26365555;
    --rq-dark-primary: #3B82F6;
    --rq-dark-secondary: #22D3EE;
    --rq-dark-sidebar-bg: #16233C;
    --rq-dark-sidebar-text: #93A2BE;
    --rq-dark-sidebar-heading: #6C7C9E;
    --rq-dark-sidebar-active: #3B82F6;
    --rq-dark-sidebar-active-bg: #1D2E4D;
    --rq-dark-sidebar-border: #26365555;
}

/* Nudges Bootstrap's own --bs-border-radius* variables (every Bootstrap
   component already reads these) toward the reference design's smaller,
   more "enterprise-precise" radius scale instead of Bootstrap's rounder
   default — a one-time global override, not a per-component change. */
:root {
    --bs-border-radius: .25rem;
    --bs-border-radius-sm: .2rem;
    --bs-border-radius-lg: .375rem;
    --bs-border-radius-xl: .5rem;
    --bs-border-radius-xxl: .5rem;
}

/* Material Symbols Outlined — standard usage block per Google's own
   recommended CSS (font link is in each layout's <head>). direction:ltr
   keeps icon glyphs from being bidi-reordered inside an RTL page, since
   they're symbols, not text. font-size is 1em (inherits the parent
   element's size), matching how the Bootstrap Icons <i> tags this phase
   replaced always behaved (no fixed size of their own) — dozens of these
   sit inside badges/buttons/table cells at many different contextual
   sizes; anything needing a specific size overrides it locally (see
   .rq-navtab's icons below, or inline, same as before). */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1em;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

/* Tabular figures for any numeric/report column — apply this class
   wherever digits line up in a column so they align visually. */
.rq-numeric {
    font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --rq-bg: var(--rq-dark-bg);
        --rq-surface: var(--rq-dark-surface);
        --rq-text: var(--rq-dark-text);
        --rq-text-muted: var(--rq-dark-text-muted);
        --rq-border: var(--rq-dark-border);
        --rq-primary: var(--rq-dark-primary);
        --rq-secondary: var(--rq-dark-secondary);
        --rq-sidebar-bg: var(--rq-dark-sidebar-bg);
        --rq-sidebar-text: var(--rq-dark-sidebar-text);
        --rq-sidebar-heading: var(--rq-dark-sidebar-heading);
        --rq-sidebar-active: var(--rq-dark-sidebar-active);
        --rq-sidebar-active-bg: var(--rq-dark-sidebar-active-bg);
        --rq-sidebar-border: var(--rq-dark-sidebar-border);
    }
}

:root[data-theme="dark"] {
    --rq-bg: var(--rq-dark-bg);
    --rq-surface: var(--rq-dark-surface);
    --rq-text: var(--rq-dark-text);
    --rq-text-muted: var(--rq-dark-text-muted);
    --rq-border: var(--rq-dark-border);
    --rq-primary: var(--rq-dark-primary);
    --rq-secondary: var(--rq-dark-secondary);
    --rq-sidebar-bg: var(--rq-dark-sidebar-bg);
    --rq-sidebar-text: var(--rq-dark-sidebar-text);
    --rq-sidebar-heading: var(--rq-dark-sidebar-heading);
    --rq-sidebar-active: var(--rq-dark-sidebar-active);
    --rq-sidebar-active-bg: var(--rq-dark-sidebar-active-bg);
    --rq-sidebar-border: var(--rq-dark-sidebar-border);
}

body {
    background: var(--rq-bg);
    color: var(--rq-text);
    font-family: var(--rq-font-family);
    font-size: var(--rq-font-size-base);
    line-height: var(--rq-line-height-base);
}

a { color: var(--rq-primary); }

/* Top nav shell — a persistent two-row dark "structural chrome" bar,
   replacing the old left sidebar entirely (the left sidebar markup now
   only survives as the mobile offcanvas drawer below, reusing .rq-sidebar
   for that one remaining context). Row 1 (brand/search/utilities) sits on
   --rq-chrome-900; row 2 (horizontal section tabs) sits one shade lighter
   on --rq-chrome-800, matching the reference design's two-tier header. */
.rq-topnav {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.rq-topnav-row1 {
    background: var(--rq-chrome-900);
    height: 64px;
}

.rq-topnav-row2 {
    background: var(--rq-chrome-800);
    min-height: 48px;
    /* No overflow-x/scroll here: Bootstrap positions a dropdown-menu as a
       plain sibling of its trigger (no portal/append-to-body), so any
       ancestor with overflow set clips the open menu instead of letting
       it float above the page — this was cutting off/hiding every
       section's submenu. Row 2 only ever renders at lg+ widths (d-none
       d-lg-flex), so wrapping to a second line on a narrower desktop is
       an acceptable trade-off for menus that actually open correctly. */
    flex-wrap: wrap;
    row-gap: .25rem;
    column-gap: .25rem;
    padding-block: .25rem;
}

.rq-brand-word {
    color: var(--rq-chrome-fg) !important;
}

/* Row-1 utility controls (search, quick-add trigger aside, theme/lang/
   notifications icon buttons, user chip) need a dark-chrome-friendly
   look — scoped to row 1 so .rq-icon-btn/.rq-quicknav/.rq-user-chip keep
   their normal light-surface styling everywhere else they're used. */
/* Pinned explicitly (not just color) because enterprise-table.css's own
   .rq-icon-btn rule (32px square, for dense row actions) loads after this
   file and would otherwise win on width/height/border-radius for equal
   specificity — this 2-class selector outranks that 1-class one regardless
   of load order, so the top-nav buttons stay a deliberate 38px circle. */
.rq-topnav-row1 .rq-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .16);
    color: var(--rq-chrome-fg);
}

.rq-topnav-row1 .rq-quicknav input {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .16);
    color: var(--rq-chrome-fg);
}

.rq-topnav-row1 .rq-quicknav input::placeholder {
    color: var(--rq-chrome-fg-muted);
}

.rq-topnav-row1 .rq-quicknav-icon {
    color: var(--rq-chrome-fg-muted);
}

.rq-topnav-row1 .rq-user-chip .small {
    color: var(--rq-chrome-fg);
}

.rq-topnav-row1 .rq-user-chip .text-muted {
    color: var(--rq-chrome-fg-muted) !important;
}

/* Row-2 horizontal section tabs — replace the old vertical accordion
   nav-links; each section is now a dropdown trigger (or, for Dashboard,
   a plain link) instead of a collapsible group. */
.rq-navtab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .9rem;
    border-radius: var(--rq-radius-sm);
    font-size: .85rem;
    color: var(--rq-chrome-fg-muted);
    text-decoration: none;
    background: none;
    border: none;
    white-space: nowrap;
}

.rq-navtab .material-symbols-outlined {
    font-size: 1.05rem;
}

.rq-navtab:hover {
    color: var(--rq-chrome-fg);
    background: rgba(255, 255, 255, .06);
}

.rq-navtab.active {
    color: #fff;
    background: var(--rq-chrome-active-bg);
    box-shadow: inset 0 -2px 0 var(--rq-primary);
}

.rq-sidebar {
    background: var(--rq-sidebar-bg);
    color: var(--rq-sidebar-text);
    min-height: 100vh;
    width: 264px;
    border-inline-end: 1px solid var(--rq-sidebar-border);
}

.rq-sidebar .nav-link {
    color: var(--rq-sidebar-text);
    border-radius: .6rem;
    margin-inline: .5rem;
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: .55rem;
}

.rq-sidebar .nav-link.active,
.rq-sidebar .nav-link:hover {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-sidebar-active);
}

.rq-sidebar .nav-link.disabled {
    color: var(--rq-text-muted);
    opacity: .55;
}

.rq-sidebar .badge-soon {
    font-size: .65rem;
}

/* ---- Permanent desktop sidebar — an opt-in alternative to .rq-topnav's
   row-2 horizontal tabs (toggled per-user via users.nav_layout, see
   layouts/app.php). Reuses the exact same $sidebarSections data and the
   same --rq-sidebar-* tokens as the mobile offcanvas drawer above, so
   both "sidebar" surfaces (overlay and permanent) stay visually
   consistent and both already get dark-mode support for free. ---- */
body[data-nav-layout="sidebar"] {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

body[data-nav-layout="sidebar"] .rq-shell-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.rq-sidebar-main {
    width: 264px;
    flex-shrink: 0;
    background: var(--rq-sidebar-bg);
    color: var(--rq-sidebar-text);
    border-inline-end: 1px solid var(--rq-sidebar-border);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    transition: width .15s ease;
}

.rq-sidebar-main-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem;
    flex-shrink: 0;
}

.rq-sidebar-main-brand .rq-sidebar-main-label {
    color: var(--rq-text);
    font-size: 1.1rem;
}

.rq-sidebar-main-nav {
    padding: .5rem;
}

.rq-sidebar-main-link,
.rq-sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .7rem;
    border-radius: .6rem;
    margin-bottom: .15rem;
    font-size: .88rem;
    color: var(--rq-sidebar-text);
    text-decoration: none;
    background: none;
    border: none;
    text-align: start;
}

.rq-sidebar-main-link:hover,
.rq-sidebar-group-toggle:hover {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-sidebar-active);
}

.rq-sidebar-main-link.active,
.rq-sidebar-group-toggle.active {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-sidebar-active);
    font-weight: 600;
}

.rq-sidebar-chevron {
    font-size: 1.1rem !important;
    transition: transform .15s ease;
    margin-inline-start: auto;
}

.rq-sidebar-group-toggle[aria-expanded="true"] .rq-sidebar-chevron {
    transform: rotate(180deg);
}

.rq-sidebar-sub-link {
    display: block;
    padding-block: .45rem;
    padding-inline-start: 2.6rem;
    padding-inline-end: .7rem;
    margin-inline-start: .3rem;
    border-radius: .5rem;
    font-size: .82rem;
    color: var(--rq-text-muted);
    text-decoration: none;
}

.rq-sidebar-sub-link:hover,
.rq-sidebar-sub-link.active {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-sidebar-active);
}

.rq-sidebar-collapse-btn {
    flex-shrink: 0;
    margin: .5rem;
    padding: .5rem;
    border: 1px solid var(--rq-sidebar-border);
    border-radius: .5rem;
    background: none;
    color: var(--rq-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rq-sidebar-collapse-btn:hover {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-sidebar-active);
}

/* Collapsed (icon-only) state — a per-device convenience toggled via JS
   + localStorage (sidebar-main.js), not a server-persisted preference
   like the topnav/sidebar mode choice itself. */
body.rq-sidebar-collapsed .rq-sidebar-main {
    width: 72px;
}

body.rq-sidebar-collapsed .rq-sidebar-main-label,
body.rq-sidebar-collapsed .rq-sidebar-chevron {
    display: none;
}

body.rq-sidebar-collapsed .rq-sidebar-sub-link {
    padding-inline-start: 1rem;
    font-size: .72rem;
    text-align: center;
}

body.rq-sidebar-collapsed .rq-sidebar-main-link,
body.rq-sidebar-collapsed .rq-sidebar-group-toggle {
    justify-content: center;
}

body.rq-sidebar-collapsed .rq-sidebar-collapse-btn .material-symbols-outlined {
    transform: rotate(180deg);
}

.rq-brand-mark {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.rq-brand-mark .rq-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: .65rem;
    background: linear-gradient(135deg, var(--rq-primary), var(--rq-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}

.card {
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-md);
}

.rq-quicknav {
    position: relative;
    width: 260px;
}

.rq-quicknav input {
    border-radius: 2rem;
    background: var(--rq-bg);
    border-color: var(--rq-border);
    padding-inline-start: 2.25rem;
}

.rq-quicknav-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: .75rem;
    transform: translateY(-50%);
    color: var(--rq-text-muted);
    pointer-events: none;
}

.rq-quicknav-results {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 4px);
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    border-radius: .6rem;
    box-shadow: 0 8px 24px rgba(23, 43, 77, .12);
    z-index: 1050;
    overflow: hidden;
}

.rq-quicknav-results a {
    display: block;
    padding: .5rem .85rem;
    font-size: .85rem;
    color: var(--rq-text);
    text-decoration: none;
}

.rq-quicknav-results a:hover,
.rq-quicknav-results a.active {
    background: var(--rq-sidebar-active-bg);
    color: var(--rq-primary);
}

.rq-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rq-bg);
    border: 1px solid var(--rq-border);
    color: var(--rq-text);
    position: relative;
    font-size: 1.05rem;
}

.rq-icon-btn .badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    font-size: .62rem;
    padding: .2rem .38rem;
}

.rq-user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
}

.rq-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--rq-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

/* Dashboard: KPI cards */
.rq-kpi-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.1rem;
}

.rq-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.rq-kpi-icon-primary { background: rgba(37, 99, 235, .12); color: var(--rq-primary); }
.rq-kpi-icon-success { background: rgba(5, 150, 105, .12); color: var(--rq-success); }
.rq-kpi-icon-info { background: rgba(59, 130, 196, .12); color: var(--rq-info); }
.rq-kpi-icon-warning { background: rgba(245, 158, 11, .14); color: var(--rq-warning); }
.rq-kpi-icon-secondary { background: rgba(2, 132, 199, .12); color: var(--rq-secondary); }
.rq-kpi-icon-danger { background: rgba(214, 69, 80, .12); color: var(--rq-danger); }

.rq-kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.rq-kpi-delta-up { color: var(--rq-success); }
.rq-kpi-delta-down { color: var(--rq-danger); }

/* Stat cards — a denser, 4-up alternative to .rq-kpi-card used on list
   screens (Products catalog first; reusable as-is by Reports Hub/Sales
   Analytics once their own turn comes), matching the reference design's
   "stat tile with a corner icon + a big number + a small footnote" shape. */
.rq-stat-card {
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-md);
    padding: var(--rq-space-4);
    height: 100%;
}

.rq-stat-card-label {
    font-size: var(--rq-font-size-xs);
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--rq-text-muted);
    font-weight: 600;
}

.rq-stat-card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--rq-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rq-stat-card-icon-primary { background: rgba(37, 99, 235, .12); color: var(--rq-primary); }
.rq-stat-card-icon-secondary { background: rgba(2, 132, 199, .12); color: var(--rq-secondary); }
.rq-stat-card-icon-danger { background: rgba(214, 69, 80, .12); color: var(--rq-danger); }
.rq-stat-card-icon-warning { background: rgba(245, 158, 11, .14); color: var(--rq-warning); }
.rq-stat-card-icon-success { background: rgba(5, 150, 105, .12); color: var(--rq-success); }
.rq-stat-card-icon-info { background: rgba(59, 130, 196, .12); color: var(--rq-info); }

.rq-stat-card-value {
    font-size: var(--rq-font-size-2xl);
    font-weight: 700;
    margin-top: var(--rq-space-2);
    font-variant-numeric: tabular-nums;
}

.rq-stat-card-foot {
    font-size: var(--rq-font-size-xs);
    color: var(--rq-text-muted);
    margin-top: var(--rq-space-1);
}

/* Quick Inspector — master-detail panel on the Products catalog (and,
   later, any other list screen that adopts the same pattern). */
.rq-inspector-panel {
    position: sticky;
    top: calc(64px + 48px + var(--rq-space-4));
}

.rq-inspector-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rq-success);
    display: inline-block;
}

.rq-inspector-block {
    background: var(--rq-bg);
    border-radius: var(--rq-radius-sm);
    padding: var(--rq-space-3);
}

.rq-inspector-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--rq-radius-sm);
    background: var(--rq-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rq-secondary);
    flex-shrink: 0;
}

.rq-inspector-tier {
    background: var(--rq-bg);
    border-radius: var(--rq-radius-sm);
    padding: var(--rq-space-2);
}

.rq-barcode-bars {
    background: var(--rq-bg);
    border-radius: var(--rq-radius-sm);
    padding: var(--rq-space-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rq-barcode-svg {
    height: 40px;
    max-width: 100%;
    fill: var(--rq-text);
}

/* Highlights the catalog row whose detail is currently shown in the
   Quick Inspector panel — kept distinct from the plain :hover state. */
tr.rq-product-row-selected {
    background: color-mix(in srgb, var(--rq-primary) 6%, var(--rq-surface)) !important;
    box-shadow: inset 3px 0 0 var(--rq-primary);
}

/* Dashboard: compact widget cards (mosaic grid) */
.rq-widget-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rq-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--rq-border);
}

.rq-widget-header h2 {
    font-size: .95rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.rq-widget-body {
    padding: .9rem 1.1rem;
    flex-grow: 1;
}

.rq-widget-table {
    width: 100%;
    font-size: .82rem;
}

.rq-widget-table th {
    color: var(--rq-text-muted);
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding-block: .4rem;
    border-bottom: 1px solid var(--rq-border);
}

.rq-widget-table td {
    padding-block: .55rem;
    border-bottom: 1px solid var(--rq-border);
    vertical-align: middle;
}

.rq-widget-table tr:last-child td {
    border-bottom: none;
}

.rq-stat-row {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    margin-bottom: .85rem;
}

.rq-stat-pill {
    flex: 1 0 auto;
    min-width: 108px;
    background: var(--rq-bg);
    border-radius: .6rem;
    padding: .55rem .7rem;
}

.rq-stat-pill .rq-stat-value {
    font-weight: 700;
    font-size: 1.05rem;
}

.rq-stat-pill .rq-stat-label {
    font-size: .72rem;
    color: var(--rq-text-muted);
}

.rq-usage-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.rq-usage-row:last-child {
    margin-bottom: 0;
}

.rq-usage-icon {
    width: 36px;
    height: 36px;
    border-radius: .6rem;
    background: var(--rq-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rq-donut-wrap {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin-inline: auto;
}

.rq-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.rq-donut-center .rq-donut-total {
    font-size: 1.5rem;
    font-weight: 700;
}

.rq-donut-center .rq-donut-label {
    font-size: .7rem;
    color: var(--rq-text-muted);
}

.rq-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-inline-end: .4rem;
}

.rq-report-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .7rem;
    border-radius: .6rem;
    border: 1px solid var(--rq-border);
    text-decoration: none;
    color: var(--rq-text);
    font-size: .82rem;
    height: 100%;
}

.rq-report-chip:hover {
    background: var(--rq-sidebar-active-bg);
    border-color: var(--rq-primary);
    color: var(--rq-primary);
}

.rq-report-card {
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.rq-report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(23, 43, 77, .08);
    border-color: var(--rq-primary);
}

.btn-primary {
    background-color: var(--rq-primary);
    border-color: var(--rq-primary);
}

.btn-primary:hover {
    filter: brightness(0.92);
}

.text-rq-secondary { color: var(--rq-secondary); }
.bg-rq-success { background: var(--rq-success); }
.badge-status-active { background: var(--rq-success); }
.badge-status-trialing { background: var(--rq-info); }
.badge-status-past_due, .badge-status-suspended { background: var(--rq-warning); color: #3a2a00; }
.badge-status-cancelled, .badge-status-expired { background: var(--rq-danger); }

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    max-width: 440px;
    width: 100%;
}

.rq-brand {
    font-weight: 700;
    color: var(--rq-primary);
}

/* CMS-style admin screens (Website Builder first; reusable by any future
   single-page settings screen) — pill section tabs + clean list rows,
   mirroring a "dashboard with one page per section" admin's own visual
   language (stat cards, pill nav, hover-row tables) without actually
   splitting the page into separate routes. */
.rq-cms-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rq-space-2);
    margin-bottom: var(--rq-space-4);
}

.rq-cms-tab {
    padding: .5em 1.1em;
    border-radius: var(--rq-radius-full);
    font-size: .86rem;
    font-weight: 600;
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    color: var(--rq-text-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.rq-cms-tab .material-symbols-outlined {
    font-size: 1rem;
    vertical-align: middle;
    margin-inline-end: .25em;
}

.rq-cms-tab:hover:not(.active) {
    border-color: var(--rq-primary);
    color: var(--rq-primary);
}

.rq-cms-tab.active {
    background: var(--rq-chrome-900);
    color: #fff;
    border-color: var(--rq-chrome-900);
}

.rq-cms-tabpane {
    display: none;
}

.rq-cms-tabpane.active {
    display: block;
}

.rq-cms-row {
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-md);
    padding: var(--rq-space-3);
    margin-bottom: var(--rq-space-2);
    transition: border-color .15s ease, background .15s ease;
}

.rq-cms-row:hover {
    border-color: var(--rq-primary);
    background: var(--rq-bg);
}

.rq-cms-row-remove {
    width: 30px;
    height: 30px;
    border-radius: var(--rq-radius-sm);
    border: 1px solid var(--rq-border);
    background: var(--rq-surface);
    color: var(--rq-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rq-cms-row-remove:hover {
    border-color: var(--rq-danger);
    color: var(--rq-danger);
}

.rq-admin-table {
    width: 100%;
    border-collapse: collapse;
}

.rq-admin-table th {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--rq-text-muted);
    font-weight: 700;
    padding: .6em .7em;
    border-bottom: 1px solid var(--rq-border);
    text-align: start;
}

.rq-admin-table td {
    padding: .5em .7em;
    border-bottom: 1px solid var(--rq-border);
    vertical-align: middle;
}

.rq-admin-table tbody tr:hover td {
    background: var(--rq-bg);
}

.rq-badge-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.rq-badge-dot-on { background: var(--rq-success); }
.rq-badge-dot-off { background: var(--rq-border); }

/* A bilingual-content input's English counterpart — always typed/read
   left-to-right regardless of the page's own RTL direction. */
.eng { direction: ltr; text-align: left; }

/* ====================================================================
   Platform Super Admin realm — layouts/platform.php + resources/views/
   platform/*. Deliberately permanent dark-navy chrome regardless of the
   light/dark toggle (same --rq-chrome-* tokens the tenant topnav already
   uses for the same reason), with a light content area — this realm has
   no RTL variant (admin-only, English UI) so no logical-property/dir
   gymnastics are needed here.
   ==================================================================== */

.rq-plat-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    background: var(--rq-bg);
}

.rq-plat-sidebar {
    width: 268px;
    flex-shrink: 0;
    background: var(--rq-chrome-900);
    color: var(--rq-chrome-fg);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.rq-plat-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.1rem 1.1rem .9rem;
    flex-shrink: 0;
    color: #fff;
    text-decoration: none;
}

.rq-plat-sidebar-brand .rq-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: .65rem;
    background: linear-gradient(135deg, var(--rq-primary), var(--rq-secondary));
}

.rq-plat-sidebar-brand-word {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: .01em;
}

.rq-plat-sidebar-nav {
    padding: .5rem .65rem;
    flex: 1;
}

.rq-plat-nav-link,
.rq-plat-nav-toggle {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .6rem .75rem;
    border-radius: .55rem;
    margin-bottom: .1rem;
    font-size: .865rem;
    color: var(--rq-chrome-fg-muted);
    text-decoration: none;
    background: none;
    border: none;
    text-align: start;
}

.rq-plat-nav-link .material-symbols-outlined,
.rq-plat-nav-toggle .material-symbols-outlined {
    font-size: 1.2rem;
}

.rq-plat-nav-link:hover,
.rq-plat-nav-toggle:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.rq-plat-nav-link.active,
.rq-plat-nav-toggle.active {
    background: var(--rq-primary);
    color: #fff;
    font-weight: 600;
}

.rq-plat-nav-chevron {
    font-size: 1.05rem !important;
    margin-inline-start: auto;
    transition: transform .15s ease;
}

.rq-plat-nav-toggle[aria-expanded="true"] .rq-plat-nav-chevron {
    transform: rotate(180deg);
}

.rq-plat-nav-sub {
    display: block;
    padding-block: .45rem;
    padding-inline-start: 2.7rem;
    padding-inline-end: .75rem;
    font-size: .8rem;
    color: var(--rq-chrome-fg-muted);
    text-decoration: none;
    border-radius: .5rem;
}

.rq-plat-nav-sub:hover,
.rq-plat-nav-sub.active {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.rq-plat-sidebar-footer {
    margin: .85rem;
    padding: 1.1rem;
    border-radius: .85rem;
    background: linear-gradient(160deg, var(--rq-chrome-800), #0b1324 85%);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.rq-plat-sidebar-footer::after {
    content: "";
    position: absolute;
    inset-inline-end: -30px;
    bottom: -30px;
    width: 120px;
    height: 80px;
    background: radial-gradient(ellipse at bottom right, rgba(37, 99, 235, .45), transparent 70%);
}

.rq-plat-sidebar-footer-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .6rem;
    position: relative;
}

.rq-plat-sidebar-footer-brand .rq-brand-logo {
    width: 26px;
    height: 26px;
    border-radius: .5rem;
    font-size: .75rem;
}

.rq-plat-sidebar-footer-title {
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: .2rem;
    position: relative;
}

.rq-plat-sidebar-footer-text {
    color: var(--rq-chrome-fg-muted);
    font-size: .72rem;
    position: relative;
}

/* ---- Top bar ---- */
.rq-plat-topbar {
    background: var(--rq-surface);
    border-bottom: 1px solid var(--rq-border);
    padding: .9rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rq-plat-topbar-icon {
    width: 42px;
    height: 42px;
    border-radius: .75rem;
    background: rgba(37, 99, 235, .1);
    color: var(--rq-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rq-plat-topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--rq-text);
    margin: 0;
    line-height: 1.2;
}

.rq-plat-topbar-subtitle {
    font-size: .8rem;
    color: var(--rq-text-muted);
}

.rq-plat-user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding-inline-start: .75rem;
    border-inline-start: 1px solid var(--rq-border);
    text-decoration: none;
    color: var(--rq-text);
}

.rq-plat-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--rq-bg);
    border: 1px solid var(--rq-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rq-text-muted);
    flex-shrink: 0;
}

.rq-plat-user-name {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
}

.rq-plat-user-role {
    font-size: .72rem;
    color: var(--rq-text-muted);
}

/* ---- Stat tiles: full pastel-tinted card background (not just the icon),
   matching the reference design's KPI grid. Each tone pairs a soft card
   background with a solid icon-badge color. ---- */
.rq-plat-stat {
    border-radius: var(--rq-radius-md);
    padding: 1.1rem 1.2rem;
    height: 100%;
    border: 1px solid transparent;
}

.rq-plat-stat-head {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.rq-plat-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.rq-plat-stat-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--rq-text-muted);
}

.rq-plat-stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    margin-top: .6rem;
    font-variant-numeric: tabular-nums;
    color: var(--rq-text);
}

.rq-plat-stat-foot {
    font-size: .76rem;
    margin-top: .25rem;
    color: var(--rq-text-muted);
    display: flex;
    align-items: center;
    gap: .25rem;
}

.rq-plat-stat-foot .material-symbols-outlined {
    font-size: .95rem;
}

.rq-plat-stat-foot.up { color: var(--rq-success); }
.rq-plat-stat-foot.down { color: var(--rq-danger); }

.rq-plat-stat-blue   { background: #EBF2FE; } .rq-plat-stat-blue .rq-plat-stat-icon   { background: var(--rq-primary); }
.rq-plat-stat-green  { background: #E9F8F1; } .rq-plat-stat-green .rq-plat-stat-icon  { background: var(--rq-success); }
.rq-plat-stat-violet { background: #F2EDFC; } .rq-plat-stat-violet .rq-plat-stat-icon { background: #7C3AED; }
.rq-plat-stat-orange { background: #FDECE9; } .rq-plat-stat-orange .rq-plat-stat-icon { background: #E25B45; }
.rq-plat-stat-teal    { background: #E7F6F6; } .rq-plat-stat-teal .rq-plat-stat-icon    { background: #0D9488; }
.rq-plat-stat-red    { background: #FCEAEC; } .rq-plat-stat-red .rq-plat-stat-icon    { background: var(--rq-danger); }
.rq-plat-stat-indigo { background: #ECEBFC; } .rq-plat-stat-indigo .rq-plat-stat-icon { background: #5B4FE5; }

/* ---- Content cards, chart tabs, tables, activity feed, quick actions,
   status list — the dashboard's lower sections. ---- */
.rq-plat-card {
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-md);
    padding: 1.25rem;
    height: 100%;
}

.rq-plat-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rq-text);
    margin: 0;
}

.rq-plat-tabs {
    display: inline-flex;
    background: var(--rq-bg);
    border: 1px solid var(--rq-border);
    border-radius: .6rem;
    padding: .2rem;
    gap: .15rem;
}

.rq-plat-tab {
    border: none;
    background: none;
    padding: .35rem .85rem;
    border-radius: .45rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--rq-text-muted);
}

.rq-plat-tab.active {
    background: var(--rq-primary);
    color: #fff;
}

.rq-plat-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .78rem;
    color: var(--rq-text-muted);
}

.rq-plat-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-inline-end: .35rem;
}

.rq-plat-table {
    width: 100%;
    font-size: .84rem;
}

.rq-plat-table th {
    text-align: start;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--rq-text-muted);
    font-weight: 600;
    padding-block: .5rem;
    border-bottom: 1px solid var(--rq-border);
}

.rq-plat-table td {
    padding-block: .65rem;
    border-bottom: 1px solid var(--rq-border);
    vertical-align: middle;
}

.rq-plat-table tr:last-child td {
    border-bottom: none;
}

.rq-plat-tenant-name {
    font-weight: 600;
    color: var(--rq-text);
}

.rq-plat-tenant-domain {
    font-size: .75rem;
    color: var(--rq-text-muted);
}

.rq-plat-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 2rem;
    font-size: .72rem;
    font-weight: 600;
}

.rq-plat-pill-blue   { background: #EBF2FE; color: var(--rq-primary); }
.rq-plat-pill-green  { background: #E9F8F1; color: var(--rq-success); }
.rq-plat-pill-amber  { background: #FDF3E3; color: #B45309; }
.rq-plat-pill-gray   { background: var(--rq-bg); color: var(--rq-text-muted); }

.rq-plat-activity-item {
    display: flex;
    gap: .7rem;
    padding-block: .55rem;
}

.rq-plat-activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.rq-plat-activity-icon-primary { background: rgba(37, 99, 235, .12); color: var(--rq-primary); }
.rq-plat-activity-icon-success { background: rgba(5, 150, 105, .12); color: var(--rq-success); }
.rq-plat-activity-icon-info    { background: rgba(13, 148, 136, .12); color: #0D9488; }

.rq-plat-activity-label {
    font-size: .82rem;
    color: var(--rq-text);
}

.rq-plat-activity-time {
    font-size: .72rem;
    color: var(--rq-text-muted);
}

.rq-plat-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .9rem .5rem;
    border-radius: .7rem;
    background: var(--rq-bg);
    border: 1px solid var(--rq-border);
    color: var(--rq-text);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 600;
    text-align: center;
}

.rq-plat-quick-action:hover {
    border-color: var(--rq-primary);
    color: var(--rq-primary);
}

.rq-plat-quick-action .material-symbols-outlined {
    font-size: 1.5rem;
    color: var(--rq-primary);
}

.rq-plat-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: .55rem;
    border-bottom: 1px solid var(--rq-border);
    font-size: .83rem;
}

.rq-plat-status-item:last-child { border-bottom: none; }

.rq-plat-status-label {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--rq-text);
}

.rq-plat-status-label .material-symbols-outlined {
    font-size: 1.05rem;
    color: var(--rq-text-muted);
}

.rq-plat-status-dot {
    display: inline-block;
    padding: .18rem .55rem;
    border-radius: 2rem;
    font-size: .72rem;
    font-weight: 600;
}

.rq-plat-status-dot.online { background: #E9F8F1; color: var(--rq-success); }
.rq-plat-status-dot.offline { background: #FCEAEC; color: var(--rq-danger); }

@media (max-width: 991.98px) {
    .rq-plat-sidebar { display: none; }
}

/* Printing any app page (reports, invoices-in-browser, etc.): drop the
   sidebar/navbar/offcanvas/buttons and let the content fill the sheet.
   Anything meant to disappear on paper carries [data-no-print]. */
@media print {
    .rq-sidebar, .rq-topnav, .offcanvas, [data-no-print] {
        display: none !important;
    }
    main {
        padding: 0 !important;
    }
    body {
        background: #fff !important;
    }
    .card {
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
    a {
        color: inherit !important;
        text-decoration: none !important;
    }
}
