/* ============================================================
   app.css — Fluent UI Blazor Shell
   ============================================================ */

/* ── Inter variable font (self-hosted, works offline) ────────
   Weights 100–900 from a single variable font file.
   Fallback: Segoe UI (Windows) → system-ui → sans-serif.      */
@font-face {
    font-family: 'Inter';
    src: url('/_content/Basis.Shared/fonts/InterVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/_content/Basis.Shared/fonts/InterVariable-Italic.woff2') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/* Box-sizing reset — tanpa ini FluentDataGrid mengkalkulasi
   lebar/tinggi cell dengan salah (padding dihitung di luar width).
   Ini juga kenapa header checkbox SelectColumn bisa tampil tidak sejajar. */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --body-font: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
    --type-ramp-base-font-size: 14px;

    /* ── LIGHT MODE: Surface hierarchy ──────────────────────────
       Chrome (header/sidebar) < Canvas (body) < Cards < Floating
       Three distinct levels — eyes have anchor points to rest on. */
    --neutral-layer-1:          #f4f5f8;  /* body canvas — slightly blue-grey */
    --neutral-layer-2:          #eaecf2;  /* chrome — header, sidebar, footer */
    --neutral-fill-layer-rest:  #fbfbfb;  /* card surfaces — fluent-card, filter */
    --neutral-layer-floating:   #fbfbfb;  /* stat-card, dropdowns, popovers */
    --neutral-layer-card-container: #fbfbfb; /* sticky table cells inside cards */

    /* ── LIGHT MODE: Input fills ── */
    --neutral-fill-input-rest:   #ffffff;
    --neutral-fill-input-hover:  #f9f9fb;
    --neutral-fill-input-active: #f3f4f8;
    --neutral-fill-input-focus:  #ffffff;

    /* ── LIGHT MODE: Control fills (buttons, rows, stealth) ── */
    --neutral-fill-rest:          #f3f4f8;
    --neutral-fill-hover:         #eaecf2;
    --neutral-fill-active:        #e2e4ec;
    --neutral-fill-focus:         #f3f4f8;
    --neutral-fill-stealth-hover: #eaecf2;

    /* ── LIGHT MODE: Strokes ── */
    --neutral-stroke-rest:          #d2d3dc;
    --neutral-stroke-input-rest: #d2d3dc;
    --neutral-stroke-divider-rest:  #e6e7ef;

    /* ── LIGHT MODE: Foreground ── */
    --neutral-foreground-rest: #1a1a28;
    --neutral-foreground-hint: #66667a;

    /* ── LIGHT MODE: Semantic status colors ──────────────────────
       Single source of truth for error/success/warning across the
       app. These were previously referenced but never defined, so
       var(--error) etc. silently resolved to the inherited color. */
    --error:                  #c50f1f;
    --error-foreground:       #b10e1c;
    --error-fill-rest:        #d13438;
    --success:                #107c10;
    --success-foreground:     #0e700e;
    --success-fill-rest:      #13a10e;
    --success-background:     #54b054;
    --warning:                #c57a00;
    --warning-foreground:     #b45309;
    --warning-foreground-rest:#b45309;
    --warning-fill-rest:      #c57a00;

    /* ── LIGHT MODE: Fluent palette tokens ── */
    --colorPaletteRedForeground1:     #c50f1f;
    --colorPaletteRedBackground1:     #fde7e9;
    --colorPaletteRedBackground2:     #f9d0d2;
    --colorPaletteRedBackground3:     #d13438;
    --colorPaletteRedBorder1:         #fca5a5;
    --colorPaletteGreenForeground1:   #107c10;
    --colorPaletteGreenBackground1:   #e7f6e7;
    --colorPaletteGreenBackground2:   #d8f5e4;
    --colorPaletteGreenBorder2:       #9fd89f;
    --colorPaletteYellowForeground1:  #c57a00;
    --colorPaletteYellowBackground2:  #fff1c2;
    --colorPaletteYellowBorder2:      #e9c558;
    --colorPaletteBlueForeground2:    #0078d4;
    --colorPaletteMarigoldForeground2:#9e6a03;
    --colorPaletteMarigoldBackground2:#f9e9c6;
    --colorPaletteBerryForeground1:   #b4009e;
    --colorPaletteBerryBackground2:   #f0d9f5;
}

/* ============================================================
   DARK MODE — CSS variable overrides
   Surface hierarchy: Canvas < Chrome < Cards < Stat-card/Float
   Higher elevation = slightly lighter background.
   ============================================================ */
[data-theme="dark"] {
    /* Tell the browser to render native widgets (checkbox, scrollbar, date
       picker) dark so they don't show a white background in dark mode. */
    color-scheme: dark;
    /* ── Surfaces — pure neutral grey, no colour tint ── */
    --neutral-layer-1: #141414; /* body canvas — near-black */
    --neutral-layer-2: #1c1c1c; /* chrome — header, sidebar, footer */
    --neutral-fill-layer-rest: #212121; /* card surfaces */
    --neutral-layer-floating: #292929; /* stat-card, dropdowns, popovers */
    --neutral-layer-card-container: #212121; /* sticky cells match card bg */
    /* ── Input fills ── */
    --neutral-fill-input-rest: #1e1e1e;
    --neutral-fill-input-hover: #232323;
    --neutral-fill-input-active: #282828;
    --neutral-fill-input-focus: #1e1e1e;
    /* ── Control fills ── */
    --neutral-fill-rest: #212121;
    --neutral-fill-hover: #272727;
    --neutral-fill-active: #2e2e2e;
    --neutral-fill-focus: #212121;
    --neutral-fill-stealth-hover: #272727;
    --neutral-fill-stealth-rest: transparent;
    /* ── Strokes ── */
    --neutral-stroke-rest: #333333;
    --neutral-stroke-input-rest: #333333;
    --neutral-stroke-divider-rest: #2a2a2a;
    --rpt-row-rule: #363636;
    /* ── Foreground ── */
    --neutral-foreground-rest: #e0e0e0;
    --neutral-foreground-hint: #888888;

    /* ── Semantic status colors — brightened for dark surfaces ── */
    --error:                  #f1707b;
    --error-foreground:       #f1707b;
    --error-fill-rest:        #e37d80;
    --success:                #6ccb5f;
    --success-foreground:     #6ccb5f;
    --success-fill-rest:      #54b054;
    --success-background:     #54b054;
    --warning:                #e9a52f;
    --warning-foreground:     #e9a52f;
    --warning-foreground-rest:#e9a52f;
    --warning-fill-rest:      #e9a52f;

    /* ── Fluent palette tokens — dark variants ── */
    --colorPaletteRedForeground1:     #f1707b;
    --colorPaletteRedBackground1:     #3f1011;
    --colorPaletteRedBackground2:     #561f21;
    --colorPaletteRedBackground3:     #b52e31;
    --colorPaletteRedBorder1:         #6e2527;
    --colorPaletteGreenForeground1:   #6ccb5f;
    --colorPaletteGreenBackground1:   #16281a;
    --colorPaletteGreenBackground2:   #1e3a2a;
    --colorPaletteGreenBorder2:       #2f5c3a;
    --colorPaletteYellowForeground1:  #e9b158;
    --colorPaletteYellowBackground2:  #4d3d10;
    --colorPaletteYellowBorder2:      #6e5c1e;
    --colorPaletteBlueForeground2:    #4ba0e1;
    --colorPaletteMarigoldForeground2:#e9b158;
    --colorPaletteMarigoldBackground2:#4d3a10;
    --colorPaletteBerryForeground1:   #d97bd0;
    --colorPaletteBerryBackground2:   #3d1e44;
}

