/* =====================================================================
   ERP CONNECT — HOUSE UI THEME  (erp-theme.css)
   Amrit Bottlers Pvt. Ltd. internal application look & feel.

   Extracted from the live ERP Connect portal (Content/site.css +
   Site.Master) and generalised so it drops into ANY Bootstrap 5.3 app —
   ASP.NET Web Forms, MVC / Razor, or plain HTML. It is CSS only; there
   is no backend dependency.

   LOAD ORDER (theme MUST come last so its overrides win):
       1. bootstrap.min.css            5.3.x
       2. bootstrap-icons.css          1.11.x
       3. erp-theme.css                <- this file
       ... bootstrap.bundle.min.js  before </body>
       ... erp-shell.js              before </body>

   THE ONE RULE — TWO COLOUR ROLES
       CHROME  = Coca-Cola red  -> sidebar, brand, primary CTA, active
                                   nav, login page. "The app / the action".
       CONTENT = teal + navy + slate -> everything inside a report.
                                   green = positive, red = negative,
                                   amber = warning.
       If everything is red, it is wrong.

   Version 1.0  ·  2026-08-25
   ===================================================================== */


/* =====================================================================
   1. DESIGN TOKENS
   Every colour in the app comes from here. Never introduce a raw hex
   in page CSS — add a token or reuse one.
   ===================================================================== */
:root {
    /* ---- Brand / chrome (Coca-Cola red) ------------------------------ */
    --cc-red:          #F40009;   /* primary CTA, brand dot, focus accents */
    --cc-red-dark:     #C8000A;   /* hover, sidebar top of gradient        */
    --cc-red-darker:   #8B0000;   /* active/pressed, sidebar bottom        */
    --cc-red-soft:     #FFE5E7;   /* red tint background                   */

    /* ---- App ground -------------------------------------------------- */
    --app-bg:          #F5F5F7;   /* page background (never pure white)    */
    --surface:         #FFFFFF;   /* cards, tables, top bar                */

    /* ---- Content accent (teal) --------------------------------------- */
    --accent:          #0E7490;
    --accent-700:      #0B5A71;
    --accent-tint:     #ECF7FA;

    /* ---- Dark headers / financial statements -------------------------- */
    --navy:            #0F2A52;
    --navy-2:          #173763;

    /* ---- Semantic ----------------------------------------------------- */
    --pos:             #15803D;   /* positive / inflow / profit / Excel    */
    --pos-tint:        #EEF7F0;
    --neg:             #B91C1C;   /* negative / outflow / loss             */
    --neg-tint:        #FBEEEE;
    --warn:            #B45309;   /* warning                               */
    --warn-tint:       #FEF3C7;
    --gold:            #C8961E;   /* subtotal emphasis, tooltip keywords   */
    --info:            #0EA5E9;
    --purple:          #7C3AED;   /* combined / cross-cutting views        */

    /* ---- Slate neutrals (ink -> line -> surface) ---------------------- */
    --ink:             #0F172A;
    --ink-2:           #334155;
    --ink-3:           #475569;
    --mut:             #64748B;
    --mut-2:           #94A3B8;
    --line:            #E2E8F0;
    --line-soft:       #EEF2F6;
    --line-2:          #CBD5E1;
    --bg:              #F8FAFC;
    --bg-2:            #F1F5F9;

    /* ---- Shape / elevation -------------------------------------------- */
    --radius:          14px;
    --radius-sm:       10px;
    --radius-pill:     999px;
    --shadow:          0 1px 2px rgba(15,42,82,.04), 0 8px 24px -14px rgba(15,42,82,.16);
    --shadow-h:        0 6px 18px rgba(15,42,82,.08), 0 18px 34px -16px rgba(15,42,82,.26);

    /* ---- Type --------------------------------------------------------- */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, sans-serif;
    --num:  'SFMono-Regular', ui-monospace, 'Cascadia Mono', 'Roboto Mono',
            Consolas, monospace;

    /* ---- Shell dimensions --------------------------------------------- */
    --sidebar-w:       240px;
    --sidebar-w-min:   64px;      /* collapsed (icon-only) width           */
    --topbar-h:        48px;
    --sidebar-bg:      linear-gradient(180deg, #C8000A 0%, #9B0008 60%, #7A0006 100%);

    /* ---- Bootstrap remap: primary + links become brand red ------------ */
    --bs-primary:          #F40009;
    --bs-primary-rgb:      244, 0, 9;
    --bs-link-color:       #C8000A;
    --bs-link-color-rgb:   200, 0, 10;
    --bs-link-hover-color: #8B0000;
}


/* =====================================================================
   2. BASE + DENSITY
   This app is DATA-DENSE, not spacious. Base body text is 0.9rem and
   every Bootstrap component is stepped down to match.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--app-bg);
    color: var(--ink-2);
    font-family: var(--font);
    font-size: .9rem;
}

h1 { font-size: 1.6rem; }  h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }  h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }    h6 { font-size: .9rem; }
.display-6 { font-size: 1.5rem; }

.btn     { font-size: .85rem; font-weight: 500; }
.btn-sm  { font-size: .78rem; }
.btn-lg  { font-size: .95rem; padding: .45rem .9rem; }

.form-control, .form-select       { font-size: .85rem; }
.form-control-sm, .form-select-sm { font-size: .78rem; }
.form-label                       { font-size: .85rem; margin-bottom: .25rem; }
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,116,144,.14);
}

.table { font-size: .85rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .4rem .55rem; vertical-align: middle; }

.card        { border-radius: var(--radius); }
.card-body   { padding: .85rem; }
.card-header { padding: .5rem .85rem; font-size: .9rem; }
.card.border-0 { box-shadow: var(--shadow); }

.badge  { font-size: .7rem; padding: .3em .55em; font-weight: 600; }
.alert  { padding: .5rem .75rem; font-size: .85rem; margin-bottom: .75rem; }
footer  { font-size: .78rem; }

.nav-tabs .nav-link { padding: .42rem .85rem; font-size: .8rem; }

/* Visible keyboard focus everywhere (accessibility) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* =====================================================================
   3. BUTTONS — red primary CTA, green Excel export
   ===================================================================== */
.btn-primary {
    background-color: var(--cc-red);
    border-color: var(--cc-red);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--cc-red-dark);
    border-color: var(--cc-red-dark);
    box-shadow: 0 4px 12px rgba(244,0,9,.3);
}
.btn-primary:active {
    background-color: var(--cc-red-darker) !important;
    border-color: var(--cc-red-darker) !important;
}
.btn-outline-primary { color: var(--cc-red); border-color: var(--cc-red); }
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--cc-red); border-color: var(--cc-red); color: #fff;
}
.text-danger { color: var(--cc-red) !important; }

