﻿/* =============================================================
   RaqmiERP — Design System
   Bootstrap 5.3 + Tabler / Bootstrap Icons + IBM Plex
   Achromatic palette · light + dark · enterprise SaaS
   ============================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
    /* Zinc scale (light is default) */
    --zinc-50:  #fafafa;
    --zinc-100: #f4f4f5;
    --zinc-200: #e4e4e7;
    --zinc-300: #d4d4d8;
    --zinc-400: #a1a1aa;
    --zinc-500: #71717a;
    --zinc-600: #52525b;
    --zinc-700: #3f3f46;
    --zinc-800: #27272a;
    --zinc-900: #18181b;
    --zinc-950: #09090b;

    /* Semantic — light */
    --bg-app:        var(--zinc-50);
    --bg-surface:    #ffffff;
    --bg-elevated:   #ffffff;
    --bg-muted:      var(--zinc-100);
    --bg-hover:      rgba(24, 24, 27, .04);
    --bg-active:     rgba(24, 24, 27, .07);

    --border-subtle: rgba(24, 24, 27, .08);
    --border-default:var(--zinc-200);
    --border-strong: var(--zinc-300);

    /* Every text tier must pass WCAG AA (4.5:1) on white AND on --bg-muted: the counter staff
       read these all day, many with older eyes. faint was zinc-400 (2.6:1) and muted zinc-500
       (4.4:1 on a grey band) - labels and table headers read as washed out. Hierarchy now comes
       from size and weight more than from lightness. */
    --text-primary:  var(--zinc-900);   /* 17.7:1 */
    --text-secondary:var(--zinc-700);   /* 10.4:1 */
    --text-muted:    var(--zinc-600);   /*  7.7:1 */
    --text-faint:    var(--zinc-500);   /*  4.8:1 - placeholders, decoration; never a label */
    --text-inverse:  #ffffff;
    --bg-inverse:    var(--zinc-900);

    --accent:        var(--zinc-900);
    --accent-hover:  var(--zinc-800);
    --accent-fg:     #ffffff;

    /* The 700 shades: the 600s failed AA as text (success 3.3:1, warning 3.2:1, danger 4.2:1 on
       its own tint). The tints stay on the 600 hue so badges keep their colour. */
    --success:       #15803d;   /* green-700, 5.0:1 */
    --success-bg:    rgba(22, 163, 74, .10);
    --danger:        #b91c1c;   /* red-700,   6.5:1 */
    --danger-bg:     rgba(220, 38, 38, .10);
    --warning:       #b45309;   /* amber-700, 5.0:1 */
    --warning-bg:    rgba(217, 119, 6, .10);

    /* Bootstrap's own .text-danger / .text-success / .border-danger read these, not ours. */
    --bs-danger:     #b91c1c;
    --bs-danger-rgb: 185, 28, 28;
    --bs-success:    #15803d;
    --bs-success-rgb: 21, 128, 61;
    --info:          var(--zinc-700);
    --info-bg:       rgba(63, 63, 70, .07);

    --ring:          rgba(24, 24, 27, .12);
    --ring-focus:    rgba(24, 24, 27, .25);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .03);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .04);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
    --shadow-xl: 0 4px 16px rgba(0, 0, 0, .06), 0 20px 40px rgba(0, 0, 0, .08);

    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    /* IBM Plex Sans Arabic follows IBM Plex Sans so Arabic text inside the English UI (service names,
       Arabic names) picks up IBM Plex Sans Arabic per glyph with clean unicode-range fallback. */
    --font-sans: 'IBM Plex Sans', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --sidebar-w:           260px;
    --sidebar-w-collapsed: 72px;
    --topbar-h:            56px;

    --sidebar-link-color:  #0a0a0a;
    --sidebar-link-icon:   #3f3f46;
    --sidebar-group-color: #52525b;

    --transition-fast: 120ms cubic-bezier(.4, 0, .2, 1);
    --transition:      180ms cubic-bezier(.4, 0, .2, 1);
}

/* Dark theme via Bootstrap data-bs-theme attribute */
[data-bs-theme="dark"] {
    --bg-app:        #0a0a0b;
    --bg-surface:    #121214;
    --bg-elevated:   #18181b;
    --bg-muted:      #1c1c1f;
    --bg-hover:      rgba(255, 255, 255, .04);
    --bg-active:     rgba(255, 255, 255, .07);

    --border-subtle: rgba(255, 255, 255, .06);
    --border-default:rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .12);

    --text-primary:  #fafafa;
    --text-secondary:#d4d4d8;
    --text-muted:    #b4b4bb;   /* 9.6:1 on --bg-surface */
    --text-faint:    #a1a1aa;   /* 7.5:1 - was #71717a, 3.9:1 */
    --text-inverse:  var(--zinc-900);
    --bg-inverse:    #fafafa;

    --accent:        #fafafa;
    --accent-hover:  #e4e4e7;
    --accent-fg:     var(--zinc-900);

    --success:       #22c55e;
    --success-bg:    rgba(34, 197, 94, .12);
    --danger:        #ef4444;
    --danger-bg:     rgba(239, 68, 68, .12);
    --warning:       #f59e0b;
    --warning-bg:    rgba(245, 158, 11, .12);
    /* Undo the light theme's darker Bootstrap status colours - a 700 shade is unreadable on dark. */
    --bs-danger:     #ef4444;
    --bs-danger-rgb: 239, 68, 68;
    --bs-success:    #22c55e;
    --bs-success-rgb: 34, 197, 94;
    --info:          #d4d4d8;
    --info-bg:       rgba(255, 255, 255, .06);

    --ring:          rgba(255, 255, 255, .12);
    --ring-focus:    rgba(255, 255, 255, .28);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .25);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, .5), 0 24px 48px rgba(0, 0, 0, .55);

    --sidebar-link-color: #e4e4e7;
    --sidebar-link-icon:  #a1a1aa;
    --sidebar-group-color:#71717a;
}

/* Accent color themes — opt-in via [data-theme-color] on <html>.
   Default (no attribute, or "default") stays the zinc accent above untouched. */
/* "green" = the shadcn emerald scheme (docs/green_color_scheme.txt): primary emerald-700 on
   emerald-50, zinc neutrals, a LIGHT sidebar with an emerald active item. OKLCH as given there. */
[data-theme-color="green"]  {
    --accent:       oklch(0.508 0.118 165.612);   /* emerald-700 */
    /* shadcn's hover:bg-primary/90 - the same green at 90%, so it LIGHTENS on hover. */
    --accent-hover: oklch(0.508 0.118 165.612 / .9);
    --accent-fg:    oklch(0.979 0.021 166.113);   /* emerald-50  */
    --shadow-xs: 0 1px 3px 0 oklch(0 0 0 / .05);
    --shadow-sm: 0 1px 3px 0 oklch(0 0 0 / .10), 0 1px 2px -1px oklch(0 0 0 / .10);
    --shadow-md: 0 1px 3px 0 oklch(0 0 0 / .10), 0 2px 4px -1px oklch(0 0 0 / .10);
    --shadow-lg: 0 1px 3px 0 oklch(0 0 0 / .10), 0 4px 6px -1px oklch(0 0 0 / .10);
    --shadow-xl: 0 1px 3px 0 oklch(0 0 0 / .10), 0 8px 10px -1px oklch(0 0 0 / .10);
}
/* "maroon" = the shadcn red scheme (docs/red_color_scheme.txt), built like Emerald, but toned
   from its red-700 (0.505 0.213 27.5 - read as a "1000-watt LED" on a full-width button) to
   #C0392B, the client's pick: ~20% less chroma, a touch warmer. hover = primary/90 as in shadcn. */
[data-theme-color="maroon"] {
    --accent:       oklch(0.543 0.174 29.70);          /* #C0392B, white on it 5.4:1 */
    --accent-hover: oklch(0.543 0.174 29.70 / .9);     /* shadcn hover:bg-primary/90 */
    --accent-fg:    oklch(0.971 0.013 17.38);          /* red-50 */
    --shadow-xs: 0 1px 3px 0 oklch(0 0 0 / .05);
    --shadow-sm: 0 1px 3px 0 oklch(0 0 0 / .10), 0 1px 2px -1px oklch(0 0 0 / .10);
    --shadow-md: 0 1px 3px 0 oklch(0 0 0 / .10), 0 2px 4px -1px oklch(0 0 0 / .10);
    --shadow-lg: 0 1px 3px 0 oklch(0 0 0 / .10), 0 4px 6px -1px oklch(0 0 0 / .10);
    --shadow-xl: 0 1px 3px 0 oklch(0 0 0 / .10), 0 8px 10px -1px oklch(0 0 0 / .10);
}
[data-theme-color="gold"]   { --accent: #92722A; --accent-hover: #816425; --accent-fg: #ffffff; }

[data-bs-theme="dark"][data-theme-color="green"]  {
    --accent:       oklch(0.432 0.095 166.913);   /* emerald-800 */
    --accent-hover: oklch(0.432 0.095 166.913 / .9);   /* primary/90, as in light */
    --accent-fg:    oklch(0.979 0.021 166.113);
}
[data-bs-theme="dark"][data-theme-color="maroon"] {
    --accent:       oklch(0.47 0.15 29.70);            /* #C0392B a step deeper on dark */
    --accent-hover: oklch(0.47 0.15 29.70 / .9);
    --accent-fg:    oklch(0.971 0.013 17.38);
}
[data-bs-theme="dark"][data-theme-color="gold"]   { --accent-hover: #A88E55; }

.theme-color-menu { min-width: 170px; padding: 6px; }
.theme-color-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: .875rem;
    text-align: left;
}
.theme-color-option:hover { background: var(--bg-hover); }
.theme-color-option.active { background: var(--bg-active); font-weight: 600; }
.theme-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    flex: 0 0 auto;
}
.theme-color-swatch-default { background: var(--zinc-900); }
.theme-color-swatch-green   { background: oklch(0.508 0.118 165.612); }
.theme-color-swatch-maroon  { background: oklch(0.543 0.174 29.70); }
.theme-color-swatch-gold    { background: #92722A; }

/* ---------- 2. Base ---------- */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    /* 0, not Geist's -0.005em: Plex is already narrower, and tightening it made small text
       look thinner still on Windows. */
    letter-spacing: 0;
    transition: background-color var(--transition), color var(--transition);
}

/* Compact density for small desktop screens (1366x768, 1280x800, 1440x900 offices). Nearly
   every size in this sheet is rem, so stepping the root down ~13% scales type, spacing and
   tables together — the page reads like it does on a 1080p screen. The fixed px chrome
   (sidebar, topbar) is stepped down alongside it. `screen` keeps printing untouched, and the
   992px floor leaves tablets and phones at their normal, touch-friendly size.
   14px, not 13px: at 13 the sheet's .7rem captions and table headers came out at 9px, which
   counter staff could not find. Still ~7% denser than the 15px base. */
@media screen and (min-width: 992px) and (max-width: 1440px) {
    html, body { font-size: 14px; }
    :root {
        --sidebar-w: 228px;
        --topbar-h:  50px;
    }
}

body { min-height: 100vh; }

/* Low-DPI weight. Plex's 400 has thin strokes, and Windows draws them faint on a 1080p monitor
   at 100-125% scaling (1-1.25 device px per CSS px). There, body text and inputs sit at 450 (the
   variable Plex Sans in fonts.css), which reads about as heavy as Geist did. Phones, Retina Macs
   and 150%+ Windows scaling are 1.5 dppx or more and keep the crisp 400. Arabic and Mono have no
   450 and are pinned to their 400 face in fonts.css, so they do not jump to medium. Explicit
   weights (headings 600, buttons 500, .fw-normal) are untouched. */
@media screen and (max-resolution: 1.49dppx) {
    :root { --bs-body-font-weight: 450; }
    body, .form-control, .form-select { font-weight: 450; }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: .9375rem; }
h6 { font-size: .8125rem; }

code, pre, .font-mono { font-family: var(--font-mono); font-size: .85em; font-variant-numeric: tabular-nums; }

a { color: var(--text-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--text-secondary); }

hr { border-color: var(--border-subtle); opacity: 1; }

/* ---------- 3. Scrollbar ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* ---------- 4. App shell ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    /* dvh tracks the *visible* viewport, so the offcanvas bottom (Administration
       group + footer) is never left behind the mobile browser's URL/tab bar.
       vh above is the fallback for browsers without dvh support. */
    height: 100dvh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1045;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    overflow: hidden;
}

/* Vibrant Solid Brand Sidebar — the accent at full strength.
   Hover/active/border are SHADES (mixed toward black), never white tints: a
   translucent white over a saturated colour reads as a milky film, not a
   highlight, and the always-present active link would wear it permanently. */