/* ::part() fallback — override shadow DOM inputs to match token */
[data-theme="dark"] fluent-text-field::part(control),
[data-theme="dark"] fluent-number-field::part(control),
[data-theme="dark"] fluent-text-area::part(control),
[data-theme="dark"] fluent-combobox::part(control),
[data-theme="dark"] fluent-autocomplete::part(control),
[data-theme="dark"] fluent-select::part(control),
[data-theme="dark"] fluent-date-picker::part(control),
[data-theme="dark"] fluent-time-picker::part(control),
[data-theme="dark"] fluent-search::part(control) {
    background-color: var(--neutral-fill-input-rest) !important;
}

/* Disabled inputs in dark mode — Fluent fades the whole control with
   --disabled-opacity, which sinks the #333 border into the near-black canvas
   so the field outline disappears. Restore full opacity and convey the disabled
   state explicitly with a muted fill + hint text, keeping the border readable. */
[data-theme="dark"] fluent-text-field[disabled],
[data-theme="dark"] fluent-number-field[disabled],
[data-theme="dark"] fluent-text-area[disabled],
[data-theme="dark"] fluent-combobox[disabled],
[data-theme="dark"] fluent-autocomplete[disabled],
[data-theme="dark"] fluent-select[disabled],
[data-theme="dark"] fluent-date-picker[disabled],
[data-theme="dark"] fluent-time-picker[disabled],
[data-theme="dark"] fluent-search[disabled] {
    opacity: 1 !important;
}

[data-theme="dark"] fluent-text-field[disabled]::part(control),
[data-theme="dark"] fluent-number-field[disabled]::part(control),
[data-theme="dark"] fluent-text-area[disabled]::part(control),
[data-theme="dark"] fluent-combobox[disabled]::part(control),
[data-theme="dark"] fluent-autocomplete[disabled]::part(control),
[data-theme="dark"] fluent-select[disabled]::part(control),
[data-theme="dark"] fluent-date-picker[disabled]::part(control),
[data-theme="dark"] fluent-time-picker[disabled]::part(control),
[data-theme="dark"] fluent-search[disabled]::part(control) {
    background-color: var(--neutral-fill-input-rest) !important; /* slightly darker than the card so the field reads as recessed */
    border-color: #4d4d4d !important;                            /* brighter than --neutral-stroke-rest (#333) so the outline stays visible on cards */
    color: var(--neutral-foreground-hint) !important;
}

fluent-text-field::part(control)::placeholder,
fluent-number-field::part(control)::placeholder,
fluent-text-area::part(control)::placeholder,
fluent-combobox::part(control)::placeholder,
fluent-autocomplete::part(control)::placeholder,
fluent-search::part(control)::placeholder {
    color: rgba(0, 0, 0, 0.32);
    opacity: 1;
}

[data-theme="dark"] fluent-text-field::part(control)::placeholder,
[data-theme="dark"] fluent-number-field::part(control)::placeholder,
[data-theme="dark"] fluent-text-area::part(control)::placeholder,
[data-theme="dark"] fluent-combobox::part(control)::placeholder,
[data-theme="dark"] fluent-autocomplete::part(control)::placeholder,
[data-theme="dark"] fluent-search::part(control)::placeholder {
    color: rgba(255, 255, 255, 0.28);
    opacity: 1;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: var(--body-font);
    font-size: var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    color: var(--neutral-foreground-rest);
    background: var(--neutral-layer-2);
    /* Font rendering — match tabler.io softness */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-optical-sizing: auto;
    /* Inter OpenType features: humanist letterforms (cv01=I, cv03=6/9, cv04=a) */
    font-feature-settings: "cv01","cv03","cv04";
}


/* ----------------------------------------------------------
   SHELL — overflow:hidden di sini tidak masalah karena
   FluentProfileMenu me-render popover via portal ke <body>,
   bukan di dalam .app-shell.
   ---------------------------------------------------------- */
.app-shell {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
}

/* ----------------------------------------------------------
   HEADER
   ---------------------------------------------------------- */
.app-header {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 12px !important;
    height: 48px !important;
    background-color: var(--neutral-layer-2) !important;
    border-bottom: 1px solid var(--neutral-stroke-rest) !important;
    overflow: visible !important;
    /* position:relative guarantees a stacking context so header
       popovers (notifications) always float above content bars */
    position: relative !important;
    z-index: 200;
}

.header-gutters {
    margin: 0px !important;
}

.hdr-left {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.hdr-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.hdr-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
    flex-shrink: 0;
    overflow: visible;
}

/* Brand */
.app-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    color: var(--neutral-foreground-rest) !important;
    border-radius: var(--corner-radius-medium, 4px);
    transition: background 120ms ease;
    white-space: nowrap;
}

    .app-brand:hover {
        background: var(--neutral-fill-stealth-hover);
        text-decoration: none !important;
    }

.brand-icon {
    color: var(--accent-fill-rest) !important;
    flex-shrink: 0;
}

/* Buttons di header dan sidebar-header: transparent saat normal,
   background hanya muncul saat hover — override FAST stealth token */
.app-header,
.bsp-header,
.sidebar-header {
    --neutral-fill-stealth-rest: transparent;
    --neutral-fill-stealth-active: var(--neutral-fill-stealth-hover);
}

.brand-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-fill-rest);
}

.brand-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--neutral-foreground-hint);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hdr-search {
    border-radius: 999px !important;
    /* Override Fluent fill tokens so the search box inherits header color */
    --neutral-fill-rest:        var(--neutral-layer-2) !important;
    --neutral-fill-hover:       var(--neutral-layer-2) !important;
    --neutral-fill-active:      var(--neutral-layer-2) !important;
    --neutral-fill-focus:       var(--neutral-layer-2) !important;
    --neutral-fill-input-rest:  var(--neutral-layer-2) !important;
    --neutral-fill-input-hover: var(--neutral-layer-2) !important;
    --neutral-fill-input-active:var(--neutral-layer-2) !important;
    --neutral-fill-input-focus: var(--neutral-layer-2) !important;
}

    .hdr-search::part(root) {
        background-color: var(--neutral-layer-2) !important;
    }

.hdr-search::part(control),
.hdr-search::part(start),
.hdr-search::part(end) {
    background-color: var(--neutral-layer-2) !important;
}

.hdr-search-wrap {
    position: relative;
}

.hdr-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: var(--neutral-layer-floating);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: var(--layer-corner-radius);
    box-shadow: var(--shadow-16);
    overflow: hidden;
    z-index: 9999;
}

.hdr-search-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}

.hdr-search-item:hover,
.hdr-search-item-active {
    background: var(--neutral-fill-stealth-hover);
}

.hdr-search-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--neutral-foreground-rest);
}

.hdr-search-item-group {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    flex-shrink: 0;
}

.hdr-search-empty {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--neutral-foreground-hint);
    text-align: center;
}

/* Notification badge on bell icon */
.hdr-notif-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

/* Notification popover — custom, rendered at root (outside FluentHeader's
   stacking context) so it always floats above content bars. Styled to match
   FluentPopover: floating layer, flyout shadow, divider border, 4px padding. */
.notif-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
}

.notif-popover {
    position: fixed;
    width: 350px;
    max-width: 94vw;
    background: var(--neutral-layer-floating);
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: calc(var(--control-corner-radius) * 1px);
    box-shadow: var(--elevation-shadow-flyout);
    z-index: 999;
    padding: 4px;
}

.notif-popover-header {
    padding: 8px 12px 6px;
}

/* Notification popover items */
.notif-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--control-corner-radius);
}

.notif-item:hover {
    background: var(--neutral-fill-stealth-hover);
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon-warn  {
    background: rgba(197, 122, 0, 0.12);
    color: var(--colorPaletteYellowForeground1, #c57a00);
}
.notif-icon-info  {
    background: rgba(0, 120, 212, 0.12);
    color: var(--colorPaletteBlueForeground2, #0078d4);
}

.notif-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-foreground-rest) !important;
}

.notif-sub {
    font-size: 11px;
    color: var(--neutral-foreground-hint) !important;
}

.notif-chevron {
    flex-shrink: 0;
    color: var(--neutral-foreground-hint) !important;
}

.notif-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    font-size: 13px;
    color: var(--neutral-foreground-hint) !important;
}