/* Excel / export button is ALWAYS green — never red, never the primary CTA */
.btn-excel {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem 1rem;
    border: 1px solid rgba(21,128,61,.28);
    border-radius: var(--radius-sm);
    background: var(--pos-tint);
    color: var(--pos);
    font-size: .8rem; font-weight: 700;
    text-decoration: none; cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}
.btn-excel:hover {
    background: var(--pos); color: #fff; border-color: var(--pos);
    box-shadow: 0 3px 10px rgba(21,128,61,.25);
}


/* =====================================================================
   4. APP SHELL — sidebar + top bar + main
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; width: 100%; }

/* ---- Sidebar ---------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky; top: 0;
    height: 100vh; min-height: 100vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    background: var(--sidebar-bg);
    box-shadow: 4px 0 16px rgba(0,0,0,.18);
    transition: width .22s ease;
    z-index: 200;
}
.sidebar.collapsed { width: var(--sidebar-w-min); }

.sidebar-brand {
    display: flex; align-items: center; gap: .55rem;
    height: var(--topbar-h); padding: 0 1.1rem;
    flex-shrink: 0; overflow: hidden;
    color: #fff; text-decoration: none; white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,.18);
    background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,0) 100%);
}
.sidebar-brand-logo {
    width: 38px; height: 38px; flex-shrink: 0;
    object-fit: contain; background: #fff;
    border-radius: 50%; padding: 2px;
    box-shadow: 0 0 0 1px rgba(255,255,255,.15), 0 2px 6px rgba(0,0,0,.35);
    transition: transform .3s ease, box-shadow .3s ease;
}
.sidebar-brand:hover .sidebar-brand-logo { transform: rotate(360deg); }
.sidebar-brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; overflow: hidden; }
.brand-line-1 {
    font-size: .88rem; font-weight: 800; color: #fff;
    letter-spacing: .4px; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.brand-line-2 {
    margin-top: 1px;
    font-size: .58rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.2px; color: rgba(255,255,255,.78);
}

/* Sidebar search (filters menu labels live) */
.sidebar-search {
    display: flex; align-items: center; gap: .4rem;
    margin: .55rem .65rem 0; padding: .4rem .6rem;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 6px;
    transition: background .14s, border-color .14s;
}
.sidebar-search:focus-within { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.4); }
.sidebar-search i { color: rgba(255,255,255,.75); font-size: .85rem; flex-shrink: 0; }
.sidebar-search input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: 0;
    color: #fff; font-size: .74rem;
}
.sidebar-search input::placeholder { color: rgba(255,255,255,.55); }
.sidebar-search button {
    display: none; padding: 0 .2rem;
    background: transparent; border: 0; cursor: pointer;
    color: rgba(255,255,255,.7); font-size: .7rem;
}
.sidebar-search.has-text button { display: inline-block; }
.sidebar-search button:hover { color: #fff; }

.sidebar-menu {
    flex: 1 1 auto;
    overflow-y: auto; overflow-x: hidden;
    padding: .4rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) transparent;
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 4px; }
.sidebar-menu ul { list-style: none; margin: 0; padding: 0; }