html[data-theme-color="gold"] .sidebar {
    background: var(--accent);
    --bg-surface: var(--accent);
    --border-subtle: color-mix(in srgb, var(--accent) 80%, #000000);
    --border-default: color-mix(in srgb, var(--accent) 70%, #000000);
    --border-strong: color-mix(in srgb, var(--accent) 60%, #000000);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.86);
    --text-muted: rgba(255, 255, 255, 0.72);
    --text-faint: rgba(255, 255, 255, 0.58);
    --bg-hover: color-mix(in srgb, var(--accent) 74%, #000000);
    --bg-active: color-mix(in srgb, var(--accent) 58%, #000000);
    --sidebar-link-color: rgba(255, 255, 255, 0.88);
    --sidebar-link-icon: rgba(255, 255, 255, 0.88);
    --sidebar-group-color: rgba(255, 255, 255, 0.66);
    --sidebar-raised: color-mix(in srgb, var(--accent) 86%, #000000);
    --sidebar-raised-hover: color-mix(in srgb, var(--accent) 80%, #000000);
    --sidebar-raised-border: color-mix(in srgb, var(--accent) 64%, #000000);
    --sidebar-danger: #ffffff;
    --sidebar-danger-bg: var(--sidebar-raised-hover);
}

html[data-theme-color="gold"] .sidebar-link.active::before {
    background: #ffffff;
}

/* Emerald ("green") sidebar - deep emerald-950 frame, the same in light and dark mode.
   The scheme's own light sidebar sat on a near-white page with nothing to separate them, and a
   12% tint was too faint a "you are here"; staff read the whole screen as washed out. A near-black
   green gives the page a frame that the emerald buttons and the active item stand out against
   (the old Dark Green filled it with the button colour itself, so nothing did).
   Active item = solid emerald-700 + white: emerald-600 would be the brighter pick but white on it
   is 3.8:1, under AA for a 14px label; 700 is 5.5:1. Overrides the always-dark sidebar further
   down by specificity. */
html[data-theme-color="green"] .sidebar,
html[data-theme-color="green"] .offcanvas.app-offcanvas {
    --sidebar-accent:      oklch(0.845 0.143 164.978);                  /* emerald-300 - indicator bar */
    --bg-surface:          oklch(0.262 0.051 172.552);                  /* emerald-950 */
    --bg-hover:            oklch(0.378 0.077 168.94);                   /* emerald-900 */
    --bg-active:           oklch(0.508 0.118 165.612);                  /* emerald-700, solid */
    --border-subtle:       oklch(1 0 0 / 10%);
    --border-default:      oklch(1 0 0 / 14%);
    --border-strong:       oklch(1 0 0 / 20%);
    --text-primary:        oklch(1 0 0);
    --text-secondary:      oklch(1 0 0 / 85%);
    --text-muted:          oklch(1 0 0 / 72%);
    --text-faint:          oklch(1 0 0 / 60%);
    --sidebar-link-color:  oklch(1 0 0 / 85%);
    --sidebar-link-icon:   oklch(1 0 0 / 70%);
    --sidebar-group-color: oklch(0.905 0.093 164.15);                   /* emerald-200 */
    --sidebar-active-fg:   oklch(1 0 0);
    --sidebar-raised:        oklch(0.305 0.06 171.5);                   /* between emerald-950 and 900 */
    --sidebar-raised-hover:  oklch(0.335 0.066 170.5);
    --sidebar-raised-border: oklch(1 0 0 / 16%);
    background: oklch(0.262 0.051 172.552);
}
html[data-theme-color="green"] .sidebar-link.active,
html[data-theme-color="green"] .sidebar-link.active i { color: var(--sidebar-active-fg); }
html[data-theme-color="green"] .sidebar-link.active i { font-weight: 700; }

/* Maroon sidebar - restored to the solid-brand sidebar it had at c3aad3e, which the client
   preferred to both the deep-brick (read as blood) and the shadcn neutral versions. Pinned to the
   OLD accent #9A2F23 rather than var(--accent): the buttons moved to #C0392B, and a sidebar in
   that brighter red is not the one that was approved. Hover/active/borders are shades toward
   black, never white tints (see the brand-fill note above). Same in light and dark mode. */
html[data-theme-color="maroon"] .sidebar,
html[data-theme-color="maroon"] .offcanvas.app-offcanvas {
    --maroon-sidebar: #9A2F23;
    background: var(--maroon-sidebar);
    --bg-surface: var(--maroon-sidebar);
    --border-subtle: color-mix(in srgb, var(--maroon-sidebar) 80%, #000000);
    --border-default: color-mix(in srgb, var(--maroon-sidebar) 70%, #000000);
    --border-strong: color-mix(in srgb, var(--maroon-sidebar) 60%, #000000);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.86);
    --text-muted: rgba(255, 255, 255, 0.72);
    --text-faint: rgba(255, 255, 255, 0.58);
    --bg-hover: color-mix(in srgb, var(--maroon-sidebar) 74%, #000000);
    --bg-active: color-mix(in srgb, var(--maroon-sidebar) 58%, #000000);
    --sidebar-link-color: rgba(255, 255, 255, 0.88);
    --sidebar-link-icon: rgba(255, 255, 255, 0.88);
    --sidebar-group-color: rgba(255, 255, 255, 0.66);
    --sidebar-raised: color-mix(in srgb, var(--maroon-sidebar) 86%, #000000);
    --sidebar-raised-hover: color-mix(in srgb, var(--maroon-sidebar) 80%, #000000);
    --sidebar-raised-border: color-mix(in srgb, var(--maroon-sidebar) 64%, #000000);
    --sidebar-danger: #ffffff;
    --sidebar-danger-bg: var(--sidebar-raised-hover);
}
html[data-theme-color="maroon"] .sidebar-link.active::before { background: #ffffff; }



.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    flex-shrink: 0;
}
.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1;
}
.sidebar-brand-link:hover { color: inherit; }
.sidebar-brand-mark {
    width: 28px; height: 28px;
    border-radius: 7px;
    object-fit: contain;
    flex-shrink: 0;
}
/* Two marks, one shown: raqmierp-icon-dark.svg for a dark sidebar, raqmierp-icon.svg for a light
   one. No theme has a light sidebar today; a future one shows the standard icon by hiding -ondark
   and showing -onlight under its own selector. */
.sidebar-brand-mark-onlight { display: none; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-brand-name { font-weight: 600; font-size: .9rem; }
.sidebar-brand-sub  { font-size: .7rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 12px;
}

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: 14px 10px 6px;
}

/* Collapsible sidebar groups */
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 10px 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--sidebar-group-color);
    transition: color var(--transition-fast);
}
.sidebar-group-toggle:hover { color: var(--text-secondary); }
.sidebar-group-toggle .sg-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sidebar-group-toggle .sg-label i {
    font-size: 1.125rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-group-toggle .sg-chevron {
    font-size: .75rem;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
    margin-inline-start: 4px;
}
.sidebar-group-toggle.collapsed .sg-chevron { transform: rotate(-90deg); }
[dir="rtl"] .sidebar-group-toggle.collapsed .sg-chevron { transform: rotate(90deg); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-link-color);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.1;
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}
.sidebar-link i {
    font-size: 1.05rem;
    width: 18px;
    text-align: center;
    color: var(--sidebar-link-icon);
    flex-shrink: 0;
}
.sidebar-link span { overflow: hidden; text-overflow: ellipsis; }
.sidebar-group .collapse .sidebar-link,
.sidebar-group .collapsing .sidebar-link { padding-inline-start: 36px; }
.sidebar-group.ms-2 .collapse .sidebar-link,
.sidebar-group.ms-2 .collapsing .sidebar-link { padding-inline-start: 28px; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link:hover i { color: var(--text-primary); }
.sidebar-link.active {
    background: var(--bg-active);
    color: var(--text-primary);
    font-weight: 600;
}
.sidebar-link.active i { color: var(--text-primary); }
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
/* The signed-in user, at the foot of the sidebar. Its menu opens beside the sidebar on desktop
   (so it never covers the nav) and upward inside the slide-in sidebar on phones - site.js. */
.sidebar-footer .sidebar-user {
    width: 100%; text-align: start; margin: 0;
    background: var(--sidebar-raised);
    border: 1px solid var(--sidebar-raised-border);
    border-radius: var(--radius);
}
.sidebar-footer .sidebar-user:hover,
.sidebar-footer .sidebar-user[aria-expanded="true"] { background: var(--sidebar-raised-hover); }
.sidebar-user-avatar {
    width: 32px; height: 32px; flex: 0 0 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-active);
    color: var(--text-primary);
    font-size: .75rem; font-weight: 600;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);  /* crisp edge on every sidebar fill */
}
.sidebar-user .user-meta { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user-name { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: .72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-caret { color: var(--text-muted); flex-shrink: 0; }
/* The menu lives inside the sidebar, so it takes the sidebar's scoped tokens (dark, emerald, maroon,
   gold) instead of the page's light --bg-elevated; otherwise the sidebar's light text sat on a
   white panel and vanished on hover. Two classes so it outranks the generic .dropdown-menu rule
   further down, which would otherwise win on source order. */
.dropdown-menu.sidebar-user-menu {
    min-width: 240px;
    background-color: var(--sidebar-raised);
    border-color: var(--sidebar-raised-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    color: var(--text-primary);
}
/* Items are near-white, not the nav's muted link grey: on the raised panel that grey read as
   disabled. Every sidebar fill has a white --text-primary, so a mix of it works for all four. */
.sidebar-user-menu .dropdown-item { color: color-mix(in srgb, var(--text-primary) 90%, transparent); }
.sidebar-user-menu .dropdown-item i { color: color-mix(in srgb, var(--text-primary) 70%, transparent); }
.sidebar-user-menu .dropdown-item:hover,
.sidebar-user-menu .dropdown-item:focus { background: var(--sidebar-raised-hover); color: var(--text-primary); }
.sidebar-user-menu .dropdown-item:hover i,
.sidebar-user-menu .dropdown-item:focus i { color: var(--text-primary); }
/* Sign out is not navigation; it turns red on hover. Red on a maroon or gold fill would vanish, so
   those schemes set --sidebar-danger to white and keep the ordinary hover. */
.sidebar-user-menu .sidebar-user-signout:hover,
.sidebar-user-menu .sidebar-user-signout:focus,
.sidebar-user-menu .sidebar-user-signout:hover i,
.sidebar-user-menu .sidebar-user-signout:focus i { color: var(--sidebar-danger); }
.sidebar-user-menu .sidebar-user-signout:hover,
.sidebar-user-menu .sidebar-user-signout:focus { background: var(--sidebar-danger-bg); }
.sidebar-user-menu-head { line-height: 1.3; white-space: normal; }
.sidebar-user-menu-name { font-weight: 600; font-size: .9rem; color: var(--text-primary); }
.sidebar-user-menu-meta { display: block; font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.sidebar-user-menu-colors { padding: 4px 16px 6px; }
/* Phones and tablets: the menu opens upward inside the slide-in sidebar, as wide as the user tile,
   scrolls rather than running off a short (landscape) screen, and gives fingers 44px rows. */
@media (max-width: 991.98px) {
    .dropdown-menu.sidebar-user-menu {
        min-width: 0;
        width: calc(var(--sidebar-w) - 24px);
        max-height: calc(100dvh - 96px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}
@media (pointer: coarse) {
    .sidebar-user-menu .dropdown-item { min-height: 44px; }
    .sidebar-user-menu .theme-color-row { gap: 10px; }
    .sidebar-user-menu .theme-color-row .theme-color-option { min-width: 40px; min-height: 40px; justify-content: center; }
}
.theme-color-row { display: flex; gap: 6px; margin-top: 4px; }
.theme-color-row .theme-color-option { width: auto; padding: 5px; }

/* Collapsed sidebar (desktop) — icon rail.
   Scoped to >=992px so the mobile offcanvas is never affected by the rail state. */
@media (min-width: 992px) {
    /* `.offcanvas.app-offcanvas` also sets width, with equal specificity but later
       in this file — hence the extra `.offcanvas` here to outrank it. */
    html[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-w-collapsed); }

    /* Only glyphs survive; every text-bearing element folds away. */
    html[data-sidebar="collapsed"] .sidebar .sidebar-brand-text,
    html[data-sidebar="collapsed"] .sidebar .sidebar-section-label,
    html[data-sidebar="collapsed"] .sidebar .sidebar-divider,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle .sg-chevron,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle .sg-label > span,
    html[data-sidebar="collapsed"] .sidebar .sidebar-scroll > .sidebar-link > span { display: none; }

    /* The footer label carries Bootstrap's `.d-flex`, which is `!important`. */
    html[data-sidebar="collapsed"] .sidebar .sidebar-footer .user-meta { display: none !important; }

    html[data-sidebar="collapsed"] .sidebar .sidebar-brand { padding: 0; justify-content: center; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-brand-link { flex: 0 0 auto; gap: 0; justify-content: center; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-footer { padding: 10px 8px; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-user-caret { display: none; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-footer .sidebar-link { justify-content: center; gap: 0; }

    /* A <button> sizes to fit-content under `width: auto` even when display:flex,
       which would collapse the box and strip `justify-content` of any effect. */
    html[data-sidebar="collapsed"] .sidebar .sidebar-scroll > .sidebar-link,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle {
        width: 100%;
        justify-content: center;
        padding: 10px 0;
        margin: 2px 0;
        border-radius: var(--radius-sm);
    }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle .sg-label { gap: 0; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle:hover,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle[aria-expanded="true"] { background: var(--bg-hover); }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group-toggle[aria-expanded="true"] { color: var(--text-primary); }

    /* A group's collapse panel becomes a fixed flyout. position:fixed escapes the
       overflow clipping on .offcanvas-body / .sidebar-scroll; JS supplies `top`. */
    html[data-sidebar="collapsed"] .sidebar .sidebar-group > .collapse,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group > .collapsing {
        position: fixed;
        left: var(--sidebar-w-collapsed);
        z-index: 1050;
        min-width: 212px;
        max-height: 72vh;
        overflow-y: auto;
        padding: 6px;
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius);
        box-shadow: var(--shadow-xl);
        height: auto !important;   /* beats Bootstrap's inline height animation */
        transition: none !important;
    }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group > .collapsing { display: none; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group .collapse .sidebar-link,
    html[data-sidebar="collapsed"] .sidebar .sidebar-group.ms-2 .collapse .sidebar-link { padding-inline-start: 10px; }
    html[data-sidebar="collapsed"] .sidebar .sidebar-group .collapse .sidebar-link.active::before { left: -6px; }
}

/* Hover label for rail icons — a single body-level node, positioned by JS. */
.rail-tip {
    position: fixed;
    z-index: 1060;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-inverse, #18181b);
    color: var(--text-inverse, #fafafa);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.rail-tip.is-visible { opacity: 1; }

/* Persistent desktop sidebar by overriding offcanvas defaults on large screens */
@media (min-width: 992px) {
    .sidebar.offcanvas {
        transform: none !important;
        visibility: visible !important;
    }
}

/* Mobile offcanvas inherits sidebar styling */
.offcanvas.app-offcanvas {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.offcanvas.app-offcanvas .offcanvas-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 5. Main content + topbar ---------- */
.main-area {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}
html[data-sidebar="collapsed"] .main-area { margin-left: var(--sidebar-w-collapsed); }
@media (max-width: 991.98px) { .main-area, html[data-sidebar="collapsed"] .main-area { margin-left: 0; } }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: color-mix(in srgb, var(--bg-app) 78%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.topbar-title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.topbar-breadcrumb {
    font-size: .875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-container {
    padding: 20px 16px 32px;
    flex: 1;
}
@media (max-width: 575.98px) { .page-container { padding: 12px; } }

/* ---------- 6. Buttons ---------- */
.btn {
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast), box-shadow var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-xs);
    white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring-focus); }
/* Bootstrap's pressed-while-focused rule draws its own (blue) glow from these. */
.btn {
    --bs-btn-focus-box-shadow: 0 0 0 3px var(--ring-focus);
    --bs-btn-active-shadow: none;
}
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-sm { padding: 7px 11px; font-size: .8125rem; }
.btn-lg { padding: 11px 18px; font-size: .9375rem; }
.btn i { font-size: 1em; }

/* Pressed / .active / open-dropdown states. Bootstrap paints those from its own --bs-btn-active-*
   variables (`.btn:first-child:active` and friends out-specify a plain `.btn-primary`), so
   overriding only background/:hover left a press flashing Bootstrap blue - or grey, or solid red,
   on the outline variants. Each variant hands Bootstrap our colours instead: pressed looks the
   same as hover, which is what shadcn does (it has no separate pressed colour). */
.btn-primary, .btn-dark {
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-active-color: var(--accent-fg);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    --bs-btn-disabled-color: var(--accent-fg);
}
.btn-secondary, .btn-outline-secondary {
    --bs-btn-active-bg: var(--bg-muted);
    --bs-btn-active-border-color: var(--border-strong);
    --bs-btn-active-color: var(--text-primary);
}
.btn-ghost {
    --bs-btn-active-bg: var(--bg-hover);
    --bs-btn-active-border-color: transparent;
    --bs-btn-active-color: var(--text-primary);
}
.btn-outline-danger {
    --bs-btn-active-bg: var(--danger-bg);
    --bs-btn-active-border-color: var(--danger);
    --bs-btn-active-color: var(--danger);
}
.btn-outline-success {
    --bs-btn-active-bg: var(--success-bg);
    --bs-btn-active-border-color: var(--success);
    --bs-btn-active-color: var(--success);
}

/* Primary = solid achromatic */
.btn-primary, .btn-dark {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}
.btn-primary:hover, .btn-dark:hover {
    background: var(--accent-hover);
    color: var(--accent-fg);
    border-color: var(--accent-hover);
}

/* Secondary = bordered surface */
.btn-secondary, .btn-outline-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover, .btn-outline-secondary:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Ghost = transparent */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Outline danger */
.btn-outline-danger {
    background: var(--bg-surface);
    color: var(--danger);
    border-color: var(--border-default);
}
.btn-outline-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-outline-success {
    background: var(--bg-surface);
    color: var(--success);
    border-color: var(--border-default);
}
.btn-outline-success:hover {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

/* Icon-only button */
.btn-icon {
    /* inline-flex, not the .btn default: .btn-icon is used bare on <a> as well as <button>,
       and width/height are ignored on an inline element - which left link actions unboxed. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    box-shadow: none;
    border-radius: var(--radius-sm);
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon i { font-size: 1.05rem; }
.btn-icon.dropdown-toggle::after { display: none; }

/* ---------- 7. Forms ---------- */
.form-label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.005em;
}
.form-text { font-size: .8125rem; color: var(--text-muted); margin-top: 4px; }

.form-control, .form-select {
    font-family: var(--font-sans);
    font-size: .9375rem;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    line-height: 1.4;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:hover, .form-select:hover { border-color: var(--border-strong); }
.form-control:focus, .form-select:focus {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--text-secondary);
    /* A crisp 1px ring in the border's colour reads as a 2px border: one clear focus cue,
       nothing spilling into neighbouring inputs or input-group buttons. */
    box-shadow: 0 0 0 1px var(--text-secondary);
    outline: none;
}
.form-control:disabled, .form-select:disabled {
    background-color: var(--bg-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}
textarea.form-control { min-height: 80px; }
/* The .form-control rule above wins over Bootstrap's .form-control-sm (same specificity, later),
   so every "small" input in the app renders at this one size. Bootstrap's .input-group-sm > *
   rule is more specific and survived, which made an input shrink the moment it gained an addon
   or button (the partner picker, barcode field, product search). Pin those to the same size. */
.input-group-sm > .form-control, .input-group-sm > .form-select,
.input-group-sm > .typeahead > .typeahead-input {
    padding: 9px 12px;
    font-size: .9375rem;
}
.input-group-sm > .input-group-text, .input-group-sm > .btn { font-size: .875rem; }

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--danger);
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px var(--danger);
}

/* Checkbox / radio / switch */
.form-check-input {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.form-check-input:focus { border-color: var(--text-secondary); box-shadow: 0 0 0 1px var(--text-secondary); }
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-label { font-size: .875rem; color: var(--text-primary); }

/* Native select chevron — light + dark variants so it stays visible on dark surfaces */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2352525b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
}
[data-bs-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}

/* Validation helpers — make small text fit better */
/* An error is the one message that must be read: not smaller than body-small, and bold enough
   to stand apart from help text in the same spot. */
.text-danger.small { font-size: .8125rem; font-weight: 500; margin-top: 4px; display: inline-block; }
.field-validation-error, .invalid-feedback { font-size: .8125rem; font-weight: 500; color: var(--danger); }

/* Caption above a compact read/edit field (the customer panel on invoice pages). Sentence case
   at body-small size - the old inline .7rem uppercase grey rendered at 9px. */
.field-caption {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

/* ---------- 8. Cards ---------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 18px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}
.card-body { padding: 18px; }
.card-body.p-0 + .card-body, .card > .card-body { color: var(--text-primary); }

/* Sticky pager — pins a list card's footer to the bottom of the viewport so the
   page controls stay reachable while a long table scrolls. Put it on the footer
   element and keep that footer as the last child of the scrolling card body. */
.pager-sticky {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}
.page-size-select { width: 75px; }

/* Metric card */
.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.metric-card:hover { border-color: var(--border-default); }
.metric-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.metric-label i { font-size: .85rem; }
.metric-value {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.metric-trend {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.metric-unit { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.metric-trend.up    { color: var(--success); }
.metric-trend.down  { color: var(--danger); }

/* Sparkline placeholder */
.sparkline {
    height: 32px;
    margin-top: 10px;
    background: linear-gradient(180deg, var(--bg-muted) 0%, transparent 100%);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.sparkline::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 32' preserveAspectRatio='none'%3E%3Cpath d='M0,24 L15,18 L30,22 L45,12 L60,16 L75,8 L100,14' fill='none' stroke='%2371717a' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='.55'/%3E%3C/svg%3E") no-repeat center/100% 100%;
}

/* ---------- 9. Tables ---------- */
.table {
    --bs-table-bg: transparent;
    color: var(--text-primary);
    font-size: .875rem;
    margin: 0;
    border-color: var(--border-subtle);
}
.table > :not(caption) > * > * {
    background-color: transparent;
    color: inherit;
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 16px;
    vertical-align: middle;
}
.table thead th, .table > thead > tr > th {
    background-color: var(--bg-muted) !important;
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border-subtle);
    padding: 11px 16px;
    white-space: nowrap;
}
.table > tbody > tr:hover > * {
    background: var(--bg-hover);
}
.table-dark { background: transparent !important; }
.table-hover > tbody > tr:hover > * { background: var(--bg-hover); }
.table tbody tr:last-child > * { border-bottom: 0; }

/* Partner account position (_AccountPosition.cshtml) — an accounting totals block: labels left,
   tabular figures right, a rule above the subtotal and a single-over-double rule on the net. */
.acct-position { width: 100%; border-collapse: collapse; font-size: .875rem; }
.acct-position td { padding: 5px 0; color: var(--text-muted); vertical-align: baseline; }
.acct-position td:last-child { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; padding-left: 16px; }
.acct-position .is-subtotal td { border-top: 1px solid var(--border-default); color: var(--text-primary); }
.acct-position .is-net td { border-top: 1px solid var(--border-strong); border-bottom: 3px double var(--border-strong); padding: 8px 0; color: var(--text-primary); font-weight: 600; font-size: .95rem; }
.acct-position .is-net td:last-child { padding-left: 16px; }

.table .mono, .table td.mono { font-family: var(--font-mono); font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.table code {
    font-family: var(--font-mono);
    background: var(--bg-muted);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .75rem;
}

/* ---------- 10. Status pills ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1;
    padding: 5px 10px 5px 9px;
    border-radius: 999px;
    background-color: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.status-pill::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .9;
}
.status-pill.is-success  { color: var(--success); background: var(--success-bg); border-color: transparent; }
.status-pill.is-danger   { color: var(--danger);  background: var(--danger-bg);  border-color: transparent; }
.status-pill.is-warning  { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.status-pill.is-info     { color: var(--info);    background: var(--info-bg);    border-color: transparent; }
.status-pill.is-muted    { color: var(--text-muted); }
.status-pill.is-violet   { color: #7c3aed; background: rgba(124, 58, 237, .10); border-color: transparent; }
.status-pill.is-dark     { color: var(--text-primary); background: var(--bg-muted); border-color: transparent; }
[data-bs-theme="dark"] .status-pill.is-violet { color: #a78bfa; background: rgba(167, 139, 250, .14); }

/* Tag (no dot, for non-status labels like schema version) */
.tag {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* ---------- 11. Alerts ---------- */
.alert {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    font-size: .875rem;
    padding: 12px 14px;
    background-color: var(--bg-muted);
    color: var(--text-primary);
}
/* Errors are the one alert that must not be missed - staff used to get a blocking popup. A solid
   red edge and border make it a shape, not only a colour: on the Maroon theme the accent IS this
   red, so colour alone no longer singles an error out. */
.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-inline-start: 5px solid var(--danger);
    font-weight: 500;
    font-size: .9375rem;
}
.alert-danger strong, .alert-danger .fw-semibold, .alert-danger b { font-weight: 700; }
.alert-danger:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin-bottom: 0; padding-inline-start: 1.25rem; }
.form-control.is-invalid, .form-select.is-invalid,
.form-control.input-validation-error, .form-select.input-validation-error {
    border-color: var(--danger);
    /* 2px look without a 2px border, which would make the field taller than its neighbours. */
    box-shadow: inset 0 0 0 1px var(--danger);
    background-color: color-mix(in srgb, var(--danger) 4%, var(--bg-surface));
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: transparent;
}
.alert-info, .alert-primary {
    background: var(--info-bg);
    color: var(--text-secondary);
    border-color: transparent;
}
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: transparent;
}

/* ---------- 12. Dropdown ---------- */
.dropdown-menu {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 220px;
    font-size: .875rem;
    color: var(--text-primary);
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition-fast);
}
.dropdown-item i { color: var(--text-muted); width: 16px; text-align: center; }
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.dropdown-divider { border-color: var(--border-subtle); margin: 6px 2px; }
.dropdown-header {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: 6px 10px 4px;
}

/* ---------- 12b. Tabs (Bootstrap nav-tabs / nav-pills) ----------
   Bootstrap paints these from --bs-nav-* variables: blue links, a white active tab, a blue active
   pill and a blue focus glow. None of that follows the theme, so the strip stayed Bootstrap blue
   under the green / maroon / gold accents and in dark mode. Hand Bootstrap our tokens instead, the
   same way the buttons do: tabs underline in the accent, pills fill with it. */
.nav-tabs, .nav-pills {
    --bs-nav-link-color: var(--text-muted);
    --bs-nav-link-hover-color: var(--text-primary);
    --bs-nav-link-disabled-color: var(--text-faint);
    --bs-nav-link-font-size: .875rem;
    --bs-nav-link-font-weight: 500;
    --bs-nav-link-padding-x: 14px;
    --bs-nav-link-padding-y: 9px;
}
.nav-tabs .nav-link, .nav-pills .nav-link {
    font-family: var(--font-sans);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.nav-tabs .nav-link:focus-visible, .nav-pills .nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring-focus);
}
.nav-tabs {
    --bs-nav-tabs-border-color: var(--border-default);
    --bs-nav-tabs-border-radius: 0;
    --bs-nav-tabs-link-hover-border-color: transparent transparent var(--border-strong);
    --bs-nav-tabs-link-active-color: var(--text-primary);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--accent);
}
.nav-tabs .nav-link { border-width: 0 0 2px; }
.nav-pills {
    --bs-nav-pills-border-radius: var(--radius-sm);
    --bs-nav-pills-link-active-color: var(--accent-fg);
    --bs-nav-pills-link-active-bg: var(--accent);
}
.nav-pills .nav-link:not(.active):not(:disabled):hover { background: var(--bg-hover); }
.nav-pills .nav-link.active { box-shadow: var(--shadow-xs); }
/* A count badge / tag on the filled pill: the grey secondary badge (or the muted .tag chip) clashes
   with, or disappears into, the accent fill. */
.nav-pills .nav-link.active .badge,
.nav-pills .nav-link.active .tag {
    background: color-mix(in srgb, var(--accent-fg) 24%, transparent) !important;
    color: var(--accent-fg) !important;
    border-color: transparent;
}

/* ---------- 13. Modal ---------- */
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    color: var(--text-primary);
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 20px;
}
.modal-footer { border-top: 1px solid var(--border-subtle); padding: 14px 20px; }
.modal-backdrop.show { opacity: .5; }
[data-bs-theme="dark"] .modal-backdrop.show { opacity: .65; }

/* ---------- 14. Topbar controls + search ---------- */
.topbar-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 12px;
    background-color: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .875rem;
    min-width: 260px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.topbar-search:hover { border-color: var(--border-default); }
.topbar-search i { font-size: .95rem; }
.topbar-search .kbd {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: .68rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-muted);
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}
@media (max-width: 767.98px) { .topbar-search { min-width: 0; padding: 6px 10px; } .topbar-search .label, .topbar-search .kbd { display: none; } }

/* Row avatar - 28px photo or initials disc used in list tables (e.g. /HR/Employees). */
.row-avatar {
    width: 28px; height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-muted);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .02em;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

/* ---------- 15. Command palette ---------- */
.cmdk .modal-dialog { max-width: 560px; margin-top: 12vh; }
.cmdk .modal-content { padding: 0; overflow: hidden; }
.cmdk-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.cmdk-input-wrap i { color: var(--text-muted); font-size: 1.05rem; }
.cmdk-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: .95rem;
}
.cmdk-input::placeholder { color: var(--text-faint); }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-section-label {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: 10px 10px 4px;
}
.cmdk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: .85rem;
    transition: background var(--transition-fast);
    text-decoration: none;
}
.cmdk-item i { color: var(--text-muted); width: 18px; text-align: center; }
.cmdk-item:hover, .cmdk-item.is-active {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.cmdk-item:hover i, .cmdk-item.is-active i { color: var(--text-primary); }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: .85rem; }
.cmdk-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 8px 14px;
    display: flex;
    gap: 16px;
    font-size: .7rem;
    color: var(--text-faint);
}
.cmdk-footer .kbd {
    font-family: var(--font-mono);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 1px 5px;
    border-radius: 4px;
    margin: 0 3px;
}

/* Global search results inside the palette (docs/plan_global_search.md P4) */
.cmdk-progress { height: 2px; background: transparent; overflow: hidden; }
.cmdk-progress.is-loading { background: var(--bg-muted); }
.cmdk-progress.is-loading::after {
    content: ""; display: block; height: 100%; width: 40%;
    background: var(--text-muted); animation: cmdk-progress 1s ease-in-out infinite;
}
@keyframes cmdk-progress { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.cmdk-group-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 10px 4px;
}
.cmdk-group-head .cmdk-section-label { padding: 0; }
.cmdk-group-head .cmdk-count { color: var(--text-muted); font-weight: 400; margin-inline-start: 4px; }
.cmdk-group-head .cmdk-viewall { font-size: .72rem; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.cmdk-group-head .cmdk-viewall:hover, .cmdk-group-head .cmdk-viewall.is-active { color: var(--text-primary); text-decoration: underline; }
.cmdk-row { display: block; padding: 7px 10px; }
.cmdk-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmdk-row-main .mono { font-family: var(--font-mono); font-size: .78rem; color: var(--text-primary); white-space: nowrap; }
.cmdk-row-main .cmdk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row-main .cmdk-amount { font-family: var(--font-mono); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmdk-row-main .cmdk-date { color: var(--text-muted); font-size: .78rem; white-space: nowrap; }
.cmdk-row-main .status-pill { font-size: .62rem; }
.cmdk-row-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .72rem; color: var(--text-muted); margin-top: 2px; padding-inline-start: 0; }
.cmdk-row mark { background: var(--warning-bg); color: inherit; font-weight: 700; padding: 0 1px; border-radius: 2px; }
.cmdk-tag { font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); white-space: nowrap; }
.cmdk-open { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
.cmdk-open.is-zero { color: var(--text-faint); }
.cmdk-static.is-demoted .cmdk-section-label { color: var(--text-faint); }
.cmdk-recent .cmdk-row { display: flex; align-items: center; gap: 10px; }
.cmdk-group.is-collapsed .cmdk-row, .cmdk-group.is-collapsed .cmdk-empty { display: none; }
.cmdk-group-toggle { display: none; background: none; border: 0; color: var(--text-muted); padding: 0 4px; }
@media (max-width: 575.98px) {
    .cmdk .modal-dialog { max-width: none; margin: 0; height: 100%; }
    .cmdk .modal-content { height: 100%; border-radius: 0; }
    .cmdk-list { max-height: none; flex: 1; }
    .cmdk-group-toggle { display: inline-block; }
    .cmdk-row-main .cmdk-date, .cmdk-row-meta { font-size: .7rem; }
}

/* ---------- 16. Skeleton + empty state ---------- */
.skeleton {
    display: block;
    background: linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-hover) 50%, var(--bg-muted) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-card { height: 80px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty-state-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    margin: 0 auto 14px;
    background: var(--bg-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.empty-state-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state-desc  { font-size: .8125rem; color: var(--text-muted); margin-bottom: 16px; max-width: 320px; margin-inline: auto; }

/* ---------- 17. Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-header h1, .page-header h2, .page-header h3 { margin: 0; }
.page-header-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
.page-header-sub   { font-size: .8125rem; color: var(--text-muted); margin-top: 4px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Pins a page header just below the global topbar so its actions (e.g. Back / Save)
   stay reachable while the form scrolls. Theme-aware via tokens. */
.page-header--sticky {
    position: sticky;
    top: var(--topbar-h);
    z-index: 1010;
    background: var(--bg-app);
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 992px) {
    .page-header--sticky { top: calc(var(--topbar-h) + 43px); }
}

/* ---------- 18. Auth + setup screens ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--bg-app);
}
@media (min-width: 992px) {
    .auth-shell { grid-template-columns: 2fr 3fr; }
}

/* Left branded panel — hidden below lg. Background photo is set inline per-request
   (Login.cshtml.cs picks one of the 5 uploads/login-screen/* images at random);
   the gradient scrim keeps the logo/footer readable over any of them. */
.auth-brand-panel {
    display: none;
    position: relative;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    overflow: hidden;
    background-color: var(--zinc-900);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    color: #fff;
}
@media (min-width: 992px) {
    .auth-brand-panel { display: flex; }
}
.auth-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .12) 32%, rgba(0, 0, 0, .12) 62%, rgba(0, 0, 0, .72) 100%);
    pointer-events: none;
}
.auth-brand-panel-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.auth-brand-panel-top img { width: 36px; height: 36px; }
.auth-brand-panel-name { display: block; font-size: 1.0625rem; font-weight: 600; line-height: 1.2; }
.auth-brand-panel-motto {
    display: block;
    margin-top: 3px;
    font-size: .625rem;
    font-weight: 500;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
}
.auth-brand-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    font-size: .8125rem;
    color: rgba(255, 255, 255, .82);
}
.auth-brand-keywords li { display: inline-flex; align-items: center; gap: 6px; }
.auth-brand-keywords i { font-size: 1rem; opacity: .75; }
/* Spaced capitals break Arabic letter joining. */
[dir="rtl"] .auth-brand-panel-motto { letter-spacing: 0; text-transform: none; font-size: .75rem; }
.auth-brand-panel-foot { position: relative; z-index: 1; font-size: .75rem; color: rgba(255, 255, 255, .55); }

/* Right form panel */
.auth-form-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
.auth-form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 50% at 50% 0%, var(--bg-muted) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}
.auth-brand .sidebar-brand-mark { width: 32px; height: 32px; }
.auth-brand-name { font-size: 1rem; font-weight: 600; }
/* Card sits on --bg-surface, which flips light/dark — swap the mark so it stays visible either way. */
.auth-brand-mark-dark { display: none; }
[data-bs-theme="dark"] .auth-brand-mark-light { display: none; }
[data-bs-theme="dark"] .auth-brand-mark-dark { display: inline-block; }
.auth-title { font-size: 1.125rem; font-weight: 600; text-align: center; margin-bottom: 4px; }
.auth-sub   { font-size: .8125rem; color: var(--text-muted); text-align: center; margin-bottom: 22px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: .8125rem; color: var(--text-muted); }
.auth-footer a { color: var(--text-secondary); }
.auth-footer a:hover { color: var(--text-primary); }

.auth-theme-toggle {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 10;
}

/* Setup wizard */
.setup-shell {
    min-height: 100vh;
    background: var(--bg-app);
    padding: 56px 16px;
    position: relative;
}
.setup-card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.setup-card-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.setup-card-body { padding: 26px; }
.setup-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.setup-step-dot {
    width: 28px; height: 4px;
    border-radius: 2px;
    background: var(--bg-muted);
    transition: background var(--transition-fast);
}
.setup-step-dot.active { background: var(--accent); }
.setup-step-dot.done   { background: var(--success); }

/* ---------- 19. Utility tweaks ---------- */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.border, .border-bottom, .border-top { border-color: var(--border-subtle) !important; }
.bg-light, .bg-body-tertiary { background: var(--bg-muted) !important; }

.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 18px 0;
}

/* Spinner used for loading icons (replaces fa-spin) */
.spin { animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Bootstrap Icons baseline alignment */
.bi { vertical-align: -0.125em; line-height: 1; }

/* Account picker list rows */
.acc-pick-row:hover { background-color: var(--bs-secondary-bg) !important; }
.acc-pick-row:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }

/* Cashier — payment panel fade-in */
#paymentPanel { animation: fadeInUp var(--transition) ease both; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   RTL — Arabic layout overrides
   Bootstrap RTL CSS handles all Bootstrap components.
   These rules handle the custom sidebar/shell layout only.
   ============================================================= */

/* Arabic font stack */
[lang="ar"], [lang="ar"] body {
    --font-sans: 'IBM Plex Sans Arabic', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: normal;
    letter-spacing: 0;
    line-height: 1.7;
}

/* Sidebar flips to right side */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-subtle);
}

/* Main content margin flips */
[dir="rtl"] .main-area {
    margin-left: 0;
    margin-right: var(--sidebar-w);
    transition: margin-right var(--transition);
}
html[dir="rtl"][data-sidebar="collapsed"] .main-area {
    margin-right: var(--sidebar-w-collapsed);
    margin-left: 0;
}
@media (max-width: 991.98px) {
    [dir="rtl"] .main-area,
    html[dir="rtl"][data-sidebar="collapsed"] .main-area {
        margin-right: 0;
        margin-left: 0;
    }
}

/* Rail flyouts open toward the content, i.e. leftward when the sidebar is on the right. */
@media (min-width: 992px) {
    html[dir="rtl"][data-sidebar="collapsed"] .sidebar .sidebar-group > .collapse,
    html[dir="rtl"][data-sidebar="collapsed"] .sidebar .sidebar-group > .collapsing {
        left: auto;
        right: var(--sidebar-w-collapsed);
    }
}

/* Active indicator moves to right edge */
[dir="rtl"] .sidebar-link.active::before {
    left: auto;
    right: -10px;
    border-radius: 3px 0 0 3px;
}

/* The label clips to its line box (overflow:hidden for the ellipsis), and at line-height 1.1 that
   box is shorter than Arabic glyphs: the dots under ي / ب were cut off. A taller line box with an
   equal negative margin shows the full glyph without changing the row height. */
[dir="rtl"] .sidebar-link span { line-height: 1.6; margin-block: -.25em; }

/* Offcanvas mobile sidebar is on the right in RTL — handled by Bootstrap RTL classes in _Layout */

/* Topbar breadcrumb chevron flips */
[dir="rtl"] .topbar-breadcrumb .sep i { transform: scaleX(-1); display: inline-block; }

/* Topbar search box spacing */
[dir="rtl"] .topbar-search { direction: rtl; }

/* Dropdown menu alignment */
[dir="rtl"] .dropdown-menu-end { --bs-position: start; }

/* Page header actions gap direction */
[dir="rtl"] .page-header-actions { margin-left: 0; }

/* mono code blocks stay LTR */
[dir="rtl"] .mono, [dir="rtl"] code, [dir="rtl"] pre { direction: ltr; text-align: left; unicode-bidi: isolate; }

/* Table numeric columns keep LTR */
[dir="rtl"] td.mono, [dir="rtl"] th.mono { direction: ltr; text-align: right; }

/* Tag badges stay LTR */
[dir="rtl"] .tag { direction: ltr; }

/* ── Roles/Edit — permissions grid ─────────────────────────────────────── */
.perm-card { border: 1px solid var(--border, #e3e3e8); box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: box-shadow .15s ease; }
.perm-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.perm-card .card-header { background: #fafafa; border-bottom: 1px solid var(--border, #e3e3e8); }
.perm-check .form-check-input { width: 1.05rem; height: 1.05rem; border-radius: 4px; cursor: pointer; transition: background-color .12s ease, border-color .12s ease; }
.perm-check .form-check-label { cursor: pointer; user-select: none; font-size: .875rem; }
.perm-check .perm-hint { cursor: help; font-size: .75rem; vertical-align: -1px; }
.perm-check .perm-hint:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; border-radius: 50%; }
.perm-master { width: 1.1rem; height: 1.1rem; border-radius: 4px; cursor: pointer; }
[data-bs-theme="dark"] .perm-card .card-header { background: rgba(255,255,255,.03); }
.perm-category-header { padding: 8px 4px; border-bottom: 1px solid var(--border, #e3e3e8); }
.perm-category-header h6 { font-size: .95rem; letter-spacing: .01em; }
.perm-cat-toggle .sg-chevron { transition: transform .15s ease; }
.perm-cat-toggle.collapsed .sg-chevron { transform: rotate(-90deg); }
.perm-module-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.perm-subgroup-header { font-size: .72rem; letter-spacing: .06em; }
.perm-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid var(--border, #e3e3e8);
    border-radius: 6px;
    background: var(--bs-body-bg);
}
.perm-row:hover { background: rgba(15,23,42,.025); }
.perm-row.is-muted { opacity: .62; }
.perm-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.perm-row-head .perm-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-row-head .perm-count { flex-shrink: 0; margin-left: auto; }
.perm-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.perm-actions .perm-check { min-width: 118px; }
.perm-readonly { display: inline-flex; align-items: flex-start; gap: 5px; min-width: 118px; font-size: .875rem; line-height: 1.25; }
.perm-readonly i { font-size: .8rem; margin-top: .15rem; flex-shrink: 0; }
.perm-readonly.is-on i { color: var(--bs-success); }
.perm-readonly.is-off { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .perm-row:hover { background: rgba(255,255,255,.03); }
@media (max-width: 767.98px) {
    .perm-row { grid-template-columns: 1fr; }
    .perm-actions .perm-check,
    .perm-readonly { min-width: 45%; }
}
.perm-thumb { width: 32px; height: 32px; object-fit: cover; flex-shrink: 0; font-size: .75rem; }

/* ── Module 14: rendered rich-text content (sanitised server-side) ─────────────── */
.content-body { line-height: 1.65; }
.content-body img { max-width: 100%; height: auto; border-radius: 6px; }
.content-body h1, .content-body h2, .content-body h3 { margin-top: 1.25rem; margin-bottom: .5rem; }
.content-body ul, .content-body ol { padding-inline-start: 1.5rem; }
.content-body blockquote {
    border-inline-start: 3px solid var(--border, #e3e3e8);
    padding-inline-start: 1rem; margin-inline-start: 0; color: var(--text-muted, #6b6b76);
}
.content-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.content-body th, .content-body td { border: 1px solid var(--border, #e3e3e8); padding: 6px 10px; text-align: start; }
.content-body hr { border: 0; border-top: 1px solid var(--border, #e3e3e8); margin: 1.25rem 0; }
.content-body a { text-decoration: underline; }

/* ── Always-dark sidebar — base structure ────────────────────────────────── */
/* Sidebar is pinned dark regardless of the page light/dark theme toggle.    */
/* All child elements inherit these scoped tokens automatically.              */
.sidebar,
.offcanvas.app-offcanvas {
    /* Sidebar-scoped accent. Deliberately NOT var(--accent): the global accent is
       achromatic (zinc-900 / #fafafa), and a tint of black on a black sidebar is
       invisible — which is why the active row used to read as pure greyscale.
       Green appears in exactly two places, the active wash and the indicator bar;
       hover stays neutral so the active row is the only thing that draws the eye.
       Overridden wholesale by the brand-fill themes further up (higher specificity). */
    --sidebar-accent:      #3ECF8E;

    --bg-surface:          #121212;
    --bg-hover:            rgba(255, 255, 255, .05);
    --bg-active:           rgba(62, 207, 142, .12);   /* --sidebar-accent @ 12% */
    --border-subtle:       #2e2e2e;
    --border-default:      #2e2e2e;
    --text-primary:        #fafafa;
    --text-secondary:      #898989;
    --text-muted:          #898989;
    --text-faint:          #898989;
    --sidebar-link-color:  #898989;
    --sidebar-link-icon:   #898989;
    --sidebar-group-color: #fafafa;
    /* One step off the sidebar for the user tile and its menu, so "you" reads apart from the nav.
       Lighter here (elevation on dark); the brand fills above use a darker shade instead. */
    --sidebar-raised:        #1c1c1e;
    --sidebar-raised-hover:  #252528;
    --sidebar-raised-border: #34343a;
    --sidebar-danger:        #f87171;                    /* red-400 */
    --sidebar-danger-bg:     rgba(239, 68, 68, .14);
    background: #121212;
}

/* The 3px indicator bar. The brand-fill themes override this to #ffffff with a
   more specific selector, so they are unaffected. */
.sidebar .sidebar-link.active::before,
.offcanvas.app-offcanvas .sidebar-link.active::before {
    background: var(--sidebar-accent);
}

/* Section divider — 1px rule above each section label */
.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
}

/* Active link styling relies on the cascade from line 367 */

/* ── Compact invoice fee cells (Invoices/Create + Detail) ─────────────────────
   A line's fee components render as a horizontal strip of compact cells instead
   of stacked full-width rows. Editable controls live in a per-cell details panel
   (Create); Detail uses read-only chips with a tooltip. */
.fee-strip { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }

.fee-cell {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-body-bg);
    padding: .35rem .5rem;
    min-width: 150px;
    font-size: .8125rem;
}
.fee-cell-head { display: flex; align-items: center; gap: .4rem; }
.fee-cell .fee-type-label { font-weight: 500; white-space: nowrap; }
.fee-cell .fee-amount { width: 92px; text-align: right; }
.fee-info-btn { color: var(--bs-secondary-color); }
.fee-info-btn.is-open { color: var(--bs-primary); }

.fee-details {
    margin-top: .4rem;
    padding-top: .4rem;
    border-top: 1px dashed var(--bs-border-color);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 240px;
}
.fee-details-row { display: flex; align-items: center; gap: .4rem; }
.fee-details-row > label { width: 60px; margin: 0; color: var(--bs-secondary-color); font-size: .75rem; }
.fee-details-row .fee-account-name { font-size: .75rem; }

.line-tax-status { font-weight: 500; }

/* Read-only fee chip (Invoices/Detail) */
.fee-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: .3rem .55rem;
    font-size: .8125rem;
}
.fee-chip.is-display-only { border-style: dashed; opacity: .75; }
.fee-chip .fee-chip-label { color: var(--bs-secondary-color); }
.fee-chip .fee-chip-amount { font-weight: 500; }
.fee-chip .fee-chip-info { color: var(--bs-secondary-color); cursor: help; }

/* ---------- 21. Chatter / Activity timeline ---------- */
details > summary { cursor: pointer; }
.chatter-item { font-size: .8125rem; }
.chatter-item .status-pill { font-size: .65rem; }

/* ---------- 22. Dashboard hero band ---------- */
/* Solid status dot, coloured by a text-* utility. The Tabler webfont is outline-only, so a
   filled circle is drawn here rather than borrowed from an icon. */
.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-top: .45rem;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.dash-hero {
    position: relative;
    isolation: isolate;
    color: #fff;
    background:
        radial-gradient(circle at 12% -35%, rgba(45, 212, 191, .72), transparent 42%),
        linear-gradient(112deg, #0891b2 0%, #1167a8 48%, #172554 100%) !important;
    border: 0 !important;
    box-shadow: 0 16px 36px rgba(15, 56, 105, .2) !important;
}
.dash-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(125deg, rgba(255, 255, 255, .12), transparent 38%);
}
.dash-hero .card-body { position: relative; z-index: 1; }
.dash-hero .text-dark,
.dash-hero .text-secondary { color: #fff !important; }
.dash-hero .text-muted { color: rgba(255, 255, 255, .7) !important; }
.dash-hero .vr,
.dash-hero .border-start { border-color: rgba(255, 255, 255, .26) !important; }
.dash-hero-avatar {
    width: 48px; height: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, .28) !important;
    font-weight: 600; font-size: 1.05rem; letter-spacing: .02em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 20px rgba(3, 31, 74, .18) !important;
}
.dash-hero-name { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
/* On narrower screens only the name shrinks, so the greeting stays on one line. */
@media (max-width: 991.98px) { .dash-hero-person { font-size: 1rem; } }
.dash-hero-sub { font-size: .8125rem; }
.dash-hero-clock-label {
    font-size: .65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
}
.dash-hero-clock-val { font-size: 1.1rem; font-weight: 600; }
.dash-hero .btn-primary {
    color: #0f4f87;
    background: #fff;
    border-color: #fff;
}
.dash-hero .btn-primary:hover,
.dash-hero .btn-primary:focus-visible {
    color: #0b3d6a;
    background: #eaf6ff;
    border-color: #eaf6ff;
}
.dash-hero .btn-outline-primary {
    color: #fff;
    border-color: rgba(255, 255, 255, .72);
}
.dash-hero .btn-outline-primary:hover,
.dash-hero .btn-outline-primary:focus-visible {
    color: #0f4f87;
    background: #fff;
    border-color: #fff;
}
.dash-hero .badge.bg-light,
.dash-hero .bg-light {
    color: #fff !important;
    background: rgba(255, 255, 255, .12) !important;
    border-color: rgba(255, 255, 255, .24) !important;
}

/* ---------- 22b. On-break banner + live timer ---------- */
.dash-break-banner {
    border-left: 4px solid var(--bs-warning);
    /* Opaque: it sticks over scrolling content, so the tint is layered on the page colour. */
    background: linear-gradient(rgba(255, 193, 7, .08), rgba(255, 193, 7, .08)), var(--bs-body-bg);
    /* Sticks just below the topbar and slides under it, never over its menu button. */
    top: calc(var(--topbar-h) + .5rem);
    z-index: 1010;
}
.dash-break-timer {
    font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--bs-warning-text-emphasis, #997404);
}
.dash-break-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--bs-warning); flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(255, 193, 7, .7);
    animation: dash-break-pulse 1.6s infinite;
}
@keyframes dash-break-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 193, 7, .6); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* ---------- 23. Vendor bill line editor ---------- */
.vendor-bill-lines { min-width: 1180px; }
.vendor-bill-lines th:nth-child(1) { width: 175px; }   /* Product */
.vendor-bill-lines th:nth-child(2) { min-width: 220px; } /* Description */
.vendor-bill-lines th:nth-child(3) { width: 220px; }   /* Account */
.vendor-bill-lines th:nth-child(4) { width: 95px; }    /* Qty */
.vendor-bill-lines th:nth-child(5) { width: 125px; }   /* Unit price */
.vendor-bill-lines th:nth-child(6) { width: 165px; }   /* Purchase tax */
.vendor-bill-lines th:nth-child(7) { width: 105px; }   /* Net */
.vendor-bill-lines th:nth-child(8) { width: 95px; }    /* VAT */
.vendor-bill-lines th:nth-child(9) { width: 110px; }   /* Total */
.vendor-bill-lines th:nth-child(10) { width: 42px; }   /* Remove */
.vendor-bill-lines-total { background: var(--bg-muted); font-weight: 600; }

/* ---------- 24. Typeahead (reusable async autocomplete — see site.js) ---------- */
.typeahead { position: relative; }
.typeahead-menu {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 4px);
    z-index: 1055;
    max-height: 320px;
    overflow-y: auto;
    padding: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.typeahead-item {
    display: block;
    width: 100%;
    text-align: start;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}
.typeahead-item:hover, .typeahead-item.is-active { background: var(--bg-hover); }
.typeahead-label, .typeahead-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.typeahead-label { font-size: .85rem; font-weight: 500; }
.typeahead-meta  { font-size: .75rem; color: var(--text-muted); font-family: var(--font-mono); }
.typeahead-mark  { background: transparent; padding: 0; color: inherit; font-weight: 700; }
.typeahead-empty { padding: 18px 10px; text-align: center; color: var(--text-muted); font-size: .8rem; }
/* Inside an .input-group the wrapper, not the input, is the flex child — so it has to
   grow, and the input's trailing corners have to be squared against the addon itself. */
.input-group > .typeahead { flex: 1 1 auto; min-width: 0; }
.input-group > .typeahead:not(:last-child) > .typeahead-input {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
/* Locked after a pick (`data-typeahead-lock`): reads as a chosen value, not a text box -
   tinted, bold, no caret - with an × at the trailing edge to clear it. */
.typeahead.is-locked > .typeahead-input {
    background-color: var(--bg-muted);
    font-weight: 600;
    cursor: default;
    padding-inline-end: 36px;
}
.typeahead.is-locked > .typeahead-input:focus { background-color: var(--bg-muted); }
.typeahead-clear {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    z-index: 5;
}
.typeahead-clear:hover { background: var(--danger-bg); color: var(--danger); }
.typeahead-clear[hidden] { display: none; }

/* Standalone typeahead used as a page-header action (e.g. the "new advance" partner
   picker) — give it a comfortable, capped width and drop to full width on mobile. */
.advance-partner-picker { width: 320px; max-width: 100%; }
@media (max-width: 575.98px) {
    .advance-partner-picker { width: 100%; }
}

/* Full-page busy overlay (shown by site.js for data-busy-overlay forms / long navigations). */
.app-busy-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .25);
    z-index: 2000;
}
.app-busy-overlay.is-visible { display: flex; }

/* ---------- 20. Stat tiles (self-service hubs: My Attendance, My Transactions) ---------- */
/* A tile is a label + one big number + optional sub-line. Tiles sit in a row and never share a
   line with prose, which is what keeps a summary card readable at a glance. */
.stat-tile {
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--bg-muted);
    min-width: 0;
}
.stat-tile .stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.stat-tile .stat-label .ti { font-size: 1rem; }
.stat-tile .stat-value { font-size: 1.375rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.stat-tile .stat-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }
.stat-tile.is-hero .stat-value { font-size: 2rem; }
.leave-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.leave-row:first-child { border-top: 0; padding-top: 0; }
.leave-row .leave-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.leave-row .leave-name .ti { font-size: 1.125rem; }
.leave-row .leave-figures { font-size: .8125rem; color: var(--text-muted); white-space: nowrap; }
.leave-row .leave-figures strong { color: var(--text-primary); }

/* ---------- 21. KPI cards (one definition; the per-page <style> copies are being retired) ---------- */
.kpi-card { min-width: 140px; display: block; text-decoration: none; color: inherit; }
.kpi-card:hover { border-color: var(--zinc-400); }
.kpi-label { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.kpi-icon  { font-size: 1.5rem; opacity: .8; }

/* ---------- 22. Layout utilities (so pages carry no style="" attributes) ---------- */
.table-compact { font-size: .8125rem; }
.w-date   { width: 130px; }
.w-select { width: auto; min-width: 130px; }
.filter-search { min-width: 200px; }
.col-w-xs { width: 40px; }
.col-w-sm { width: 95px; }
.col-w-md { width: 130px; }
.col-w-lg { width: 160px; }
.col-w-num { width: 110px; }
.col-w-actions { width: 80px; }
.truncate-md { max-width: 220px; }
.truncate-lg { max-width: 240px; }
.empty-state-icon { font-size: 2.5rem; }

/* Progress-bar widths in 5% steps, so a server-computed percentage needs no style attribute. */
.pct-0 { width: 0%; }
.pct-5 { width: 5%; }
.pct-10 { width: 10%; }
.pct-15 { width: 15%; }
.pct-20 { width: 20%; }
.pct-25 { width: 25%; }
.pct-30 { width: 30%; }
.pct-35 { width: 35%; }
.pct-40 { width: 40%; }
.pct-45 { width: 45%; }
.pct-50 { width: 50%; }
.pct-55 { width: 55%; }
.pct-60 { width: 60%; }
.pct-65 { width: 65%; }
.pct-70 { width: 70%; }
.pct-75 { width: 75%; }
.pct-80 { width: 80%; }
.pct-85 { width: 85%; }
.pct-90 { width: 90%; }
.pct-95 { width: 95%; }
.pct-100 { width: 100%; }

/* Multi-line free text (document notes) shown as typed: keeps the line breaks, still wraps. */
.text-pre-line { white-space: pre-line; }

/* Lift on hover for clickable dashboard cards (metric cards, billing tiles). Also on keyboard
   focus, so a card reached by Tab is visibly the one that Enter will open. */
.hover-elevate { transition: transform .2s ease-in-out, box-shadow .2s ease-in-out; }
.hover-elevate:hover,
.hover-elevate:focus-visible { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.08); }
a:focus-visible > .hover-elevate,
a.hover-elevate:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
a:focus-visible > .hover-elevate { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.08); }
@media (prefers-reduced-motion: reduce) { .hover-elevate { transition: none; } .hover-elevate:hover { transform: none; } }

/* ── Sales Dashboard (/Reports/SalesDashboard) ───────────────────────────────── */
/* Chart series colours. Deliberately not --accent: that is near-black in the light theme and
   makes filled charts dominate the page. Teal = counts (transactions), electric blue = money. */
:root { --chart-1: #0d9488; --chart-2: #2563eb; }
[data-bs-theme="dark"] { --chart-1: #2dd4bf; --chart-2: #60a5fa; }

/* Emerald chart palette - the scheme's --chart-1..5 emerald ramp (docs/green_color_scheme.txt).
   --theme-chart-* exist only under an accent theme (Emerald, Maroon, Gold below): pages read them through Raqmi.chartColor/chartPalette with
   their own colour as fallback, so every other theme draws exactly as before.
     1 = primary series, 2 = secondary series (deeper, so a pair stays apart by lightness),
     3 = a faint comparison series; cat-1..9 = categories, alternating light/dark so neighbouring
     slices differ, then zinc greys once the greens run out; seq-1..4 = an ordered ramp
     (largest share darkest). Status colours (absent red, off grey) are never themed. */
[data-theme-color="green"] {
    --chart-1: var(--theme-chart-1);
    --chart-2: var(--theme-chart-2);
    --theme-chart-1: oklch(0.596 0.145 163.225);   /* emerald-600 */
    --theme-chart-2: oklch(0.432 0.095 166.913);   /* emerald-800 */
    --theme-chart-3: oklch(0.845 0.143 164.978);   /* emerald-300 */
    --theme-chart-cat-1: oklch(0.508 0.118 165.612);  /* 700 */
    --theme-chart-cat-2: oklch(0.845 0.143 164.978);  /* 300 */
    --theme-chart-cat-3: oklch(0.696 0.17 162.48);    /* 500 */
    --theme-chart-cat-4: oklch(0.378 0.077 168.94);   /* 900 */
    --theme-chart-cat-5: oklch(0.905 0.093 164.15);   /* 200 */
    --theme-chart-cat-6: oklch(0.596 0.145 163.225);  /* 600 */
    --theme-chart-cat-7: oklch(0.705 0.015 286.067);  /* zinc-400 */
    --theme-chart-cat-8: oklch(0.552 0.016 285.938);  /* zinc-500 */
    --theme-chart-cat-9: oklch(0.871 0.006 286.286);  /* zinc-300 */
    --theme-chart-seq-1: oklch(0.432 0.095 166.913);  /* 800 */
    --theme-chart-seq-2: oklch(0.596 0.145 163.225);  /* 600 */
    --theme-chart-seq-3: oklch(0.845 0.143 164.978);  /* 300 */
    --theme-chart-seq-4: oklch(0.871 0.006 286.286);  /* zinc-300 - "the rest" */
    /* Attendance has its own pair because it sits beside a fixed red (absent): a theme sets
       these only when its series colour cannot be mistaken for that red. */
    --theme-chart-onduty: var(--theme-chart-1);
    --theme-chart-band:   var(--theme-chart-2);
}
/* On a dark surface the pair flips: the lighter green leads. */
[data-bs-theme="dark"][data-theme-color="green"] {
    --theme-chart-1: oklch(0.696 0.17 162.48);     /* emerald-500 */
    --theme-chart-2: oklch(0.845 0.143 164.978);   /* emerald-300 */
    --theme-chart-3: oklch(0.432 0.095 166.913);   /* emerald-800 */
    --theme-chart-cat-7: oklch(0.552 0.016 285.938);
    --theme-chart-cat-8: oklch(0.442 0.017 285.786);
    --theme-chart-cat-9: oklch(0.705 0.015 286.067);
    --theme-chart-seq-1: oklch(0.845 0.143 164.978);
    --theme-chart-seq-3: oklch(0.432 0.095 166.913);
    --theme-chart-seq-4: oklch(0.442 0.017 285.786);
}

/* Maroon chart palette - a ramp on #C0392B's hue (29.7) with the chroma held down, as the button
   was: the scheme's own red-300..800 ramp is the "1000-watt" red again. Attendance is left on its
   own colours (no onduty/band): next to absent-red, a maroon series would read as more absences. */
[data-theme-color="maroon"] {
    --chart-1: var(--theme-chart-1);
    --chart-2: var(--theme-chart-2);
    --theme-chart-1: oklch(0.543 0.174 29.70);     /* #C0392B */
    --theme-chart-2: oklch(0.40 0.12 29.70);       /* deep maroon */
    --theme-chart-3: oklch(0.80 0.09 29.70);       /* pale */
    --theme-chart-cat-1: oklch(0.47 0.15 29.70);
    --theme-chart-cat-2: oklch(0.80 0.09 29.70);
    --theme-chart-cat-3: oklch(0.62 0.15 29.70);
    --theme-chart-cat-4: oklch(0.36 0.10 29.70);
    --theme-chart-cat-5: oklch(0.89 0.05 29.70);
    --theme-chart-cat-6: oklch(0.543 0.174 29.70);
    --theme-chart-cat-7: oklch(0.708 0 0);
    --theme-chart-cat-8: oklch(0.556 0 0);
    --theme-chart-cat-9: oklch(0.87 0 0);
    --theme-chart-seq-1: oklch(0.40 0.12 29.70);
    --theme-chart-seq-2: oklch(0.543 0.174 29.70);
    --theme-chart-seq-3: oklch(0.80 0.09 29.70);
    --theme-chart-seq-4: oklch(0.87 0 0);
}
[data-bs-theme="dark"][data-theme-color="maroon"] {
    --theme-chart-1: oklch(0.64 0.15 29.70);
    --theme-chart-2: oklch(0.80 0.09 29.70);
    --theme-chart-3: oklch(0.40 0.12 29.70);
    --theme-chart-cat-7: oklch(0.556 0 0);
    --theme-chart-cat-8: oklch(0.44 0 0);
    --theme-chart-cat-9: oklch(0.708 0 0);
    --theme-chart-seq-1: oklch(0.80 0.09 29.70);
    --theme-chart-seq-3: oklch(0.40 0.12 29.70);
    --theme-chart-seq-4: oklch(0.44 0 0);
}

/* Gold chart palette - a ramp on the Gold accent #92722A (oklch 0.57 0.097 84.4). Attendance:
   shift bands / early-out turn gold, on-duty stays green (gold is no "present" colour). */
[data-theme-color="gold"] {
    --chart-1: var(--theme-chart-1);
    --chart-2: var(--theme-chart-2);
    --theme-chart-1: oklch(0.57 0.097 84.4);       /* #92722A */
    --theme-chart-2: oklch(0.43 0.075 80);         /* bronze */
    --theme-chart-3: oklch(0.83 0.09 86);          /* pale gold */
    --theme-chart-cat-1: oklch(0.50 0.088 82);
    --theme-chart-cat-2: oklch(0.83 0.09 86);
    --theme-chart-cat-3: oklch(0.67 0.11 85);
    --theme-chart-cat-4: oklch(0.38 0.065 78);
    --theme-chart-cat-5: oklch(0.91 0.06 88);
    --theme-chart-cat-6: oklch(0.57 0.097 84.4);
    --theme-chart-cat-7: oklch(0.705 0.015 286.067);
    --theme-chart-cat-8: oklch(0.552 0.016 285.938);
    --theme-chart-cat-9: oklch(0.871 0.006 286.286);
    --theme-chart-seq-1: oklch(0.43 0.075 80);
    --theme-chart-seq-2: oklch(0.57 0.097 84.4);
    --theme-chart-seq-3: oklch(0.83 0.09 86);
    --theme-chart-seq-4: oklch(0.871 0.006 286.286);
    --theme-chart-band:  var(--theme-chart-1);
}
[data-bs-theme="dark"][data-theme-color="gold"] {
    --theme-chart-1: oklch(0.70 0.11 85);
    --theme-chart-2: oklch(0.83 0.09 86);
    --theme-chart-3: oklch(0.45 0.075 80);
    --theme-chart-cat-7: oklch(0.552 0.016 285.938);
    --theme-chart-cat-8: oklch(0.442 0.017 285.786);
    --theme-chart-cat-9: oklch(0.705 0.015 286.067);
    --theme-chart-seq-1: oklch(0.83 0.09 86);
    --theme-chart-seq-3: oklch(0.45 0.075 80);
    --theme-chart-seq-4: oklch(0.442 0.017 285.786);
}
.sd-kpi-label { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.sd-kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sd-kpi-foot { font-size: .75rem; }
.sd-today-spark { height: 40px; min-width: 160px; }
.sd-chart { height: 280px; }
.sd-chart-sm { height: 240px; }
.sd-subtle { font-size: .8rem; color: var(--text-muted); }
/* Ranked list: label, bar, figure — a readable replacement for a many-slice doughnut. */
.sd-rank { list-style: none; margin: 0; padding: 0; }
.sd-rank li { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; gap: .15rem .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--border-subtle); font-size: .8125rem; }
.sd-rank li:last-child { border-bottom: 0; }
.sd-rank .sd-rank-no { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sd-rank .sd-rank-bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--bg-muted); overflow: hidden; }
.sd-rank .sd-rank-bar > span { display: block; height: 100%; background: var(--chart-1); }
.sd-rank .sd-rank-bar.is-other > span { background: var(--text-faint); }
.sd-rank.is-money .sd-rank-bar > span { background: var(--chart-2); }
.sd-rank .sd-rank-bar.is-risk > span { background: var(--danger); }
.sd-move-up { color: var(--success); }
.sd-move-down { color: var(--danger); }
/* Wide pivots: the employee column stays put while months/categories scroll. */
.sd-sticky-col { position: sticky; left: 0; z-index: 1; background: var(--bs-body-bg); }
.tbl-total .sd-sticky-col { background: var(--bs-tertiary-bg); }
[dir="rtl"] .sd-sticky-col { left: auto; right: 0; }
.sd-heat-1 { background: color-mix(in srgb, var(--chart-1) 12%, transparent) !important; }
.sd-heat-2 { background: color-mix(in srgb, var(--chart-1) 24%, transparent) !important; }
.sd-heat-3 { background: color-mix(in srgb, var(--chart-1) 38%, transparent) !important; }
.sd-heat-4 { background: color-mix(in srgb, var(--chart-1) 55%, transparent) !important; color: var(--text-primary) !important; font-weight: 600; }
.sd-bar { height: 6px; }
@media print {
    .sd-chart, .sd-chart-sm { height: 220px; }
    .sd-sticky-col { position: static; }
}

/* ---------- HR request progress timeline (/HR/Requests/Detail) ---------- */
/* A vertical stepper: one dot per event, joined by a rail; the step awaiting action is tinted. */
.wf-progress { list-style: none; margin: 0; padding: 14px 16px; }
.wf-progress li { position: relative; padding: 0 0 18px 32px; }
.wf-progress li:last-child { padding-bottom: 0; }
.wf-progress li::before { content: ''; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 2px; background: var(--border-default); }
.wf-progress li:last-child::before { display: none; }
.wf-progress .wf-dot { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8125rem; color: #fff; background: var(--text-faint); }
.wf-progress .wf-dot.is-success { background: var(--success); }
.wf-progress .wf-dot.is-danger  { background: var(--danger); }
.wf-progress .wf-dot.is-info    { background: var(--info); }
.wf-progress .wf-dot.is-pending { background: var(--bg-surface); border: 2px solid var(--warning); color: var(--warning); }
.wf-progress .wf-title { font-weight: 600; font-size: .875rem; }
.wf-progress .wf-meta  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.wf-progress .wf-note  { font-size: .8125rem; margin-top: 4px; white-space: pre-wrap; }
.wf-progress li.is-current .wf-body { background: var(--warning-bg); border-radius: var(--radius); padding: 6px 10px; margin: -6px 0 0 -4px; }
[dir="rtl"] .wf-progress li { padding: 0 32px 18px 0; }
[dir="rtl"] .wf-progress li::before { left: auto; right: 10px; }
[dir="rtl"] .wf-progress .wf-dot { left: auto; right: 0; }
[dir="rtl"] .wf-progress li.is-current .wf-body { margin: -6px -4px 0 0; }
.req-header-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--bg-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.req-explanation { background: var(--bg-muted); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; }
.req-pre { white-space: pre-wrap; }
/* HR request → schedule & clock-ins drawer: day timelines (TimelineAxis supplies left/width). */
.req-context-drawer { --bs-offcanvas-width: 48rem; }
@media (max-width: 767.98px) { .req-context-drawer { --bs-offcanvas-width: 100vw; } }
.ctx-section { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); }
.ctx-section-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .75rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ctx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: .5rem; margin-bottom: .875rem; }
.ctx-stat { background: var(--bg-muted); border-radius: var(--radius-sm); padding: .4rem .6rem; }
.ctx-stat-label { font-size: .7rem; color: var(--text-muted); }
.ctx-stat-value { font-family: var(--bs-font-monospace); font-size: .95rem; font-weight: 600; }
.ctx-stat.is-danger { background: var(--danger-bg); } .ctx-stat.is-danger .ctx-stat-value { color: var(--danger); }
.ctx-stat.is-warning { background: var(--warning-bg); } .ctx-stat.is-warning .ctx-stat-value { color: var(--warning); }
.ctx-stat.is-success { background: var(--success-bg); } .ctx-stat.is-success .ctx-stat-value { color: var(--success); }
.tl-grid { display: grid; grid-template-columns: 12rem 1fr 5.5rem; column-gap: .75rem; row-gap: .45rem; align-items: center; font-size: .8125rem; }
.tl-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-family: var(--bs-font-monospace); font-size: .75rem; color: var(--text-muted); text-align: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-ticks { position: relative; height: 1rem; font-size: .68rem; color: var(--text-faint); }
.tl-ticks span { position: absolute; transform: translateX(-50%); }
.tl { position: relative; height: 1rem; background: var(--bg-muted); border-radius: 4px; overflow: hidden; }
.tl-seg { position: absolute; top: 0; bottom: 0; }
.tl-shift { background: var(--zinc-300); }
.tl-present { top: 30%; bottom: 30%; background: var(--success); border-radius: 2px; }
.tl-req { background: repeating-linear-gradient(135deg, rgba(24, 24, 27, .45) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px rgba(24, 24, 27, .55); }
.tl-other { background: repeating-linear-gradient(135deg, rgba(217, 119, 6, .45) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--warning); }
.tl-clash { background: repeating-linear-gradient(135deg, rgba(220, 38, 38, .5) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--danger); }
.tl-band { z-index: 2; background: rgba(24, 24, 27, .08); border-left: 1.5px dashed var(--text-secondary); border-right: 1.5px dashed var(--text-secondary); pointer-events: none; }
.tl-punch { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--text-primary); opacity: .7; }
.tl-off { background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(24, 24, 27, .06) 6px 12px); }
.tl-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--danger); margin-inline-end: .35rem; vertical-align: middle; }
.tl-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .72rem; color: var(--text-muted); }
.tl-legend i.sw { display: inline-block; width: 1.25rem; height: .6rem; border-radius: 2px; margin-inline-end: .3rem; vertical-align: middle; position: relative; }
.tl-legend i.tl-present-sw { background: var(--success); height: .3rem; }
.tl-legend i.tl-punch-sw { width: 2px; background: var(--text-primary); }
.ctx-day-label { width: 6.5rem; flex-shrink: 0; }
[data-bs-theme="dark"] .tl-shift { background: var(--zinc-600); }
[data-bs-theme="dark"] .tl-req { background: repeating-linear-gradient(135deg, rgba(250, 250, 250, .45) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px rgba(250, 250, 250, .55); }
[data-bs-theme="dark"] .tl-band { background: rgba(250, 250, 250, .08); }
@media (max-width: 575.98px) { .tl-grid { grid-template-columns: 6.5rem 1fr 4.5rem; } }
.border-dashed { border-style: dashed !important; }
/* Master list selection (e.g. /Config/Disciplinary): a tint and an accent rail, not Bootstrap's blue. */
.list-group-item.is-selected { background: var(--bg-active); color: var(--text-primary); box-shadow: inset 3px 0 0 var(--accent); font-weight: 500; }
[dir="rtl"] .list-group-item.is-selected { box-shadow: inset -3px 0 0 var(--accent); }
.list-scroll { max-height: 70vh; overflow-y: auto; }

/* ---------- HR Analytics (/HR/Analytics) ---------- */
.min-w-0 { min-width: 0; }
/* Readiness ring: a conic fill driven by --p (0–100); colour from the band class. */
.hra-ring { --p: 0; --ring: var(--text-faint); flex-shrink: 0; width: 64px; height: 64px; border-radius: 50%;
            display: grid; place-items: center;
            background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--bg-muted) 0); }
.hra-ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--bg-surface);
                   display: grid; place-items: center; font-weight: 700; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.hra-ring.is-success { --ring: var(--success); }
.hra-ring.is-warning { --ring: var(--warning); }
.hra-ring.is-danger  { --ring: var(--danger); }
/* KPI icon square: grey by default; tinted only when the card needs action — colour means status, not section. */
.kpi-badge { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center;
             font-size: 1.25rem; background: var(--bg-muted); color: var(--text-muted); }
.kpi-badge.is-danger  { background: var(--danger-bg);  color: var(--danger); }
.kpi-badge.is-warning { background: var(--warning-bg); color: var(--warning); }
.kpi-badge.is-info    { background: var(--info-bg);    color: var(--info); }
.kpi-card.is-active   { border-color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--text-primary); }

/* HR Requests register filter bar: one row on desktop, wraps to 3 then 2 columns. */
.req-filter-grid { display: grid; gap: .75rem; align-items: end; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px)  { .req-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .req-filter-grid { grid-template-columns: 1.1fr 1fr 1.3fr 1fr 1fr 1.8fr; } }
/* ── Background Jobs (/Config/ManageBackgroundJobs) ── */
.job-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .job-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .job-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.job-card { display: flex; flex-direction: column; gap: .75rem; padding: 1.1rem 1.15rem; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-xl); transition: border-color .15s, box-shadow .15s; }
.job-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(0, 0, 0, .06); }
.job-card-head { display: flex; align-items: center; gap: .75rem; }
.job-card-icon { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--radius-lg); background: var(--bg-muted); color: var(--text-muted); font-size: 1.15rem; }
.job-card.is-on .job-card-icon { background: var(--success-bg); color: var(--success); }
.job-card-title { flex: 1; min-width: 0; }
.job-card-name { font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.job-card-meta { margin-top: .2rem; }
.job-card-switch { flex: none; margin: 0; font-size: 1.15rem; }
.job-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--bg-muted); color: var(--text-muted); }
.job-pill-ok { background: var(--success-bg); color: var(--success); }
.job-pill-warn { background: var(--warning-bg); color: var(--warning); }
.job-card-desc { flex: 1; margin: 0; font-size: .85rem; line-height: 1.5; color: var(--text-muted); }
.job-card-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; padding-top: .85rem; border-top: 1px solid var(--border-subtle); }
.job-card-freq { flex: 1 1 11rem; min-width: 0; }
.job-card-label { display: block; margin-bottom: .25rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.job-card-actions { display: flex; gap: .5rem; }
.job-card-changed { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--text-muted); }

/* ---------- 25. Resizable table columns (site.js initResizableColumns) ---------- */
table[data-resizable-columns] > thead > tr > th { position: relative; }
.col-resizer { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 7px; cursor: col-resize; touch-action: none; z-index: 1; }
.col-resizer::after { content: ""; position: absolute; top: 20%; bottom: 20%; inset-inline-end: 2px; width: 2px; border-radius: 1px; background: transparent; transition: background var(--transition-fast); }
th:hover > .col-resizer::after { background: var(--border-strong, var(--border-subtle)); }
.col-resizer:hover::after, .col-resizer.is-active::after { background: var(--accent); }
table.is-col-fixed { table-layout: fixed; }
table.is-col-fixed > thead > tr > th,
table.is-col-fixed > tbody > tr > td { overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere; }
body.is-col-resizing, body.is-col-resizing * { cursor: col-resize !important; user-select: none; }
@media print {
    .col-resizer { display: none; }
    table.is-col-fixed { table-layout: auto; width: 100% !important; }
    table.is-col-fixed > thead > tr > th { width: auto !important; }
    table.is-col-fixed > thead > tr > th,
    table.is-col-fixed > tbody > tr > td { white-space: normal; overflow: visible; }
}

/* ---------- 26. Split view: list + side preview pane (js/invoice-preview.js) ---------- */
.split-view { display: flex; align-items: flex-start; }
.split-main { flex: 1 1 auto; min-width: 0; }
.split-gutter { flex: 0 0 14px; align-self: stretch; position: relative; cursor: col-resize; touch-action: none; }
.split-gutter::after { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 6px; width: 2px; border-radius: 1px; background: var(--border-subtle); transition: background var(--transition-fast); }
.split-gutter:hover::after, .split-gutter.is-dragging::after, .split-gutter:focus-visible::after { background: var(--accent); }
.split-gutter:focus-visible { outline: none; }
.split-pane {
    flex: 0 0 var(--split-pane-w, 40%);
    width: var(--split-pane-w, 40%);
    position: sticky;
    top: calc(var(--topbar-h) + 12px);
    height: calc(100vh - var(--topbar-h) - 24px);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.split-pane-header { display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; border-bottom: 1px solid var(--border-subtle); }
.split-pane-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: .85rem; }
tr.is-previewed > td { --bs-table-bg-state: var(--bs-primary-bg-subtle); }
.inv-preview-notes { white-space: pre-wrap; }
/* Invoices drawer: toolbar + tabs stay put while the tab content scrolls (offsets cancel the body padding) */
.inv-drawer .inv-preview > dl { max-width: 36rem; }   /* keep label and value together when the drawer is wide */
.inv-drawer-head { position: sticky; top: -.85rem; z-index: 2; margin: -.85rem -.85rem 0; padding: .85rem .85rem 0; background: var(--bg-surface); }
/* Overlay variant (.split-view.is-overlay, the Invoices list): the pane slides over the list from the
   inline-end edge instead of narrowing it; the gutter rides its leading edge for resizing. */
.split-view.is-overlay .split-pane {
    position: fixed; top: var(--topbar-h); bottom: 0; inset-inline-end: 0; z-index: 1040;
    width: var(--split-pane-w, 60vw); height: auto; max-width: calc(100vw - 2rem);
    border-radius: 0; border-block: 0; border-inline-end: 0; box-shadow: var(--shadow-lg);
}
.split-view.is-overlay .split-gutter {
    position: fixed; top: var(--topbar-h); bottom: 0; z-index: 1041; width: 14px;
    inset-inline-end: calc(var(--split-pane-w, 60vw) - 7px);
}
@media (max-width: 991.98px) {
    .split-gutter { display: none; }
    .split-pane { position: fixed; inset: 0; z-index: 1055; width: auto; height: auto; border-radius: 0; }
    .split-view.is-overlay .split-pane { top: 0; width: auto; max-width: none; z-index: 1055; }
}

/* File drop target beside a hidden file input (page script, e.g. HR/Requests/Detail) */
.file-drop { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: .6rem .75rem; text-align: center; font-size: .8rem; color: var(--text-muted); cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast); }
.file-drop:hover, .file-drop:focus-visible, .file-drop.is-dragover { border-color: var(--accent); background: var(--bg-muted); outline: none; }
.file-drop > .ti { color: var(--accent); }

/* ---------- 27. In-page file preview drawer (site.js initFilePreview, template in _Layout) ---------- */
.file-preview { --bs-offcanvas-width: 45vw; max-width: calc(100vw - 200px); border-inline-start: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.15)); }
.file-preview-header { gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border-subtle); }
.file-preview-header .offcanvas-title { min-width: 0; font-size: .875rem; }
.file-preview-icon { font-size: 1.15rem; color: var(--text-muted); flex: none; }
.file-preview-header .btn-icon:disabled { opacity: .35; pointer-events: none; }
[dir="rtl"] .file-preview-flip i { transform: scaleX(-1); }
.file-preview-body { padding: 0; display: flex; background: var(--bg-muted); overflow: auto; }
.file-preview-frame { flex: 1 1 auto; width: 100%; min-height: 100%; border: 0; background: #fff; }
.file-preview-image { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; cursor: zoom-in; }
.file-preview-body.is-zoomed { display: block; }
.file-preview-body.is-zoomed .file-preview-image { max-width: none; max-height: none; cursor: zoom-out; }
.file-preview-message { margin: auto; max-width: 28rem; padding: 2rem 1.5rem; text-align: center; color: var(--text-muted); font-size: .875rem; }
.file-preview-resizer { position: absolute; top: 0; bottom: 0; inset-inline-start: -4px; width: 8px; cursor: col-resize; touch-action: none; z-index: 2; }
.file-preview-resizer:hover, .file-preview-resizer:focus-visible { background: color-mix(in srgb, var(--accent) 25%, transparent); outline: none; }
body.is-col-resizing iframe { pointer-events: none; }
@media (max-width: 767.98px) { .file-preview { max-width: 100vw; } .file-preview-resizer { display: none; } }

/* ---------- 28. Notification side pane (NotificationBell view component) ---------- */
.notif-pane { --bs-offcanvas-width: 26rem; max-width: 100vw; border-inline-start: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.15)); }
.notif-pane-header { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border-subtle); }
.notif-pane-title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.notif-pane-count { font-size: .7rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--bg-muted); color: var(--text-muted); }
.notif-pane-link { font-size: .8125rem; color: var(--text-muted); text-decoration: underline; }
.notif-pane-link:hover { color: var(--text-primary); }
.notif-pane-body { flex: 1 1 auto; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; background: var(--bg-muted); }
.notif-pane-footer { padding: .75rem; border-top: 1px solid var(--border-subtle); }
.notif-pane-empty { margin: auto; text-align: center; color: var(--text-muted); }
.notif-pane-empty .ti { font-size: 2rem; display: block; margin-bottom: .5rem; }
.notif-card { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .85rem; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface, var(--bg-app)); text-decoration: none; color: var(--text-primary); transition: background-color .12s, border-color .12s; }
.notif-card:hover { background: var(--bg-hover); color: var(--text-primary); }
.notif-card-icon { width: 28px; height: 28px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-muted); color: var(--text-muted); font-size: .95rem; }
.notif-card-icon.is-urgent { background: color-mix(in srgb, var(--bs-warning) 18%, transparent); color: var(--bs-warning); }
.notif-card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.notif-card-title { font-size: .875rem; font-weight: 600; }
.notif-card-body { font-size: .8125rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-card-time { font-size: .75rem; color: var(--text-muted); }
.notif-card-dot { margin-top: .4rem; }

/* ---------- 29. Dashboard card family (Index + its widget view components) ----------
   One card: the site's own surface, 1px subtle border, --radius, --shadow-xs. Nothing inside a card
   carries its own shadow. The hero (.dash-hero) is the single deliberate accent. */
.dash-card { overflow: hidden; margin-bottom: 0; }
.dash-card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 20px 22px 0; }
/* A rule only where the content underneath is edge to edge (tables, lists) or the header is a drawer's. */
.dash-card-header + .table-responsive, .dash-card-header + .dash-card-body--flush { margin-top: 16px; border-top: 1px solid var(--border-subtle); }
.offcanvas-header.dash-card-header { padding: 16px 22px; border-bottom: 1px solid var(--border-subtle); }
.dash-card-title { margin: 0; display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 500; letter-spacing: -0.005em; color: var(--text-primary); }
.dash-card-title > .ti { font-size: 1.05rem; color: var(--text-muted); }
.dash-card-sub { display: block; font-size: .75rem; font-weight: 400; color: var(--text-muted); }
.dash-card-link { font-size: .8125rem; font-weight: 500; text-decoration: none; }
.dash-card-body { padding: 16px 22px 22px; }
.dash-card-body--flush { padding: 0; }
.dash-card-empty { padding: 2rem 1rem; text-align: center; font-size: .875rem; color: var(--text-muted); }
.dash-card-empty > .ti { display: block; margin-bottom: .5rem; font-size: 2rem; color: var(--text-muted); opacity: .6; }
.dash-card-empty-title { font-weight: 600; color: var(--text-primary); margin-bottom: .15rem; }