.notif-header-title {
    color: var(--neutral-foreground-rest) !important;
}

.hdr-divider {
    height: 22px !important;
    margin: 0 2px !important;
}


/* ----------------------------------------------------------
   BODY ROW
   ---------------------------------------------------------- */
.app-body-row {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ----------------------------------------------------------
   SIDEBAR & NAV MENU
   ---------------------------------------------------------- */
.app-sidebar {
    flex-shrink: 0;
    border-inline-end: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest) !important;
    background: var(--neutral-layer-2);
    overflow: hidden;
    z-index: 50;
    display: flex;
    flex-direction: column;
    will-change: width;
    transition: width 200ms cubic-bezier(.4, 0, .2, 1);
}

.sidebar-title-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1; /* Mengisi ruang yang tersisa */
    min-width: 0; /* Mencegah overflow */
    padding-inline-start: inherit;
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--accent-fill-rest); /* Warna ikon senada dengan teks */
    flex-shrink: 0; /* Ikon tidak mengecil */
    margin-inline-start: 4px;
}

.sidebar-title {
    margin: 0px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-fill-rest);
    white-space: nowrap; /* Mencegah teks turun ke bawah */
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-navmenu {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-stroke-rest) transparent;
    overscroll-behavior: none;
    
}

fluent-nav-group::part(heading) {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .65px !important;
    color: var(--neutral-foreground-hint) !important;
    padding: 10px 10px 2px !important;
}

fluent-nav-link::part(content) {
    padding: 4px 10px !important;
    margin: 1px 4px !important;
    min-height: 30px !important;
    border-radius: var(--corner-radius-medium, 4px) !important;
    font-size: 14px !important;
    gap: 8px !important;
    transition: background 120ms ease, color 120ms ease !important;
    color: var(--neutral-foreground-rest) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

fluent-nav-link:hover::part(content) {
    background: var(--neutral-fill-stealth-hover) !important;
}

fluent-nav-link[aria-current="page"]::part(content) {
    background: var(--accent-fill-rest) !important;
    color: var(--foreground-on-accent-rest) !important;
    font-weight: 600 !important;
}

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */
@media (min-width: 768px) {
    .app-sidebar {
        position: static;
    }

    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: flex !important;
    }
}

@media (max-width: 767px) {
    .app-sidebar {
        position: absolute;
        top: 0;
        inset-inline-start: 0;
        bottom: 0;
        width: 0 !important;
        border-inline-end: none;
        box-shadow: none;
        transition: width 260ms cubic-bezier(.4, 0, .2, 1), box-shadow 260ms ease;
    }

        .app-sidebar.mobile-open {
            width: 280px !important;
            box-shadow: 4px 0 20px rgba(0, 0, 0, .28);
        }

    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    .hdr-search {
        width: 140px !important;
    }

    .brand-sub {
        display: none !important;
    }

}

.mobile-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 49;
    animation: fadeOverlay 200ms ease forwards;
}

@keyframes fadeOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ----------------------------------------------------------
   MAIN CONTENT
   ---------------------------------------------------------- */
fluent-body-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.app-content {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: auto !important;
    padding: 0 !important; /* remove padding from scroll container */
    overscroll-behavior: none;
}

/* Preview pages (doc-preview-wrap present): suppress outer scroll so only
   doc-preview-wrap scrolls — prevents double scrollbar on document previews */
.app-content:has(.doc-preview-wrap) {
    overflow: hidden !important;
}

.app-content-inner {
    display: flex !important;
    flex-direction: column !important;
    /* Normal pages: grow with content so app-content can scroll */
    min-height: 100% !important;
    padding: 24px;
}

/* Preview pages: fixed height so doc-preview-wrap fills remaining space.
   No overflow:hidden here — that would clip inv-bar's negative margin
   and break position:sticky. app-content handles outer clipping. */
.app-content-inner:has(.doc-preview-wrap) {
    height: 100% !important;
    min-height: 0 !important;
}


/* ==========================================================
   CONSISTENT SCROLLBAR
   ========================================================== */

.app-navmenu,
.app-content,
.body-content {
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-stroke-rest) transparent;
    scroll-behavior: smooth;
    will-change: scroll-position;
}

    .app-navmenu::-webkit-scrollbar,
    .app-content::-webkit-scrollbar,
    .body-content::-webkit-scrollbar {
        width: 4px;
    }

    .app-navmenu::-webkit-scrollbar-thumb,
    .app-content::-webkit-scrollbar-thumb,
    .body-content::-webkit-scrollbar-thumb {
        background: var(--neutral-stroke-rest);
        border-radius: 999px;
    }

        .app-navmenu::-webkit-scrollbar-thumb:hover,
        .app-content::-webkit-scrollbar-thumb:hover,
        .body-content::-webkit-scrollbar-thumb:hover {
            background: var(--neutral-foreground-hint);
        }

/* ----------------------------------------------------------
   FOOTER
   ---------------------------------------------------------- */
.app-footer {
    flex-shrink: 0 !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    color: var(--neutral-foreground-hint) !important;
    border-top: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest) !important;
    background: var(--neutral-layer-2) !important;
}

.footer-version,
.footer-copyright {
    font-size: 0.75rem;
    opacity: 0.55;
    letter-spacing: 0.02em;
}

.footer-version {
    /* Logical property: pushes to the far edge in both LTR and RTL */
    margin-inline-start: auto;
}

.footer-licensee {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    padding: 2px 9px 2px 6px;
    border-radius: 20px;
    border: 1px solid var(--neutral-stroke-rest);
    background: var(--neutral-layer-3);
    color: var(--neutral-foreground-hint);
    opacity: 0.75;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 768px) {
    .footer-licensee,
    .footer-copyright {
        display: none;
    }

    .footer-version {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ----------------------------------------------------------
   TOAST OVERRIDES
   Replaces FluentUI's plain opacity fade with a slide-in from
   the right + spring easing, and adds a smooth fade-out exit.
   ---------------------------------------------------------- */

.fluent-toast {
    animation-name: toast-enter !important;
    animation-duration: 0.42s !important;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
    animation-fill-mode: both !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06) !important;
    border-inline-start: 3px solid transparent !important;
    transition: opacity 0.25s ease, transform 0.25s ease !important;
}

/* Colored left accent per intent */
.fluent-toast.success { border-left-color: var(--success) !important; }
.fluent-toast.error   { border-left-color: var(--error) !important; }
.fluent-toast.warning { border-left-color: var(--warning) !important; }
.fluent-toast.info    { border-left-color: var(--info) !important; }

/* Exit: FluentUI sets opacity:0 + removes element — smooth it */
.fluent-toast[style*="opacity: 0"],
.fluent-toast[style*="opacity:0"] {
    opacity: 0 !important;
    transform: translateX(20px) !important;
    transition: opacity 0.22s ease, transform 0.22s ease !important;
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateX(calc(100% + 32px));
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* ----------------------------------------------------------
   PAGE HELPERS
   ---------------------------------------------------------- */
.page-header {
    margin-bottom: 20px;
}

/* Mobile: hide label text and collapse button to icon-only size */
@media (max-width: 640px) {
    .hdr-btn .btn-label {
        display: none;
    }
    .hdr-btn::part(content) {
        display: none;
    }
    .hdr-btn::part(control) {
        padding-inline: 0;
        min-width: 32px;
        justify-content: center;
    }
    .hdr-btn::part(start) {
        margin-inline-end: 0;
    }
}

/* Mobile: wrap page-header title + action button to avoid overflow */
@media (max-width: 480px) {
    .page-header .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Push button (single) or button-group wrapper (multi) to the far edge */
    .page-header .d-flex > :last-child {
        margin-inline-start: auto;
    }
    /* When last child is a div wrapper containing multiple buttons, right-align them */
    .page-header .d-flex > div:last-child {
        justify-content: flex-end;
    }
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 3px;
    line-height: 1.2;
    color: var(--neutral-foreground-rest);
}

.page-subtitle {
    font-size: 14px;
    margin: 0;
    color: var(--neutral-foreground-hint);
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--neutral-foreground-hint);
    margin-bottom: 6px;
}

    .page-breadcrumb a {
        color: var(--accent-foreground-rest);
    }

/* Inline CSS spinner — used where FluentProgressRing is unreliable (MAUI WebView) */
@keyframes spin { to { transform: rotate(360deg); } }
.spin-ring {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid var(--accent-fill-rest);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

.bc-link {
    color: var(--accent-foreground-rest);
    text-decoration: none;
    font-weight: 500;
}

.bc-link:hover {
    text-decoration: underline;
    color: var(--accent-foreground-hover);
}

/* ----------------------------------------------------------
   CARDS
 * fluent-card (FAST web component) has overflow:hidden in its shadow :host
 * which clips absolutely-positioned overlays (FluentSelect listbox, etc.).
 * External CSS overrides shadow :host styles per CSS cascade spec, so this
 * restores overflow:visible so dropdowns can escape the card boundary.
 */
fluent-card {
    overflow: visible;
}

.fluent-card {
    background-color: var(--neutral-fill-layer-rest);
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
    padding: 12px 20px;
    /*box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);*/
    /*transition: box-shadow 180ms ease;*/
}

    .fluent-card:hover {
        box-shadow: var(--elevation-shadow-card-hover);
    }

.fluent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

.fluent-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--neutral-foreground-rest);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--neutral-layer-floating);
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
    padding: 16px 20px;
    /*box-shadow: var(--elevation-shadow-card-rest);*/
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    overflow: hidden;
    /*transition: box-shadow 180ms ease, transform 120ms ease;*/
}

    .stat-card:hover {
        box-shadow: var(--elevation-shadow-card-hover);
        transform: translateY(-1px);
    }

    .stat-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--accent-fill-rest);
        border-radius: 8px 8px 0 0;
    }