/* Collapsible section */
.sidebar-section {
    margin-top: .55rem; padding-top: .25rem;
    border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-section:first-of-type { margin-top: .4rem; border-top: 0; }

.sidebar-section-header {
    display: flex; align-items: center; gap: .4rem;
    width: 100%; margin: 0; padding: .2rem .85rem .25rem;
    background: transparent; border: 0; box-shadow: none; appearance: none;
    color: rgba(255,255,255,.7);
    font-size: .54rem; font-weight: 700; letter-spacing: .16em;
    text-transform: uppercase; text-align: left; cursor: pointer;
    transition: color .14s;
}
.sidebar-section-header:hover { color: #fff; }
.sidebar-section-icon    { flex-shrink: 0; font-size: .72rem; opacity: .85; color: #fff !important; }
.sidebar-section-name    { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-section-count   {
    flex-shrink: 0; margin-left: auto; padding: 1px 6px;
    background: rgba(255,255,255,.18); color: #fff;
    border-radius: 7px; font-size: .55rem; font-weight: 700; letter-spacing: 0; line-height: 1.5;
}
.sidebar-section-chevron { flex-shrink: 0; margin-left: .2rem; font-size: .55rem; color: rgba(255,255,255,.65); transition: transform .18s; }
.sidebar-section.collapsed .sidebar-section-chevron { transform: rotate(-90deg); }

.sidebar-section-items {
    margin: 0 0 0 .85rem; padding: .1rem 0 .2rem;
    max-height: 1000px; overflow: hidden;
    border-left: 2px solid rgba(255,255,255,.15);
    transition: max-height .25s ease;
}
.sidebar-section.collapsed .sidebar-section-items { max-height: 0; padding: 0; }

/* Menu item */
.sidebar-link {
    display: flex; align-items: center; gap: .5rem;
    padding: .38rem .95rem;
    border-left: 3px solid transparent;
    color: rgba(255,255,255,.9); text-decoration: none;
    font-size: .75rem; white-space: nowrap;
    transition: background .14s, color .14s;
}
.sidebar-link i { flex-shrink: 0; width: 1.05rem; font-size: .9rem; text-align: center; opacity: .85; }
.sidebar-link:hover { background: rgba(255,255,255,.13); color: #fff; }
.sidebar-link:hover i { opacity: 1; }
/* Active = WHITE pill with dark-red text (high contrast on the red rail) */
.sidebar-link.active {
    background: #fff; color: var(--cc-red-darker);
    border-left-color: #fff; font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar-link.active i { color: var(--cc-red); opacity: 1; }

.sidebar-section-items .sidebar-link { padding: .32rem .6rem; font-size: .74rem; line-height: 1.25; gap: .45rem; }
.sidebar-section-items .sidebar-link i { width: .95rem; font-size: .82rem; }

/* Standalone item (e.g. Dashboard) sits above the sections */
.sidebar-menu > ul > li:not(.sidebar-section) > .sidebar-link {
    padding: .45rem .95rem; font-size: .8rem; font-weight: 600; color: #fff;
}
.sidebar-menu > ul > li:not(.sidebar-section) > .sidebar-link i { font-size: .92rem; opacity: .92; }

/* Release badge next to a menu label: New / Change / Fix */
.sidebar-rel-badge {
    margin-left: .35rem; padding: 1px 5px;
    border-radius: 3px; vertical-align: middle;
    color: #fff; font-size: .5rem; font-weight: 800;
    letter-spacing: .02em; text-transform: uppercase;
}
.sidebar-rel-badge.rel-new    { background: #16A34A; }
.sidebar-rel-badge.rel-change { background: #2563EB; }
.sidebar-rel-badge.rel-fix    { background: #D97706; }

/* Hidden by the live search */
.sidebar-link.search-hidden,
.sidebar-section.search-hidden,
li.search-hidden { display: none !important; }

.sidebar-footer {
    display: flex; align-items: center; gap: .45rem;
    flex-shrink: 0; overflow: hidden;
    padding: .55rem .95rem;
    border-top: 1px solid rgba(255,255,255,.18);
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.22) 100%);
    color: rgba(255,255,255,.9); font-size: .7rem; font-weight: 600;
}
.sidebar-footer .sidebar-username { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .btn-outline-light {
    color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4);
}
.sidebar-footer .btn-outline-light:hover { background: #fff; color: var(--cc-red-darker); border-color: #fff; }

/* Collapsed (icon-only) state — hide every text element */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-section-name,
.sidebar.collapsed .sidebar-section-count,
.sidebar.collapsed .sidebar-section-chevron,
.sidebar.collapsed .sidebar-search input,
.sidebar.collapsed .sidebar-search button,
.sidebar.collapsed .sidebar-username { display: none; }
.sidebar.collapsed .sidebar-brand-logo    { margin: 0 auto; }
.sidebar.collapsed .sidebar-link          { padding-left: 0; justify-content: center; }
.sidebar.collapsed .sidebar-search        { justify-content: center; padding: .35rem; }
.sidebar.collapsed .sidebar-section-header{ justify-content: center; padding-left: 0; padding-right: 0; }
/* In icon mode a collapsed section must still show its icons */
.sidebar.collapsed .sidebar-section.collapsed .sidebar-section-items { max-height: 1000px; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; }
.sidebar-overlay.show { display: block; }

/* ---- Main column ------------------------------------------------------ */
.main-content { flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.main-content > main { flex: 1; padding: 1rem; }
.main-content > footer { background: var(--surface); }
@media (min-width: 768px) { .main-content > main { padding: 1.5rem; } }

/* ---- Top bar ---------------------------------------------------------- */
.top-bar {
    display: flex; align-items: center; gap: .75rem;
    height: var(--topbar-h); padding: 0 1rem;
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid #e5e7eb;
}
.top-bar-toggle {
    padding: .2rem .4rem; line-height: 1;
    background: none; border: 0; cursor: pointer; color: #555;
}
.top-bar-toggle:hover { color: var(--cc-red); }
.top-bar-title {
    flex: 1 1 auto;
    font-size: .88rem; font-weight: 600; color: #333;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Dark version pill in the top bar */
.topbar-version-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .65rem;
    background: linear-gradient(135deg, #0F172A, #1E293B);
    border: 1px solid #334155; border-radius: var(--radius-pill);
    color: #FBBF24 !important; text-decoration: none;
    font-family: var(--num); font-size: .72rem; font-weight: 700;
    transition: all .15s;
}
.topbar-version-badge:hover {
    background: linear-gradient(135deg, var(--cc-red-dark), var(--cc-red-darker));
    border-color: var(--cc-red-dark); color: #fff !important;
    transform: translateY(-1px);
}

/* Neutral status chip in the top bar (session timer, sync state, ...) */
.topbar-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .65rem;
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--ink-3); font-family: var(--num);
    font-size: .72rem; font-weight: 700; white-space: nowrap;
    user-select: none;
}
.topbar-chip.warn  { background: var(--warn-tint); border-color: #FCD34D; color: #92400E; }
.topbar-chip.alert { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
@media (max-width: 640px) { .topbar-chip span { display: none; } }

/* ---- Mobile: sidebar slides in over the content ----------------------- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: calc(-1 * var(--sidebar-w));
        height: 100%; transition: left .25s ease;
    }
    .sidebar.mobile-open { left: 0; }
    /* On phones the collapsed (icon) mode is meaningless — always full width */
    .sidebar.collapsed { width: var(--sidebar-w); }
    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .sidebar-link span,
    .sidebar.collapsed .sidebar-section-name,
    .sidebar.collapsed .sidebar-username { display: initial; }
    .sidebar.collapsed .sidebar-link { padding-left: .95rem; justify-content: flex-start; }
}


/* =====================================================================
   5. PAGE HEADER
   ===================================================================== */
.page-head {
    position: relative;
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
    gap: .75rem; padding-bottom: 1rem; margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}
.page-head::after {
    content: ""; position: absolute; left: 0; bottom: -1px;
    width: 104px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--navy), var(--accent));
}
.page-head-title {
    display: flex; align-items: center; gap: .55rem; margin: 0;
    font-size: 1.32rem; font-weight: 800; letter-spacing: -.02em; color: var(--navy);
}
.page-head-mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-tint); color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(14,116,144,.12);
}
.page-head-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .55rem;
    margin-top: .5rem; font-size: .82rem; color: var(--mut);
}


/* =====================================================================
   6. KPI CARDS
   Tint the card with one of the modifier classes; the accent bar, icon
   and value colour all follow from it.
   ===================================================================== */
.kpi {
    position: relative; height: 100%; overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.kpi::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--kpi-accent, var(--accent)); opacity: .95;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); border-color: var(--line-2); }
.kpi .kpi-body, .kpi .card-body { padding: 1.05rem 1.1rem 1.15rem; text-align: left; }
.kpi-icon {
    width: 38px; height: 38px; margin-bottom: .7rem; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    background: var(--kpi-tint, var(--accent-tint));
    color: var(--kpi-accent, var(--accent));
    box-shadow: inset 0 0 0 1px var(--kpi-ring, rgba(14,116,144,.14));
}
.kpi-label {
    margin: 0 0 .25rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--mut);
}
.kpi-value {
    font-family: var(--num); font-size: 1.62rem; font-weight: 800;
    letter-spacing: -.03em; line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--kpi-accent, var(--navy));
}
.kpi-sub { margin-top: .4rem; font-size: .74rem; font-weight: 600; color: var(--mut); }