/* Plain stat column (billing figures): no fill, no box - columns divided by a hairline. */
.dash-stats > [class*="col"] + [class*="col"] { border-top: 1px solid var(--border-subtle); margin-top: 16px; padding-top: 16px; }
@media (min-width: 768px) {
    .dash-stats > [class*="col"] + [class*="col"] { border-top: 0; margin-top: 0; padding-top: 0; border-inline-start: 1px solid var(--border-subtle); }
    .dash-stats > [class*="col"] { padding-inline: 24px; }
    .dash-stats > [class*="col"]:first-child { padding-inline-start: 0; }
}
.dash-tile { display: block; color: inherit; text-decoration: none; }
a.dash-tile:hover .dash-tile-value { color: var(--accent, var(--bs-primary)); }
.dash-tile-label { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-size: .8125rem; font-weight: 500; color: var(--text-muted); }
.dash-tile-value { font-size: 2rem; font-weight: 500; line-height: 1.1; letter-spacing: -0.03em; color: var(--text-primary); }
.dash-tile-unit { margin-inline-start: .25rem; font-size: .875rem; font-weight: 400; color: var(--text-muted); }
.dash-tile-foot { margin-top: .4rem; font-size: .8125rem; color: var(--text-muted); }

/* Small tinted status pill: the only colour a quiet card needs. */
.dash-pill { display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 500; background: var(--bg-muted); color: var(--text-muted); }
.dash-pill--warning { color: var(--bs-warning-text-emphasis, var(--bs-warning)); background: color-mix(in srgb, var(--bs-warning) 16%, transparent); }
.dash-pill--danger { color: var(--bs-danger); background: color-mix(in srgb, var(--bs-danger) 12%, transparent); }
.dash-pill--success { color: var(--bs-success); background: color-mix(in srgb, var(--bs-success) 12%, transparent); }