/* ── Light-mode surfaces — dimmed slightly off pure white (#fbfbfb) ──
   Scoped to the components on purpose: the FluentUI design-token system
   sets --neutral-fill-layer-rest / --neutral-layer-floating at runtime
   above :root, so a :root override does NOT take — per-component
   selectors win. Dark mode is reset to its own surface values. */
.fluent-card                     { --neutral-fill-layer-rest: #fbfbfba6; }
.stat-card,
.admin-hub-tile,
.save-footer                     { --neutral-layer-floating:  #fbfbfba6; }

[data-theme="dark"] .fluent-card { --neutral-fill-layer-rest: #212121a6; }
[data-theme="dark"] .stat-card,
[data-theme="dark"] .admin-hub-tile,
[data-theme="dark"] .save-footer { --neutral-layer-floating:  #212121a6; }

/* ── Softer focus ring ──────────────────────────────────────────
   FluentUI applies --focus-stroke-outer per element at runtime, so a
   :root override never reaches the component's shadow .control. Force a
   gentler colour everywhere with !important (default is harsh near-black
   in light / near-white in dark). */
* { --focus-stroke-outer: #9a9a9a !important; }
[data-theme="dark"] * { --focus-stroke-outer: #6f6f6f !important; }

/* Native elements (nav links, native <select>/<input>, etc.) use the
   browser's UA :focus-visible outline — not the FluentUI token — so soften
   that colour too for a consistent, less harsh focus ring. */
:focus-visible { outline-color: #9a9a9a; }
[data-theme="dark"] :focus-visible { outline-color: #6f6f6f; }

.stat-card-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--neutral-foreground-hint);
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-card-value {
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    color: var(--neutral-foreground-rest);
    margin-inline-start: 20px;
}
    .stat-card-value.text-amount {
        font-size: 15px;
        letter-spacing: -0.03em;
    }


.stat-card-sub {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
}

.stat-card-trend {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-inline-start: 20px;
}

    .stat-card-trend.positive {
        color: var(--colorPaletteGreenForeground1, #54a854);
    }

    .stat-card-trend.negative {
        color: var(--colorPaletteRedForeground1, #e5524a);
    }

/* ----------------------------------------------------------
   GRID
   ---------------------------------------------------------- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-5 > *, .grid-auto > * {
    min-width: 0;
}

/* ── Report filter bar — 12-col grid, setiap input=span 2, setiap tombol=span 1 ── */
.report-filters {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    align-items: end;
    gap: 8px;
}

/* Setiap input control menggunakan 2 kolom */
.report-filters > *:not(.filter-actions) {
    grid-column: span 2;
}

/* filter-actions: 2 tombol × 1 kolom = 2 kolom, tombol tidak stretch */
.report-filters > .filter-actions {
    grid-column: span 2;
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

@media (max-width: 900px) {
    .report-filters > *:not(.filter-actions) {
        grid-column: span 4;
    }
    .report-filters > .filter-actions {
        grid-column: span 4;
    }
}

@media (max-width: 540px) {
    .report-filters > *:not(.filter-actions) {
        grid-column: span 12;
    }
    .report-filters > .filter-actions {
        grid-column: span 12;
    }
}

@media (max-width: 1200px) {
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2, .grid-5 {
        grid-template-columns: 1fr;
    }

    .hdr-center {
        display: none;
    }
}

/* ----------------------------------------------------------
   QUICK ACTIONS
   ---------------------------------------------------------- */
.qa-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 640px) {
    .qa-actions {
        grid-template-columns: 1fr;
    }
}

.qa-actions fluent-button {
    width: 100%;
}

/* ----------------------------------------------------------
   UTILITIES
   ---------------------------------------------------------- */
.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-5 {
    margin-top: 24px;
}

.mt-6 {
    margin-top: 32px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-5 {
    margin-bottom: 24px;
}

.mb-6 {
    margin-bottom: 32px;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.text-muted {
    color: var(--neutral-foreground-hint);
}

.text-accent {
    color: var(--accent-foreground-rest);
}

.text-success {
    color: var(--colorPaletteGreenForeground1, #107c10);
}

.text-warning {
    color: var(--colorPaletteYellowForeground1, #c57a00);
}

.text-warn {
    color: var(--colorPaletteYellowForeground1, #c57a00);
}

.text-error {
    color: var(--colorPaletteRedForeground1, #d13438);
}

.dt .dt-subtotal-row td,
.dt-sm .dt-subtotal-row td {
    border-top: 2px solid var(--neutral-stroke-rest);
    background: var(--neutral-fill-subtle);
    font-weight: 600;
    padding: 8px 10px;
}

.stat-card-danger { border-color: var(--colorPaletteRedBorder1, #d13438); }

/* Stock movement card header */
.rpt-card-meta  { font-size: 13px; color: var(--neutral-foreground-hint); }


/* ----------------------------------------------------------
   ERROR UI
   ---------------------------------------------------------- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--colorPaletteRedBackground1, #fde7e9);
    border: 1px solid var(--colorPaletteRedBorder1, #fca5a5);
    color: var(--colorPaletteRedForeground1, #991b1b);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    z-index: 9999;
    max-width: 480px;
    width: 90%;
    text-align: center;
}

/* ----------------------------------------------------------
   PATCH Fluent Ui Component
   ---------------------------------------------------------- */
.fluent-messagebar {
    width: unset !important;
}

fluent-message-bar {
    width: unset !important;
}

.fluent-popover-content {
    width: 100% !important;
}

.stack-horizontal {
    width: unset !important;
}

.fluent-card-minimal-style {
    width: unset !important;
    box-shadow: unset !important;
}

fluent-select {
    min-width: 160px !important;
}

/* ----------------------------------------------------------
   MAUI SAFE AREA
   ---------------------------------------------------------- */
@supports (padding: env(safe-area-inset-top)) {
    .app-header {
        padding-top: env(safe-area-inset-top) !important;
        height: calc(48px + env(safe-area-inset-top)) !important;
    }
}
/* ==========================================================
   NOT FOUND PAGE
   ========================================================== */

.notfound-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.notfound-card {
    text-align: center;
    padding: 40px 50px;
    max-width: 420px;
    background: var(--neutral-layer-floating);
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
    box-shadow: var(--elevation-shadow-card-rest);
}

.notfound-icon {
    color: var(--accent-fill-rest);
    margin-bottom: 12px;
}

.notfound-title {
    font-size: 56px;
    margin: 0;
}

.notfound-text {
    margin-top: 24px;
    color: var(--neutral-foreground-hint);
}


/* ==========================================================
   DATA ENTRY TABLE — inline form tables (GL, Inventory, etc.)
   ========================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    /* no font-size here — inherit 14px from html/body */
}

    .data-table th {
        padding: 6px 8px;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--neutral-foreground-hint);
        border-bottom: 2px solid var(--neutral-stroke-rest);
        text-align: start;
        white-space: nowrap;
    }

        .data-table th.text-right {
            text-align: end;
        }

        .data-table th.text-center {
            text-align: center;
        }

    .data-table td {
        padding: 4px 8px;
        border-bottom: 1px solid var(--neutral-stroke-rest);
        vertical-align: middle;
    }

        .data-table td.code-col {
            font-size: 13px;
            font-weight: 500;
            color: var(--neutral-foreground-rest);
        }

        .data-table td.text-right {
            text-align: end;
        }

        .data-table td.text-center {
            text-align: center;
        }

        .data-table td.fw-600 {
            font-weight: 600;
        }

        .data-table td.muted {
            color: var(--neutral-foreground-hint);
        }

    .data-table tfoot td {
        border-top: 2px solid var(--neutral-stroke-rest);
        border-bottom: none;
        font-weight: 600;
        padding: 5px 8px;
    }

    /* Sticky first two columns for wide tables */
    .data-table td.sticky-0,
    .data-table th.sticky-0 {
        position: sticky;
        inset-inline-start: 0;
        z-index: 1;
        background: var(--neutral-layer-card-container);
    }

    .data-table td.sticky-1,
    .data-table th.sticky-1 {
        position: sticky;
        inset-inline-start: 88px;
        z-index: 1;
        background: var(--neutral-layer-card-container);
    }

    /* Stock highlight */
    .data-table td.cell-has-value {
        background: rgba(0, 128, 0, 0.05);
    }

    .data-table tr.row-has-stock {
        background: rgba(0, 128, 0, 0.03);
    }

/* ==========================================================
   FORM INPUT LABEL — softer color untuk dark mode
   ==========================================================
   Masalah: label bawaan Fluent UI pakai --neutral-foreground-rest
   yang di dark mode = putih penuh (#fff), terlalu kontras.

   Solusi: override via ::part(label) — ini cara resmi Fluent UI
   untuk styling internal shadow DOM element.

   Token yang dipakai: --neutral-foreground-hint
   - Light mode: abu gelap (~#605e5c) — cukup terbaca, tidak dominan
   - Dark mode : abu terang (~#a19f9d) — soft, tidak silau

   Komponen yang di-cover:
   fluent-text-field, fluent-text-area, fluent-number-field,
   fluent-select, fluent-combobox, fluent-date-picker,
   fluent-time-picker, fluent-autocomplete
   ========================================================== */
fluent-text-field::part(label),
fluent-text-area::part(label),
fluent-number-field::part(label),
fluent-select::part(label),
fluent-combobox::part(label),
fluent-date-picker::part(label),
fluent-time-picker::part(label),
fluent-autocomplete::part(label) {
    color: var(--neutral-foreground-hint) !important;
    font-size: 13px;
    font-weight: 500;
}

/* Hide profile name/role text on mobile, show only avatar */

.user-profile-menu {
    background: transparent;
    --fluent-profile-menu-hover: var(--neutral-fill-stealth-hover);
    padding: 2px 6px;
}

@media (max-width: 600px) {
    .profile-text {
        display: none !important;
    }
}

/* ----------------------------------------------------------
   SELECT-BUSINESS / OWNER PORTAL PAGE
   ---------------------------------------------------------- */
.bsp-header {
    height: 48px;
    background: var(--neutral-layer-2);
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    padding: 0 clamp(12px, 4vw, 28px);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    z-index: 10;
}

.bsp-owner-badge {
    background: var(--accent-fill-rest);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.bsp-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: clamp(12px, 4vw, 28px);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.bsp-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.bsp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.bsp-grant-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

    .bsp-grant-row > div {
        flex: 1;
        min-width: 150px;
    }

/* ----------------------------------------------------------
   List-style rows — no fill, no radius, divider underline only.
   Shared by the Data Folder card and the business list so they
   read as a clean stacked list rather than separated cards.
   ---------------------------------------------------------- */
.bsp-list {
    display: flex;
    flex-direction: column;
}

.bsp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

    .bsp-row:last-child {
        border-bottom: 0;
    }

/* Whole-row clickable variant (simple picker) — hover feedback only,
   keeps the no-fill resting state. */
.bsp-row--link {
    cursor: pointer;
}

    .bsp-row--link:hover {
        background: var(--neutral-fill-stealth-hover);
    }

/* ── Data Folder row ── */
.bsp-folder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    margin-bottom: 16px;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

.bsp-folder-info {
    flex: 1;
    min-width: 0;
}

.bsp-folder-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--neutral-foreground-hint);
    margin-bottom: 2px;
}

.bsp-folder-path {
    font-family: var(--fontFamilyMonospace, monospace);
    font-size: 13px;
    word-break: break-all;
}

.bsp-folder-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Shared row content (business / user / archived) ── */
.bsp-row-info {
    flex: 1;
    min-width: 0;
}

.bsp-row-title {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.bsp-row-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
}

.bsp-row-meta {
    font-size: 12px;
    color: var(--neutral-foreground-hint);
}

/* Opt-in single-line clipping (omit where a row holds an inline badge). */
.bsp-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bsp-row-id {
    font-family: monospace;
    font-size: 10px;
    color: var(--neutral-foreground-hint);
    opacity: 0.55;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bsp-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}


/* ================================================================
   SIDEBAR HEADER
   ================================================================ */
.sidebar-header {
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    padding: 0 6px;
    box-sizing: border-box;
    gap: 6px;
    flex-shrink: 0;
    overflow: hidden;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

/* ── Nav menu — collapsed state ──────────────────────────────────
   Component sets width:40px inline; sidebar is 56px → stretch it.
   Then centre each icon row.
   ---------------------------------------------------------------- */
.sidebar-collapsed .app-navmenu {
    width: 100% !important;
    min-width: 0 !important;
}

/* The anchor / div wrapping each row */
.sidebar-collapsed .fluent-nav-link {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
}

/* The inner layout containers */
.sidebar-collapsed .positioning-region,
.sidebar-collapsed .content-region {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    gap: 0 !important;
    width: 100% !important;
    margin-inline-start: unset !important;
}

    .sidebar-collapsed .positioning-region::before {
        content: unset !important;
    }

.fluent-nav-item .positioning-region:not(:hover) {
    background: unset !important;
}

/* Hide text labels and expand arrows when collapsed */
.sidebar-collapsed .fluent-nav-text,
.sidebar-collapsed .expand-collapse-button,
.sidebar-collapsed .rotate {
    display: none !important;
}

/* Give the icon a comfortable tap target */
.sidebar-collapsed .fluent-nav-icon {
    margin: 0 !important;
}


/* ================================================================
   SIDEBAR PROFILE FOOTER (bottom of sidebar, Claude-style)
   ================================================================ */

.sidebar-profile-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* Trigger button — collapsed: avatar centred */
.sidebar-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    width: 100%;
    box-sizing: border-box;
    gap: 10px;
    cursor: pointer;
    min-height: 52px;
    transition: background 140ms ease;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
}

    .sidebar-profile-btn:hover {
        background: var(--neutral-fill-stealth-hover);
    }

    .sidebar-profile-btn:focus-visible {
        outline: 2px solid var(--accent-fill-rest);
        outline-offset: -2px;
        border-radius: 4px;
    }

    /* Expanded state */
    .sidebar-profile-btn.is-expanded {
        justify-content: flex-start;
        padding-left: 12px;
        padding-right: 12px;
    }

/* Avatar circle */
.sidebar-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--accent-fill-rest);
    color: var(--foreground-on-accent-rest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sidebar-avatar-lg {
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 16px;
}

.sidebar-profile-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--neutral-foreground-rest);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-profile-email {
    font-size: 12px;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Popover */

fluent-anchored-region {
    border-radius: calc(var(--control-corner-radius) * 1px);
    /* Tanpa overflow:hidden di sini — supaya shadow tidak terpotong */
    /*margin-left: 10px;*/
    /* Shadow agar popup terlihat di atas content, pakai token Fluent */
    box-shadow: var(--elevation-shadow-flyout);
    /* Fallback manual kalau token belum terdefinisi oleh FluentDesignTheme */
    /*filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.14)) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.08));*/
}

    fluent-anchored-region > div {
        border-radius: calc(var(--control-corner-radius) * 1px);
        overflow: hidden;
        box-shadow: var(--elevation-shadow-flyout);
        margin: 0px !important;
        padding: 4px;
    }

fluent-option {
    border: none !important;
}

.fluent-autocomplete-multiselect {
    --neutral-fill-div-hover: transparent;
}


/* Popover items */
.spop-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.spop-info {
    flex: 1;
    min-width: 0;
    line-height: normal;
}

.spop-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--neutral-foreground-rest);
}

.spop-email {
    display: block;
    font-size: 13px;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spop-biz {
    display: block;
    font-size: 13px;
    color: var(--neutral-foreground-rest);
    margin-top: 2px;
}

.spop-item {
    width: 100% !important;
    margin-bottom: 6px;
}

    .spop-item::part(control) {
        justify-content: flex-start !important;
        width: 100% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        min-height: 34px !important;
    }

.spop-danger::part(control) {
    color: var(--error-foreground, #d13438) !important;
}

.spop-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 8px;
}

.spop-color {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: transform 0.1s;
    flex-shrink: 0;
}

.spop-color:hover { transform: scale(1.15); }

.spop-color-active {
    outline: 2.5px solid var(--neutral-foreground-rest);
    outline-offset: 2px;
}

.spop-color-picker {
    background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
    overflow: hidden;
}

.spop-color-picker input[type="color"] {
    opacity: 0;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
    padding: 0;
}

/*========================================*/
.fo-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-foreground-hint);
    margin-bottom: 4px;
}

/* ============================================================
   ELEVATION FIX — popup, dialog, tooltip
   Menggunakan token --elevation-shadow-* bawaan Fluent UI.
   Token ini sudah di-set dengan benar oleh FluentDesignTheme
   untuk light maupun dark mode, tanpa perlu override warna.
   ============================================================ */

/* Dialog */
fluent-dialog::part(control) {
    box-shadow: var(--elevation-shadow-dialog) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: 90vh !important;
    overflow: visible !important;
    /* Let the dialog grid shrink on narrow screens instead of overflowing horizontally.
       FluentUI lays the dialog out with grid-template-columns:1fr (= minmax(auto,1fr)),
       whose `auto` minimum pins the column to its content's min-content width. Switching to
       minmax(0,1fr) frees content (and any intrinsic min-width inside) to shrink to the box. */
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
}

/* Header/body/footer are grid areas — allow them to shrink below content min-content too */
fluent-dialog .fluent-dialog-header,
fluent-dialog .fluent-dialog-body,
fluent-dialog .fluent-dialog-footer { min-width: 0; }

/* Dialog body scroll — tambahkan class ini ke wrapper konten panjang di dalam dialog */
.dialog-scrollable-body {
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* Custom-field help text rendered under the input — small and muted so it reads as a hint,
   not a second label. Used by CustomFieldsInline / CustomFieldsSection. */
.field-description {
    display: block;
    font-size: 12px; /* px (not rem) — root is ~14px, so rem rendered too small; 12px is readable and below the 14px label */
    line-height: 1.4;
    color: var(--neutral-foreground-hint);
    margin-top: 3px;
}

/* Dim input labels slightly so the entered value is the focal point. FluentUI's
   .fluent-input-label uses full-strength --neutral-foreground-rest, so override with !important. */
.fluent-input-label {
    color: color-mix(in srgb, var(--neutral-foreground-rest) 70%, transparent) !important;
}

/* Centered dialogs: instead of capping the box at 90vh (which made tall content spill out and
   push the footer off-screen), let the dialog grow to its content and scroll the WHOLE dialog
   within the viewport via the positioning-region. The footer is always reachable, and in-dialog
   dropdowns (FluentSelect/Autocomplete) are never clipped because the body keeps overflow:visible.
   `safe center` keeps short dialogs vertically centered but pins tall ones to the top so their
   header can't be scrolled out of reach. (Left/right drawer dialogs are excluded — they own their
   own full-height layout.) */
fluent-dialog:not([class~="right"]):not([class~="left"])::part(positioning-region) {
    overflow: auto;
    padding: 24px 16px;
    box-sizing: border-box;
    align-items: center;
    align-items: safe center;
}
fluent-dialog:not([class~="right"]):not([class~="left"])::part(control) {
    height: auto !important;        /* grow to content instead of the fixed --dialog-height (480px) */
    max-height: none !important;    /* the positioning-region handles overflow via scroll */
    margin: 0 auto !important;      /* horizontal center only; vertical handled by align-items */
}

/* Batasi tinggi dropdown FluentSelect — tampilkan 6-8 item, sisanya scroll */
fluent-select::part(listbox) {
    max-height: 224px;
    overflow-y: auto;
    padding: calc((var(--design-unit) - var(--stroke-width)) * 2px);
}

/* Browser autofill — override warna kuning/biru bawaan browser.
   Input Fluent UI ada di shadow DOM, jadi harus pakai ::part(control). */
fluent-text-field::part(control):-webkit-autofill,
fluent-text-field::part(control):-webkit-autofill:hover,
fluent-text-field::part(control):-webkit-autofill:focus,
fluent-text-field::part(control):-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--neutral-fill-input-rest) inset !important;
    -webkit-text-fill-color: var(--neutral-foreground-rest) !important;
    caret-color: var(--neutral-foreground-rest);
    transition: background-color 9999s ease-in-out 0s;
}

/* Popover (FluentPopover, FluentProfileMenu, dsb) */
fluent-popover::part(popup) {
    box-shadow: var(--elevation-shadow-flyout) !important;
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest) !important;
}

/* Tooltip */
fluent-tooltip::part(tooltip) {
    box-shadow: var(--elevation-shadow-tooltip) !important;
}



fluent-number-field::part(control) {
    text-align: end; /* angka jadi rata kanan */
}

.tx-lines-wrap {
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-stroke-rest) transparent;
    scroll-behavior: smooth;
}

.tx-lines-wrap::-webkit-scrollbar { width: 4px; }
.tx-lines-wrap::-webkit-scrollbar-thumb { background: var(--neutral-stroke-rest); border-radius: 999px; }

/* ── Form line table column widths (used with dt-line) ───── */
.col-drag {
    width: 20px;
    padding: 0 4px !important;
    cursor: grab;
}

.drag-handle {
    display: inline-block;
    font-size: 1rem;
    color: var(--neutral-foreground-hint);
    cursor: grab;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 120ms ease;
    -webkit-user-select: none;
    user-select: none;
}

.dt-line-row:hover .drag-handle {
    opacity: 1;
}

.dt-line-row.drag-over {
    outline: 2px solid var(--accent-fill-rest);
    outline-offset: -2px;
    background: var(--accent-fill-rest);
    opacity: 0.08;
}

.col-num {
    width: 28px;
    color: var(--neutral-foreground-hint);
    font-size: 0.75rem;
}

.col-code {
    width: 72px;
}

.col-unit {
    width: 56px;
}

.col-item {
    min-width: 200px;
}

.col-loc {
    min-width: 90px;
}

.col-num-r {
    min-width: 80px;
    text-align: end;
}

.col-tax {
    min-width: 110px;
}

.col-wht {
    min-width: 110px;
    color: var(--neutral-foreground-hint);
}

.col-total {
    min-width: 90px;
    text-align: end;
}

/* ──────────────────────────────────────────────────────────
   PDF VIEWER - Zoom stepper (− 100% +)
   ────────────────────────────────────────────────────────── */
.pdf-zoom-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 4px;
    overflow: hidden;
}
.pdf-zoom-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 26px;
    height: 26px;
    font-size: 16px;
    line-height: 1;
    color: var(--neutral-foreground-rest, #1a1a28);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    flex-shrink: 0;
}
.pdf-zoom-btn:hover {
    background: var(--neutral-fill-stealth-hover, #e8e8e8);
}
.pdf-zoom-val {
    font-size: 12px;
    color: var(--neutral-foreground-rest, #1a1a28);
    min-width: 38px;
    text-align: center;
    padding: 0 4px;
    border-left: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-right: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    pointer-events: none;
}

.col-actions {
    width: 100px;
    white-space: nowrap;
}


.col-title-text {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 500;
    /*font-size: var(--type-ramp-minus-1-font-size) !important;*/
    color: var(--neutral-foreground-hint);
}


/* Danger item in FluentMenu */
.menu-item-danger::part(content) {
    color: var(--colorPaletteRedForeground1);
}


/* ── Sticky save footer ─────────────────────────────────────── */
.save-footer {
    position: sticky;
    bottom: 0;
    /* Above in-content stickies (max z 10) but below the mobile
       sidebar (50) and its overlay (49) */
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 8px;
    background: var(--neutral-layer-floating);
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: var(--layer-corner-radius-large, 6px);
    box-shadow: 0 -4px 8px rgba(0,0,0,.08);
}

.save-footer-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    min-width: 0;
    flex: 1;
}

.save-footer-divider {
    color: var(--neutral-foreground-hint);
}

.save-footer-total {
    text-align: end;
    font-size: 1.25rem;
    color: var(--accent-fill-rest);
}

@media (max-width: 479px) {
    .save-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

        .save-footer > div:last-child {
            display: flex;
            gap: 8px;
        }

            .save-footer > div:last-child fluent-button {
                flex: 1;
            }
}

/* ── Receipt Note — progress row (mobile card) ──────────── */
.rn-progress-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 8px;
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--neutral-fill-stealth-rest);
    border-radius: var(--corner-radius-medium, 4px);
    border: 1px solid var(--neutral-stroke-rest);
    font-size: 0.875rem;
}

.rn-progress-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .rn-progress-cell .lc-label {
        font-size: 0.75rem;
    }

/* ── Payment / Receipt — grand total + summary strip ────── */

/* Grand total */
.pv-grand-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 2px solid var(--neutral-stroke-rest);
    font-size: 1rem;
}

/* Summary strip */
.pv-summary-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.pv-summary-amount {
    margin-inline-start: auto;
    font-weight: 700;
    font-size: 1rem;
    text-align: end;
}

/* ── Journal Entry — totals row ──────────────────────────── */
.je-totals-row {
    display: flex;
    justify-content: flex-end;
    gap: 32px;
    padding: 10px 0 0;
    margin-top: 4px;
    border-top: 2px solid var(--neutral-stroke-rest);
    font-size: 0.875rem;
    font-weight: 700;
}

.je-total-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

/* ── Journal Entry — balance indicator strip ─────────────── */
.je-balance-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--layer-corner-radius, 8px);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.je-balanced {
    background: color-mix(in srgb, var(--colorPaletteGreenBackground2, #dff6dd) 30%, transparent);
    border-color: var(--colorPaletteGreenBorder2, #107c10);
    color: var(--colorPaletteGreenForeground1, #107c10);
}

.je-unbalanced {
    background: color-mix(in srgb, var(--colorPaletteYellowBackground2, #fff4ce) 30%, transparent);
    border-color: var(--colorPaletteYellowBorder2, #c57a00);
    color: var(--colorPaletteYellowForeground1, #c57a00);
}

/* ── Dialog footer — separator + full-width equal buttons ── */
.dialog-footer {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    margin-top: 20px;
    border-top: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

    .dialog-footer > * {
        flex: 1;
    }

/* ── List filters bar ──────────────────────────────────── */
.list-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
    gap: 8px;
    margin-bottom: 4px;
}

.filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

    .filter-actions fluent-button[appearance="stealth"] {
        border: 1px solid var(--neutral-stroke-rest);
        border-radius: calc(var(--control-corner-radius) * 1px);
    }

/* ── Transaction list — native table ────────────────────── */
.list-table-wrap {
    overflow-x: auto;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .list-table thead tr {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--neutral-foreground-hint);
        border-bottom: 2px solid var(--neutral-stroke-rest);
    }

    .list-table th,
    .list-table td {
        padding: 8px 10px;
        vertical-align: middle;
    }

    .list-table tbody tr {
        border-bottom: 1px solid var(--neutral-stroke-rest);
    }

        .list-table tbody tr:last-child {
            border-bottom: none;
        }

        .list-table tbody tr:hover {
            background: var(--neutral-fill-stealth-hover);
        }

/* ── Master data list — desktop table / mobile card ─────── */
.md-list-table {
    display: block;
    overflow-x: auto;
}

/* Match dt-* font sizes: 13px cells, 11px uppercase headers */
.md-list-table fluent-data-grid-cell {
    font-size: 14px;
}

.md-list-table fluent-data-grid-cell[role="columnheader"] {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    color: var(--neutral-foreground-hint);
}

.md-list-cards {
    display: none;
}

@media (max-width: 959px) {
    .md-list-table {
        display: none;
    }

    .md-list-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-top: 4px;
    }
}

.md-list-card {
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
    padding: 14px 16px;
}

/* ----------------------------------------------------------
   REPORT HUB PAGE  (.rpt-hub-*)
   ---------------------------------------------------------- */
.rpt-hub-group .fluent-card-header {
    gap: 8px;
    justify-content: flex-start;
}

.rpt-hub-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rpt-hub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    transition: background 0.12s ease;
}

.rpt-hub-item:last-child {
    border-bottom: none;
}

.rpt-hub-item:hover {
    background: var(--neutral-fill-stealth-hover);
    text-decoration: none;
}

.rpt-hub-item-icon {
    flex-shrink: 0;
    color: var(--accent-fill-rest);
    display: flex;
    align-items: center;
}

.rpt-hub-item-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.rpt-hub-item-title {
    font-size: 14px;
    /*font-weight: 500;*/
    color: var(--neutral-foreground-rest);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rpt-hub-item-desc {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rpt-hub-item-arrow {
    flex-shrink: 0;
    color: var(--neutral-foreground-hint);
    display: flex;
    align-items: center;
    opacity: 0.5;
}

/* ----------------------------------------------------------
   ADMINISTRATION HUB PAGE  (.admin-hub-*)
   ---------------------------------------------------------- */
.admin-hub-section {
    margin-bottom: 32px;
}

.admin-hub-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--neutral-foreground-rest);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

.admin-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}

.admin-hub-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 12px 16px;
    border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
    background: var(--neutral-layer-floating);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    gap: 8px;
    transition: background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.admin-hub-tile:hover {
    background: var(--neutral-fill-stealth-hover);
    border-color: var(--accent-fill-rest);
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    text-decoration: none;
}

/* Icon container — no background, colored icon */
.admin-hub-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    position: relative;
    flex-shrink: 0;
}

/* Scale SVG up from Size20 → ~32 px */
.admin-hub-tile-icon svg {
    width: 32px !important;
    height: 32px !important;
}

/* Section color variants — applied directly to the icon */
.admin-hub-tile-icon--md  { color: var(--accent-fill-rest); }
.admin-hub-tile-icon--cfg { color: #0ca678; }
.admin-hub-tile-icon--sys { color: #7c3aed; }

.admin-hub-tile-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--neutral-foreground-rest);
    line-height: 1.3;
}

.admin-hub-tile-desc {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    line-height: 1.35;
}

/* Unread badge on tile icon */
.admin-hub-tile-badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--colorPaletteRedBackground3, #c50f1f);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (max-width: 600px) {
    .admin-hub-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .admin-hub-tile {
        padding: 16px 8px 12px;
    }

    .admin-hub-tile-icon svg {
        width: 26px !important;
        height: 26px !important;
    }
}

/* Checkbox margin only inside list filters — vertically centers it against the
   adjacent filter fields. Not wanted in card titles/headers or dialogs. */
.list-filters fluent-checkbox {
    margin-bottom: 6px;
}

/* Default grid cell padding (forms / filters). */
.fluent-grid[spacing="3"] > div {
    padding: 12px !important;
}

/* Tighter vertical padding inside modal dialogs. */
fluent-dialog .fluent-grid[spacing="3"] > div {
    padding: 6px 12px !important;
}

/* ================================================================
   SLIDE-OVER DRAWER  (.drawer-overlay / .drawer-panel)
   ================================================================ */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 400;
    animation: fadeIn 180ms ease;
}

.drawer-panel {
    position: fixed;
    top: 0;
    inset-inline-end: 0;
    bottom: 0;
    width: min(860px, 100vw);
    z-index: 401;
    background: var(--neutral-layer-2);
    border-inline-start: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Drawer back bar ────────────────────────────────────────── */
.drawer-back-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: color-mix(in srgb, var(--accent-fill-rest) 8%, transparent);
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
    flex-shrink: 0;
}

.drawer-back-depth {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    background: var(--neutral-fill-secondary-rest);
    border-radius: 10px;
    padding: 1px 6px;
}

/* ================================================================
   DETAIL PANEL  (.dp-*)
   Shared by: drawer-panel (list page) + detail-standalone (URL)
   ================================================================ */

/* Sticky header */
.dp-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--neutral-stroke-rest) !important;
    background: var(--neutral-layer-2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dp-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dp-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dp-doc-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--neutral-foreground-rest);
    white-space: nowrap;
}

.dp-header-meta {
    font-size: 0.8125rem;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Scrollable body */
.dp-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-stroke-rest) transparent;
}

.dp-body::-webkit-scrollbar { width: 5px; }
.dp-body::-webkit-scrollbar-thumb { background: var(--neutral-stroke-rest); border-radius: 999px; }

/* Loading state */
.dp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
}

/* ── Standalone page wrapper (direct /sales/{id} URL) ─────── */
.detail-standalone {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.detail-standalone .dp-header {
    top: 48px; /* below app header */
    border-radius: 0;
}

.detail-standalone .dp-body {
    padding: 20px 0;
}

/* ── Active row / card highlight ────────────────────────────── */
.dt-row-active {
    background: color-mix(in srgb, var(--accent-fill-rest) 8%, transparent) !important;
    border-inline-start: 3px solid var(--accent-fill-rest);
}

.dt-card-active {
    border-inline-start: 3px solid var(--accent-fill-rest);
    background: color-mix(in srgb, var(--accent-fill-rest) 6%, transparent);
}

@media (max-width: 640px) {
    .drawer-panel {
        width: 100vw;
    }

    .dp-header-actions {
        gap: 2px;
    }

    .dp-header-actions .btn-label {
        display: none;
    }
}


/* ============================================================
   DOCUMENT PREVIEW SHELL & INVOICE ACTION BAR
   Screen styles for PDF preview pages (moved here from print.css,
   which now contains @media print rules only).
   ============================================================ */

/* ── Preview wrapper (screen only) ────────────────────────── */
/* overflow: auto — scrollbars appear when PDF wider/taller than viewport.
   Centering is handled by margin: 0 auto on the canvas.                  */
.doc-preview-wrap {
    padding: 24px 16px;
    min-height: 100%;
    overflow: auto;
    /* Fill remaining height when inside a fixed-height flex column */
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-stroke-rest) transparent;
}

.doc-preview-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.doc-preview-wrap::-webkit-scrollbar-thumb {
    background: var(--neutral-stroke-rest);
    border-radius: 999px;
}
.doc-preview-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-foreground-hint);
}

/* ── PDF canvas ─────────────────────────────────────────────── */
.pdf-canvas-page {
    display: block;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,.22);
}