.kpi-teal   { --kpi-accent:#0E7490; --kpi-tint:#ECF7FA; --kpi-ring:rgba(14,116,144,.14); }
.kpi-navy   { --kpi-accent:#0F2A52; --kpi-tint:#E8EEF7; --kpi-ring:rgba(15,42,82,.14); }
.kpi-pos    { --kpi-accent:#15803D; --kpi-tint:#EEF7F0; --kpi-ring:rgba(21,128,61,.14); }
.kpi-neg    { --kpi-accent:#B91C1C; --kpi-tint:#FBEEEE; --kpi-ring:rgba(185,28,28,.14); }
.kpi-amber  { --kpi-accent:#B45309; --kpi-tint:#FEF3C7; --kpi-ring:rgba(180,83,9,.14); }
.kpi-purple { --kpi-accent:#7C3AED; --kpi-tint:#F1ECFD; --kpi-ring:rgba(124,58,237,.14); }

/* Drill-in affordance — arrow appears top-right */
.kpi.kpi-click { cursor: pointer; }
.kpi.kpi-click::after {
    content: '\F284'; font-family: 'bootstrap-icons';
    position: absolute; top: 6px; right: 8px;
    font-size: .7rem; color: var(--line-2);
}
.kpi.kpi-click:hover::after { color: var(--accent); }


/* =====================================================================
   7. FILTER CARD + MULTI-SELECT CHIPS
   Chips are OR within a dimension, AND across dimensions.
   ===================================================================== */
.filter-card {
    padding: 1rem 1.1rem; margin-bottom: .9rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .85rem; }
.field-label {
    display: block; margin-bottom: .3rem;
    font-size: .66rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--mut);
}

.chip-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    height: 30px; padding: 0 .7rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--ink-3); font-size: .75rem; font-weight: 700;
    cursor: pointer; transition: all .14s;
}
.chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-700); }
.chip.active {
    background: var(--chip-color, var(--accent));
    border-color: var(--chip-color, var(--accent));
    color: #fff;
}
.chip .cnt { font-size: .66rem; opacity: .85; }


/* =====================================================================
   8. REPORT TABLE  (.reg-table) — compact, sticky navy header,
   tabular numbers, subtotal + grand-total rows.
   ===================================================================== */
.reg-wrap {
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.reg-scroll { max-height: 70vh; overflow: auto; }

.reg-table {
    width: 100%; margin: 0;
    border-collapse: separate; border-spacing: 0;
    background: var(--surface);
    font-size: .78rem; color: var(--ink-2);
}
.reg-table thead th {
    position: sticky; top: 0; z-index: 5;
    padding: .7rem 1rem; text-align: left; white-space: nowrap;
    background: linear-gradient(180deg, var(--navy), var(--navy-2));
    color: #E5EDF7;
    font-size: .66rem; font-weight: 700; letter-spacing: .085em; text-transform: uppercase;
    border-bottom: 2px solid var(--accent);
}
.reg-table tbody td {
    padding: .5rem 1rem; vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
}
.reg-table tbody tr:hover td { background: var(--bg); }

/* Numbers: right-aligned, tabular, monospace */
.reg-table td.num, .reg-table th.num {
    text-align: right; white-space: nowrap;
    font-family: var(--num); font-variant-numeric: tabular-nums;
}
.num-pos { color: var(--pos); }
.num-neg { color: var(--neg); }

/* Group band header (e.g. one production line, one zone) */
.reg-band td {
    background: var(--accent-tint);
    border-left: 3px solid var(--accent);
    font-weight: 700; color: var(--navy);
}
/* Subtotal + grand total */
.reg-subtotal td {
    background: var(--bg-2); color: var(--navy);
    font-weight: 800; border-top: 1.5px solid var(--gold);
}
.reg-grand td { padding: .9rem 1rem; border: none; color: #fff; font-weight: 800; }
.reg-grand.pos td { background: linear-gradient(90deg, var(--navy) 0%, #0E5A55 62%, var(--accent) 100%); }
.reg-grand.neg td { background: linear-gradient(90deg, var(--navy) 0%, #7A1B2A 68%, var(--neg) 100%); }

/* Small count chip inside a cell */
.count-chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.4rem; height: 1.4rem; padding: 0 .4rem; margin-left: .5rem;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-pill);
    color: var(--ink-3); font-size: .66rem; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
/* Monospace code chip for item / document numbers */
.code-chip {
    font-family: var(--num); font-size: .7rem; font-weight: 700;
    color: var(--accent);
}

/* Bootstrap .table fallback for pages that use plain tables */
.table.table-sm > :not(caption) > * > * { padding: .35rem .55rem; font-size: .78rem; line-height: 1.32; }
.table.table-sm thead > tr > th {
    padding: .42rem .55rem; font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.table.table-sm td.text-end, .table.table-sm th.text-end { font-variant-numeric: tabular-nums; }
.table.table-sm tbody tr:hover { background-color: rgba(244,0,9,.04) !important; }


/* =====================================================================
   9. STATUS PILLS
   ===================================================================== */
.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .12rem .55rem; border-radius: var(--radius-pill);
    font-size: .66rem; font-weight: 700; line-height: 1.4;
}
.pill-good { background: var(--pos-tint);   color: var(--pos); }
.pill-warn { background: var(--warn-tint);  color: #92400E; }
.pill-bad  { background: var(--neg-tint);   color: var(--neg); }
.pill-info { background: var(--accent-tint);color: var(--accent-700); }
.pill-mut  { background: var(--bg-2);       color: var(--mut); }


/* =====================================================================
   10. DATA BANNER + EMPTY STATE
   Banner = dynamic data-state note (freshness, caps, warnings).
   HOUSE RULE: no always-visible explainer prose on a page — guidance
   belongs in tooltips, modals, collapsed panels or the Excel Info sheet.
   ===================================================================== */
.data-banner {
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .62rem .85rem; margin-bottom: 1.1rem;
    background: linear-gradient(90deg, rgba(14,116,144,.06), rgba(15,42,82,.03));
    border: 1px solid var(--line); border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: .8rem; line-height: 1.5; color: var(--ink-3);
}
.data-banner i { flex: 0 0 auto; margin-top: .06rem; color: var(--accent); }
.data-banner b { color: var(--ink-2); }
.data-banner.warn { border-left-color: var(--warn); background: linear-gradient(90deg, rgba(180,83,9,.07), rgba(180,83,9,.02)); }
.data-banner.warn i { color: var(--warn); }

.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--mut); }
.empty-state i { display: block; margin-bottom: .5rem; font-size: 2rem; color: var(--line-2); }
.empty-state .t { font-weight: 600; color: var(--ink-3); }


/* =====================================================================
   11. TOOLTIPS — dark card, gold formula text
   Format: Title -> Formula -> Source -> Meaning.
   ===================================================================== */
/* NOTE: Bootstrap MOVES the title attribute to data-bs-original-title when it
   initialises a tooltip, so every selector below must match BOTH — otherwise
   the "this is hoverable" hint silently disappears once the page boots. */
th[title], th[data-bs-original-title],
.tip[title], .tip[data-bs-original-title],
[data-bs-toggle="tooltip"] { cursor: help; }

th[title]:not(.tooltip-skipped),
th[data-bs-original-title]:not(.tooltip-skipped) {
    text-decoration: underline dotted rgba(255,255,255,.35);
    text-underline-offset: 2px;
}
/* Light-header tables need a darker dotted line to stay visible */
.table-light th[title], thead.table-light th[title],
.table-light th[data-bs-original-title], thead.table-light th[data-bs-original-title] {
    text-decoration-color: rgba(0,0,0,.25);
}
.tip[title], .tip[data-bs-original-title] { border-bottom: 1px dotted var(--mut-2); }

.tooltip {
    --bs-tooltip-bg: #0F172A;
    --bs-tooltip-color: #F1F5F9;
    --bs-tooltip-max-width: 340px;
    font-size: .8rem;
}
.tooltip-inner {
    padding: .55rem .75rem; border-radius: .4rem;
    text-align: left; line-height: 1.4;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
.tooltip-inner code, .tooltip-inner strong { color: #FCD34D; font-weight: 700; }


/* =====================================================================
   12. LOGIN / OTP PAGES (standalone, no shell)
   ===================================================================== */
.login-bg {
    min-height: 100vh; position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--cc-red) 0%, var(--cc-red-darker) 100%);
}
.login-bg::before, .login-bg::after {
    content: ""; position: absolute; border-radius: 50%;
    background: rgba(255,255,255,.06); pointer-events: none;
}
.login-bg::before { width: 600px; height: 600px; top: -200px; right: -150px; }
.login-bg::after  { width: 400px; height: 400px; bottom: -150px; left: -100px; }
.login-card { width: 100%; max-width: 420px; padding: 1rem; position: relative; z-index: 1; }
.login-card .card { border-top: 4px solid var(--cc-red) !important; }

.otp-input {
    padding: .6rem; text-align: center;
    border: 2px solid #dee2e6; border-radius: .5rem;
    font-size: 2rem; font-weight: 700; letter-spacing: .6rem;
}
.otp-input:focus { border-color: var(--cc-red); box-shadow: 0 0 0 .2rem rgba(244,0,9,.2); }


/* =====================================================================
   13. PRINT — drop the chrome, keep the report
   ===================================================================== */
@media print {
    .sidebar, .top-bar, .sidebar-overlay, .filter-card, .btn, .btn-excel { display: none !important; }
    .main-content > main { padding: 0; }
    .reg-wrap { border: 0; box-shadow: none; }
    .reg-scroll { max-height: none; overflow: visible; }
    body { background: #fff; }
}