/* Slim tinted notice row (replaces the bordered .alert in widgets). */
.dash-alert { display: flex; align-items: center; gap: .75rem; padding: 10px 14px; border-radius: var(--radius); text-decoration: none; }
.dash-alert--danger { color: var(--bs-danger-text-emphasis, var(--bs-danger)); background: color-mix(in srgb, var(--bs-danger) 9%, transparent); }
.dash-alert--danger:hover { background: color-mix(in srgb, var(--bs-danger) 14%, transparent); color: var(--bs-danger-text-emphasis, var(--bs-danger)); }

/* Round icon chip; tone via modifier. */
.dash-icon { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-muted); border: 1px solid var(--border-subtle); color: var(--text-muted); font-size: .95rem; }
.dash-icon--sm { width: 28px; height: 28px; font-size: .85rem; }
.dash-icon--md { width: 40px; height: 40px; font-size: 1.1rem; border-radius: var(--radius); }
.dash-icon--primary { color: var(--bs-primary); background: color-mix(in srgb, var(--bs-primary) 10%, transparent); border-color: color-mix(in srgb, var(--bs-primary) 25%, transparent); }
.dash-icon--success { color: var(--bs-success); background: color-mix(in srgb, var(--bs-success) 10%, transparent); border-color: color-mix(in srgb, var(--bs-success) 25%, transparent); }
.dash-icon--warning { color: var(--bs-warning); background: color-mix(in srgb, var(--bs-warning) 12%, transparent); border-color: color-mix(in srgb, var(--bs-warning) 30%, transparent); }
.dash-icon--danger { color: var(--bs-danger); background: color-mix(in srgb, var(--bs-danger) 10%, transparent); border-color: color-mix(in srgb, var(--bs-danger) 25%, transparent); }