/* ── Zoom strip ─────────────────────────────────────────────── */
.pdf-zoom-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0 12px;
    flex-shrink: 0;
}

/* ── Page stepper (◄ 1/9 ►) ────────────────────────────────── */
.pdf-page-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 4px;
    overflow: hidden;
}
.pdf-page-val {
    font-size: 12px;
    color: var(--neutral-foreground-rest, #1a1a28);
    min-width: 44px;
    text-align: center;
    padding: 0 4px;
    border-left: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-right: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    pointer-events: none;
}

/* ── PDF error bar ──────────────────────────────────────────── */
.pdf-error-bar {
    margin: 8px auto 0;
    padding: 10px 14px;
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
    border-radius: 4px;
    font-size: 13px;
    width: 210mm;
    max-width: 100%;
    box-sizing: border-box;
}

/* ── Sticky invoice action bar ──────────────────────────────── */
/* Sits above .doc-preview-wrap. Bleeds over app-content-inner's
   24px padding via negative margin so it spans full content width. */
.inv-bar {
    position: sticky;
    top: 0;
    /* Above in-content stickies (max z 10) but below the mobile
       sidebar (50), its overlay (49), and the app header (200) */
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 8px;
    background: var(--neutral-layer-2, #fff);
    border-bottom: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .08);
    min-height: 48px;
    margin: -24px -24px 0;
}

.inv-bar-identity {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    overflow: hidden;
}

.inv-bar-number {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    line-height: 1.3;
    color: var(--neutral-foreground-rest);
}

.inv-bar-meta {
    font-size: 12px;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.inv-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.inv-bar-more {
    position: relative;
}

.inv-bar-overlay {
    position: fixed;
    inset: 0;
    z-index: 49;
}

.inv-bar-dropdown {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 4px);
    background: var(--neutral-layer-floating, #fff);
    border: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
    min-width: 190px;
    z-index: 50;
    padding: 4px 0;
    white-space: nowrap;
}

.inv-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: start;
    color: var(--neutral-foreground-rest);
    transition: background 60ms ease;
}

.inv-dropdown-item:hover {
    background: var(--neutral-fill-stealth-hover, #f5f5f5);
}

.inv-dropdown-item.danger {
    color: var(--colorPaletteRedForeground1, #d13438);
}

/* Screen-only block (audit info etc.) — hidden on print */
.inv-screen-only {
    margin-top: 16px;
}

/* Space between action bar and PDF viewer */
.inv-bar + .doc-preview-wrap,
.inv-bar + [id^="pdf-viewer-"] {
    margin-top: 8px;
}

.inv-bar + .pdf-zoom-strip {
    padding-top: 16px;
}

@media (max-width: 820px) {
    .doc-preview-wrap {
        padding: 8px 0;
    }
}

@media (max-width: 640px) {
    .inv-bar-meta { display: none; }
}