/* List row inside a card (action-required items). Accent bar says the urgency. */
.dash-row { position: relative; display: flex; align-items: center; gap: .75rem; padding: 12px 14px 12px 18px; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-surface); transition: background-color var(--transition-fast), border-color var(--transition-fast); }
.dash-row:hover { background: var(--bg-hover); border-color: var(--border-default); }
.dash-row-accent { position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; }

/* Activity timeline (moved from an inline <style> on Index). */
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: -16px; width: 1px; background: var(--border-default); z-index: 1; }
.timeline-icon { position: relative; z-index: 2; }
.dash-list-item:hover { background-color: var(--bg-hover); }

/* Inbox drawer: same header/section rhythm as the notification pane. */
.dash-drawer { --bs-offcanvas-width: 26rem; max-width: 100vw; border-inline-start: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.15)); }
.dash-drawer-section { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--bg-muted); border-block: 1px solid var(--border-subtle); font-size: .8125rem; font-weight: 600; color: var(--text-primary); }
.dash-drawer-section > span > .ti { color: var(--text-muted); margin-inline-end: .35rem; }

/* Feed rows (Recent activity): same scale as the other cards -- 13px body, 12px meta. */
.dash-feed-title { font-size: .875rem; font-weight: 500; line-height: 1.3; color: var(--text-primary); margin-bottom: .2rem; }
.dash-feed-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .75rem; color: var(--text-muted); }

/* ---------- 30. Community Hub calendar (FullCalendar 6, scoped to the dashboard widget) ----------
   Same type steps as the other cards: 15px title, 13px content, 12px meta. Quiet chrome, tinted events. */
#community-calendar {
    --fc-border-color: var(--border-subtle);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--bg-muted);
    --fc-today-bg-color: transparent;
    --fc-list-event-hover-bg-color: var(--bg-hover);
    font-size: .8125rem;
}
#community-calendar .fc-toolbar { margin-bottom: 14px; gap: .75rem; }
#community-calendar .fc-toolbar-chunk { display: flex; align-items: center; gap: .5rem; }
#community-calendar .fc-toolbar-title { font-size: .9375rem; font-weight: 500; color: var(--text-primary); margin: 0 0 0 .25rem; }
#community-calendar .fc-button { font-size: .8125rem; font-weight: 500; padding: .25rem .6rem; line-height: 1.3; box-shadow: none !important; }
#community-calendar .fc-button-primary {
    --fc-button-bg-color: var(--bg-surface);
    --fc-button-border-color: var(--border-default);
    --fc-button-text-color: var(--text-primary);
    --fc-button-hover-bg-color: var(--bg-hover);
    --fc-button-hover-border-color: var(--border-default);
    --fc-button-active-bg-color: var(--bg-muted);
    --fc-button-active-border-color: var(--border-default);
}
#community-calendar .fc-button-primary:not(:disabled).fc-button-active { background: var(--bg-muted); font-weight: 600; }
#community-calendar .fc-button .fc-icon { font-size: 1.1em; }
#community-calendar .fc-button-group > .fc-button { border-radius: 0; }
#community-calendar .fc-button-group > .fc-button:first-child { border-start-start-radius: var(--radius); border-end-start-radius: var(--radius); }
#community-calendar .fc-button-group > .fc-button:last-child { border-start-end-radius: var(--radius); border-end-end-radius: var(--radius); }
#community-calendar .fc-scrollgrid { border-color: var(--border-subtle); }
#community-calendar .fc-col-header-cell-cushion { font-size: .75rem; font-weight: 500; color: var(--text-muted); padding: 6px 4px; text-decoration: none; }
#community-calendar .fc-daygrid-day-number { font-size: .75rem; color: var(--text-muted); padding: 4px 6px; text-decoration: none; }
#community-calendar .fc-day-sat, #community-calendar .fc-day-sun { background: color-mix(in srgb, var(--bg-muted) 55%, transparent); }
#community-calendar .fc-day-other .fc-daygrid-day-number { opacity: .45; }
/* Today: a filled circle on the date, not a tinted cell. */
#community-calendar .fc-day-today .fc-daygrid-day-number { background: var(--bs-primary); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; margin: 3px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
#community-calendar .fc-more-link { font-size: .75rem; color: var(--text-muted); }
/* Events: soft tinted chips, community = primary, birthdays = amber. */
#community-calendar .fc-event { border: 0; border-radius: 4px; padding: 1px 5px; font-size: .75rem; font-weight: 500; cursor: pointer; }
#community-calendar .fc-event.cal-community { background: color-mix(in srgb, var(--bs-primary) 14%, transparent); color: var(--bs-primary); }
#community-calendar .fc-event.cal-birthday { background: color-mix(in srgb, var(--bs-warning) 22%, transparent); color: var(--bs-warning-text-emphasis, #8a5a00); }
#community-calendar .fc-event .fc-event-main, #community-calendar .fc-event .fc-event-title { color: inherit; }
#community-calendar .fc-daygrid-dot-event .fc-event-title { font-weight: 500; }
#community-calendar .fc-daygrid-event-dot { display: none; }
#community-calendar .fc-list { border-color: var(--border-subtle); }
#community-calendar .fc-list-day-cushion { background: var(--bg-muted); font-size: .75rem; font-weight: 500; }
#community-calendar .fc-list-event-title, #community-calendar .fc-list-event-time { font-size: .8125rem; }
#community-calendar .fc-list-event.cal-community .fc-list-event-dot { border-color: var(--bs-primary); }
#community-calendar .fc-list-event.cal-birthday .fc-list-event-dot { border-color: var(--bs-warning); }

/* ---------- 31. Export dialog (Transactions report) ---------- */
.export-label { font-size: .8125rem; font-weight: 600; color: var(--text-primary); margin-bottom: .5rem; }
.export-opt { display: flex; align-items: center; gap: .75rem; height: 100%; padding: 12px 14px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--bg-surface); cursor: pointer; transition: border-color var(--transition-fast), background-color var(--transition-fast); }
.export-opt > .ti { font-size: 1.4rem; color: var(--text-muted); }
.export-opt small { display: block; font-size: .75rem; color: var(--text-muted); }
.export-opt:hover { background: var(--bg-hover); }
.btn-check:checked + .export-opt { border-color: var(--bs-primary); background: color-mix(in srgb, var(--bs-primary) 7%, var(--bg-surface)); }
.btn-check:checked + .export-opt > .ti { color: var(--bs-primary); }
.btn-check:focus-visible + .export-opt { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.export-cols { border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-muted); padding: 4px 14px 10px; }
.export-group + .export-group { border-top: 1px solid var(--border-subtle); }
.export-group-title { padding: 10px 0 2px; font-size: .75rem; font-weight: 600; color: var(--text-muted); }
/* 44px rows: a column is ticked with a thumb on a phone. */
.export-col { display: flex; align-items: center; gap: .6rem; min-height: 44px; margin: 0; font-size: .8125rem; cursor: pointer; }
.export-col .form-check-input { margin: 0; flex: none; width: 1.1rem; height: 1.1rem; }
@media (min-width: 768px) { .export-col { min-height: 34px; } }

/* ---------- 32. My Calendar (HR/Schedules/MyCalendar, shown in the dashboard widget's modal) ----------
   Each working day is a chip in its shift's colour: a solid bar on the leading edge and a light tint of
   the same colour behind normal text, so pale shift colours (#ebc634) and dark ones (#8d2612) both stay
   readable in light and dark themes. --shift is set per cell from hr_shifts.color_hex. */
.mycal-frame { display: block; width: 100%; height: min(78vh, 760px); border: 0; }
.mycal-body { min-height: 0; padding: 16px 20px 20px; background: var(--bg-surface); }
.mycal { --shift: var(--zinc-500); }
.mycal-toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: 14px; flex-wrap: wrap; }
.mycal-title { margin: 0 0 0 .5rem; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
[dir="rtl"] .mycal-title { margin: 0 .5rem 0 0; }
.mycal-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mycal-stat { display: flex; align-items: baseline; gap: .4rem; padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-muted); }
.mycal-stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-primary); }
.mycal-stat-label { font-size: .8rem; color: var(--text-muted); }
.mycal-grid { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.mycal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mycal-row + .mycal-row { border-top: 1px solid var(--border-subtle); }
.mycal-head { background: var(--bg-muted); }
.mycal-dow { padding: 8px 10px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.mycal-dow.is-weekend { color: var(--text-faint); }
.mycal-cell { position: relative; min-height: 92px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-surface); }
.mycal-cell + .mycal-cell { border-inline-start: 1px solid var(--border-subtle); }
.mycal-date { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.mycal-cell.is-outside { background: var(--bg-app); }
.mycal-cell.is-outside > * { opacity: .45; }
.mycal-cell.is-today .mycal-date { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.mycal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.mycal-chip { display: flex; flex-direction: column; gap: 1px; padding: 4px 7px; border-radius: var(--radius-sm); border-inline-start: 3px solid var(--shift); background: color-mix(in srgb, var(--shift) 16%, var(--bg-surface)); color: var(--text-primary); min-width: 0; }
.mycal-chip-time { font-family: var(--font-mono); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mycal-chip-name { font-size: .72rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mycal-cell.is-off { background: repeating-linear-gradient(135deg, var(--bg-surface) 0 8px, var(--bg-muted) 8px 16px); }
.mycal-cell.is-holiday { background: var(--warning-bg); }
.mycal-tag { display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 500; color: var(--text-muted); background: var(--bg-surface); border: 1px solid var(--border-subtle); }
.mycal-cell.is-holiday .mycal-tag { color: var(--warning); border-color: transparent; }
/* Approved leave = success tint, public holiday = warning tint (both tokens exist in every theme). The
   shift planned underneath stays visible, muted and dashed: leave never overwrites the schedule. */
.mycal-cell.is-leave { background: var(--success-bg); }
.mycal-cell.is-leave .mycal-tag { color: var(--success); border-color: transparent; }
.mycal-tag { max-width: 100%; }
.mycal-tag > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mycal-chip.is-planned { opacity: .6; background: transparent; border: 1px dashed var(--shift); border-inline-start: 3px solid var(--shift); }
.mycal-stat.is-leave .mycal-stat-value { color: var(--success); }
.mycal-stat.is-holiday .mycal-stat-value { color: var(--warning); }
.mycal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px; font-size: .8rem; color: var(--text-secondary); }
.mycal-legend-title { font-weight: 600; color: var(--text-muted); }
.mycal-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.mycal-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--shift); flex: none; }
.mycal-legend-meta { font-family: var(--font-mono); font-size: .75rem; color: var(--text-muted); }
/* Phone width: the seven columns stay, the chip drops to a coloured bar and the time. */
@media (max-width: 575.98px) {
    .mycal-body { padding: 12px; }
    .mycal-cell { min-height: 64px; padding: 4px 3px; }
    .mycal-chip { padding: 2px 3px; }
    .mycal-chip-name, .mycal-tag i { display: none; }
    .mycal-chip-time { font-size: .62rem; }
    .mycal-tag { padding: 1px 4px; font-size: .62rem; }
}

/* Dashboard widget: the shift pill in the next-7-days table, in the shift's colour. */
.sched-shift { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: .78rem; font-weight: 500; color: var(--text-primary); background: color-mix(in srgb, var(--shift, var(--zinc-500)) 16%, var(--bg-surface)); }
.sched-shift::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--shift, var(--zinc-500)); flex: none; }
.sched-shift > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-tag { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; color: var(--text-muted); background: var(--bg-muted); }
.sched-tag.is-leave { color: var(--success); background: var(--success-bg); }
.sched-tag.is-holiday { color: var(--warning); background: var(--warning-bg); }
tr.sched-today > td:first-child { font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] tr.sched-today > td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
