/* ============================================================
   ERP Connect — Coca-Cola FZD theme
   Primary: #F40009
   ============================================================ */

:root {
    --cc-red:        #F40009;
    --cc-red-dark:   #C8000A;
    --cc-red-darker: #8B0000;
    --cc-red-soft:   #FFE5E7;
    --cc-cream:      #F5F5F7;

    --bs-primary:        #F40009;
    --bs-primary-rgb:    244, 0, 9;
    --bs-link-color:     #F40009;
    --bs-link-color-rgb: 244, 0, 9;
    --bs-link-hover-color: #8B0000;

    --sidebar-width:    240px;
    --sidebar-bg:       linear-gradient(180deg, #C8000A 0%, #8B0000 100%);
    --topbar-h:         48px;

    /* App font = "Bahnschrift SemiLight Condensed" (owner). Browsers do not match that
       instance name - Bahnschrift is ONE variable font - so it is picked as family
       Bahnschrift + width 75% (condensed) + weight 350 (SemiLight). Bold text keeps 700.
       Bahnschrift ships with Windows 10/11; other devices fall back to Segoe UI / system. */
    --app-font: Bahnschrift, 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --bs-font-sans-serif: var(--app-font);
    --bs-body-font-family: var(--app-font);
    --bs-body-font-weight: 350;
}

/* ── Reset / body ── */
*, *::before, *::after { box-sizing: border-box; }
body {
    background: var(--cc-cream);
    font-family: var(--app-font);
    font-stretch: 75%;
    font-weight: 350;
    font-size: 0.9rem;
    margin: 0;
}
/* form controls don't inherit font-stretch from the page by default */
button, input, select, textarea, optgroup, .form-control, .form-select, .btn { font-family: inherit; font-stretch: inherit; }
body > form { display: flex; min-height: 100vh; }

/* ── Typography scale ── */
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: 0.9rem; }
.display-6 { font-size: 1.5rem; }

/* ── Compact components ── */
.btn     { font-size: 0.85rem; }
.btn-sm  { font-size: 0.78rem; }
.btn-lg  { font-size: 0.95rem; padding: 0.45rem 0.9rem; }

.form-control, .form-select { font-size: 0.85rem; }
.form-label  { font-size: 0.85rem; margin-bottom: 0.25rem; }
.form-control-sm, .form-select-sm { font-size: 0.78rem; }

.table { font-size: 0.85rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.4rem 0.55rem; vertical-align: middle; }

.card-body   { padding: 0.85rem; }
.card-header { padding: 0.5rem 0.85rem; font-size: 0.9rem; }
.card        { border-radius: 0.6rem; }
.card.border-0 { box-shadow: 0 1px 6px rgba(0,0,0,0.08); }

.badge { font-size: 0.7rem; padding: 0.3em 0.55em; font-weight: 500; }
.alert { padding: 0.5rem 0.75rem; font-size: 0.85rem; margin-bottom: 0.75rem; }
footer { font-size: 0.78rem; }

/* ── Primary (red) overrides ── */
.btn-primary {
    background-color: var(--cc-red); border-color: var(--cc-red); font-weight: 500;
}
.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,0.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; }

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

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    /* Coca-Cola red gradient — vibrant top → deeper red bottom */
    background: linear-gradient(180deg, #C8000A 0%, #9B0008 60%, #7A0006 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 0.22s ease;
    z-index: 200;
    box-shadow: 4px 0 16px rgba(0,0,0,.18);
}
.sidebar.collapsed { width: 64px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 1.1rem;
    height: var(--topbar-h);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
    /* Slight darker top stripe — like a brand band */
    background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,0) 100%);
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-brand i { color: var(--cc-red); font-size: 1.35rem; flex-shrink: 0; }

/* ── Amrit Bottlers Logo + Cleaner ERP Connect ───────────────── */
.sidebar-brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 2px 6px rgba(0,0,0,0.35);
    animation: logo-spin-in 1s cubic-bezier(.34,1.56,.64,1) 1;
    transition: transform .3s ease, box-shadow .3s ease;
}
.sidebar-brand:hover .sidebar-brand-logo {
    transform: rotate(360deg);
    box-shadow: 0 0 0 2px rgba(244,0,9,0.4), 0 2px 10px rgba(244,0,9,0.5);
}
@keyframes logo-spin-in {
    0%   { transform: rotate(-180deg) scale(0); opacity: 0; }
    60%  { transform: rotate(15deg) scale(1.1); opacity: 1; }
    100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
    font-style: normal;
    overflow: hidden;
    animation: brand-slide-in 0.6s ease-out 0.3s both;
}
@keyframes brand-slide-in {
    0%   { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}
.brand-line-1 {
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.brand-line-2 {
    font-size: 0.58rem;
    font-weight: 700;
    color: rgba(255,255,255,0.78);    /* readable on red Coke sidebar */
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
    margin-top: 1px;
}

/* Subtle pulsing red dot at end of first line */
.brand-line-1::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #F40009;
    margin-left: 4px;
    vertical-align: middle;
    animation: dot-pulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(244,0,9,0.8);
}
@keyframes dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.4); opacity: 0.5; }
}

/* Collapsed sidebar */
.sidebar.collapsed .sidebar-brand-logo { margin: 0 auto; }
.sidebar.collapsed .sidebar-brand-text { display: none; }

.sidebar-menu {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.4rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }

.sidebar-section-label {
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.3);
    padding: .7rem .95rem .25rem;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Sidebar SEARCH bar (top of sidebar) ─────────────────────── */
/* Coke-theme: subtle white-tinted box on red bg, higher visibility on focus. */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .55rem .65rem 0;
    padding: .4rem .6rem;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    transition: background .14s, border-color .14s;
}
.sidebar-search:focus-within {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
}
.sidebar-search i { color: rgba(255,255,255,0.75); font-size: .85rem; flex-shrink: 0; }
.sidebar-search input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #fff;
    font-size: .74rem;
    min-width: 0;
}
.sidebar-search input::placeholder { color: rgba(255,255,255,0.55); }
.sidebar-search button {
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.7);
    padding: 0 .2rem;
    cursor: pointer;
    font-size: .7rem;
    display: none;
}
.sidebar-search button:hover { color: #fff; }
.sidebar-search.has-text button { display: inline-block; }

/* ── Collapsible SECTIONS — visually distinct from menu items ─── */
/* On red sidebar, sections are muted-white labels, menu items full white. */
.sidebar-section {
    margin-top: .55rem;
    padding-top: .25rem;
    border-top: 1px solid rgba(255,255,255,0.12);   /* visible divider on red */
}
.sidebar-section:first-of-type {
    margin-top: .4rem;
    border-top: 0;
}

/* Section HEADER — label-like, not a button */
.sidebar-section-header {
    display: flex !important;
    align-items: center;
    gap: .4rem;
    width: 100%;
    padding: .2rem .85rem .25rem !important;
    margin: 0;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    color: rgba(255,255,255,0.7) !important;
    font-size: 0.54rem !important;
    font-weight: 700;
    letter-spacing: 0.16em !important;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: color .14s;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
.sidebar-section-header:hover {
    background: transparent !important;
    color: #fff !important;
}
.sidebar-section-icon {
    font-size: .72rem;
    flex-shrink: 0;
    opacity: .85;
    color: #fff !important;          /* override category-tint on red — single colour family */
}
.sidebar-section-name {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-section-count {
    flex-shrink: 0;
    margin-left: auto;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: .55rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 7px;
    line-height: 1.5;
    letter-spacing: 0;
}
.sidebar-section-chevron {
    font-size: .55rem;
    color: rgba(255,255,255,0.65);
    transition: transform .18s;
    flex-shrink: 0;
    margin-left: .2rem;
}
.sidebar-section.collapsed .sidebar-section-chevron { transform: rotate(-90deg); }

/* Section-items container — nested menu list with subtle left rail */
.sidebar-section-items {
    list-style: none;
    margin: 0;
    padding: .1rem 0 .2rem;
    overflow: hidden;
    max-height: 1000px;
    transition: max-height .25s ease;
    border-left: 2px solid rgba(255,255,255,0.15);   /* visible rail on red */
    margin-left: .85rem;   /* nest under the section label */
}
.sidebar-section.collapsed .sidebar-section-items {
    max-height: 0;
    padding: 0;
}

/* MENU ITEM inside a section — bright white on red, white pill when active */
.sidebar-section-items .sidebar-link {
    padding: .32rem .6rem .32rem .6rem !important;
    font-size: 0.74rem !important;
    color: rgba(255,255,255,0.9) !important;
    gap: .45rem;
    border-left-color: transparent !important;
    line-height: 1.25;
}
.sidebar-section-items .sidebar-link i {
    color: rgba(255,255,255,0.78) !important;
    font-size: .82rem;
    width: .95rem;
}
.sidebar-section-items .sidebar-link:hover {
    background: rgba(255,255,255,0.13) !important;
    color: #fff !important;
}
.sidebar-section-items .sidebar-link:hover i {
    color: #fff !important;
}
/* Active item on red — WHITE pill with dark-red text (high contrast pop) */
.sidebar-section-items .sidebar-link.active {
    background: #fff !important;
    color: var(--cc-red-darker) !important;
    border-left-color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar-section-items .sidebar-link.active i {
    color: var(--cc-red) !important;
}


/* STANDALONE items (Dashboard at top) — bright white, full-row */
.sidebar-menu > .nav > .nav-item:not(.sidebar-section) > .sidebar-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    padding: .45rem .95rem;
    border-left-color: transparent !important;
}
.sidebar-menu > .nav > .nav-item:not(.sidebar-section) > .sidebar-link i {
    font-size: .92rem;
    color: #fff;
    opacity: .92;
}
.sidebar-menu > .nav > .nav-item:not(.sidebar-section) > .sidebar-link:hover {
    background: rgba(255,255,255,0.13) !important;
}
.sidebar-menu > .nav > .nav-item:not(.sidebar-section) > .sidebar-link.active {
    background: #fff !important;
    color: var(--cc-red-darker) !important;
    border-left-color: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar-menu > .nav > .nav-item:not(.sidebar-section) > .sidebar-link.active i {
    color: var(--cc-red) !important;
    opacity: 1;
}

/* Release badge (New / Change / Fix) next to a menu label — shown to each
   user for only 2 days from their first sighting (see Site.Master
   ComputeBadges + WEB_MenuBadgeSeen). New = green, Change = blue, Fix = amber. */
.sidebar-rel-badge {
    color: #fff;
    font-size: .5rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: .35rem;
    vertical-align: middle;
}
.sidebar-rel-badge.rel-new    { background: #16A34A; }  /* green — brand-new page */
.sidebar-rel-badge.rel-change { background: #2563EB; }  /* blue  — reworked page  */
.sidebar-rel-badge.rel-fix    { background: #D97706; }  /* amber — bug fix        */

/* Search-hidden state (set by JS when item label doesn't match query) */
.sidebar-link.search-hidden,
.sidebar-section.search-hidden,
li.search-hidden { display: none !important; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.38rem 0.95rem;
    color: rgba(255,255,255,0.62);
    text-decoration: none;
    font-size: 0.75rem;
    white-space: nowrap;
    transition: background 0.14s, color 0.14s;
    border-left: 3px solid transparent;
}
.sidebar-link i {
    font-size: .9rem;
    flex-shrink: 0;
    width: 1.05rem;
    text-align: center;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-link.active {
    background: rgba(244,0,9,0.14);
    color: var(--cc-red);
    border-left-color: var(--cc-red);
    font-weight: 500;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.95rem;
    border-top: 1px solid rgba(255,255,255,0.18);
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.22) 100%);
    color: rgba(255,255,255,0.9);
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-footer i { color: rgba(255,255,255,0.85); }
.sidebar-footer .btn-outline-light {
    color: #fff;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.08);
}
.sidebar-footer .btn-outline-light:hover {
    background: #fff;
    color: var(--cc-red-darker);
    border-color: #fff;
}
.sidebar-footer i { flex-shrink: 0; }
.sidebar-username {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* collapsed — hide text elements */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-section-label,
.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-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; }
.sidebar.collapsed .sidebar-section.collapsed .sidebar-section-items { max-height: 1000px; } /* never hide in icon mode */
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 0.6rem; }

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

/* ── Main content ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ── Top bar ── */
.top-bar {
    display: flex;
    align-items: center;
    height: var(--topbar-h);
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0.75rem;
}
.top-bar-toggle { color: #555; line-height: 1; padding: 0.2rem 0.4rem; }
.top-bar-toggle:hover { color: var(--cc-red); }
.top-bar-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Version pill in topbar — click to open changelog */
.topbar-version-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .65rem;
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: #FBBF24 !important;
    font-family: 'Consolas','Courier New',monospace;
    font-weight: 700; font-size: .72rem;
    border-radius: 99px;
    text-decoration: none;
    border: 1px solid #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    transition: all .15s;
}
.topbar-version-badge:hover {
    background: linear-gradient(135deg, #C8000A, #8B0000);
    color: #fff !important;
    border-color: #C8000A;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(200,0,10,.3);
}
.topbar-version-badge i { font-size: .85rem; }
/* Static variant — non-admin users see badge as info-only (no hover) */
.topbar-version-badge--static {
    cursor: default !important;
    pointer-events: none;
}

/* ── Per-page render-time badge in topbar ─────────────────────
   Shows the SERVER-side render duration for the page the user
   is looking at — green = fast, red = slow. */
.topbar-page-time {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem; margin-right: .5rem;
    border-radius: 999px;
    color: #FFFFFF;
    font-size: .7rem; font-weight: 700;
    font-family: 'Consolas', 'Menlo', monospace;
    letter-spacing: .02em;
    cursor: default;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    white-space: nowrap;
}
.topbar-page-time i { font-size: .78rem; opacity: .95; }
@media (max-width: 640px) { .topbar-page-time { display: none; } }

/* ── Session-expiry chip in topbar ─────────────────────────────
   Counts down to login session timeout.  Colours escalate as
   the remaining time shrinks: neutral → amber (<30 min) → red (<5 min). */
.topbar-session-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    background: #F1F5F9;
    color: #475569;
    font-size: .72rem; font-weight: 700;
    font-family: 'Consolas', 'Menlo', monospace;
    letter-spacing: .02em;
    border: 1px solid #E2E8F0;
    cursor: default;
    user-select: none;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap;
}
.topbar-session-chip i { font-size: .8rem; opacity: .85; }
.topbar-session-chip.warn {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FCD34D;
}
.topbar-session-chip.alert {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
    animation: topbar-session-pulse 1.6s ease-in-out infinite;
}
@keyframes topbar-session-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50%      { box-shadow: 0 0 0 5px rgba(220, 38, 38, .12); }
}
.topbar-session-chip.expired {
    background: #1F2937; color: #FCA5A5; border-color: #1F2937;
}
@media (max-width: 640px) {
    /* On phones, hide the chip text — keep only the icon to save space */
    .topbar-session-chip #topbarSessionVal { display: none; }
    .topbar-session-chip i { margin: 0 !important; }
}
.topbar-version-badge--static:hover {
    background: linear-gradient(135deg, #0F172A, #1E293B) !important;
    color: #FBBF24 !important;
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.1) !important;
    border-color: #334155 !important;
}

/* main + footer */
.main-content main { flex: 1; }
.main-content footer { background: #fff; }

/* ============================================================
   LOGIN / REGISTER / VERIFY pages (standalone, no sidebar)
   ============================================================ */
.login-page-bg {
    background: linear-gradient(135deg, var(--cc-red) 0%, var(--cc-red-darker) 100%);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}
.login-page-bg::before,
.login-page-bg::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}
.login-page-bg::before { width: 600px; height: 600px; top: -200px; right: -150px; }
.login-page-bg::after  { width: 400px; height: 400px; bottom: -150px; left: -100px; }

.login-page-bg > form {
    display: flex !important;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-card {
    max-width: 420px;
    width: 100%;
    padding: 1rem;
    position: relative;
    z-index: 1;
}
.login-card .card { border-top: 4px solid var(--cc-red) !important; }

/* OTP input */
.otp-input {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.6rem;
    text-align: center;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.6rem;
}
.otp-input:focus {
    border-color: var(--cc-red);
    box-shadow: 0 0 0 0.2rem rgba(244,0,9,0.2);
}
.otp-timer { font-size: 1.2rem; font-weight: 600; color: var(--cc-red); }

/* ============================================================
   RESPONSIVE — mobile sidebar slide-in
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        height: 100%;
        transition: left 0.25s ease;
    }
    .sidebar.mobile-open { left: 0; }
    .sidebar.collapsed { width: var(--sidebar-width); }
    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .sidebar-link span,
    .sidebar.collapsed .sidebar-section-label,
    .sidebar.collapsed .sidebar-username { display: initial; }
    .sidebar.collapsed .sidebar-link { padding-left: 1.1rem; justify-content: flex-start; }
}

/* ============================================================
   COMPACT REPORT GRIDS — applies to all .table inside reports
   ============================================================ */

/* Tighter table cells across all reports */
.table.table-sm > :not(caption) > * > * {
    padding: .35rem .55rem;
    font-size: .78rem;
    line-height: 1.32;
    vertical-align: middle;
}
.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 tbody td small,
.table.table-sm tbody td .small {
    font-size: .68rem;
    line-height: 1.2;
}
.table.table-sm tbody td strong { font-weight: 600; }

/* Right-aligned numeric cells get tabular figures + monospace feel */
.table.table-sm td.text-end,
.table.table-sm th.text-end {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Row hover highlight (subtle) */
.table.table-sm tbody tr:hover { background-color: rgba(244, 0, 9, 0.04) !important; }
.table.table-sm tbody tr.table-dark:hover { background-color: #212529 !important; }

/* Striped alternating — softer than table-striped */
.table.table-sm tbody tr.table-light { background-color: #FAFBFC !important; }

/* Compact badges inside tables */
.table.table-sm .badge {
    font-size: .68rem;
    padding: .25em .5em;
    font-weight: 600;
}

/* Sticky-ish table headers (when scroll inside .table-responsive) */
.table-responsive { max-height: calc(100vh - 320px); overflow-y: auto; }
.table-responsive > .table.table-sm > thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
/* Avoid sticky white gap by ensuring header bg covers */
.table-responsive > .table.table-sm > thead > tr > th {
    background-clip: padding-box;
}

/* Smaller form controls inside report toolbars */
.form-control-sm { font-size: .78rem; }

/* ── KPI cards: trim a bit ─────────────────────────────────── */
.kpi-card .kpi-value,
.grn-kpi .grn-kpi-value,
.pr-kpi .pr-kpi-value,
.rv-kpi .rv-kpi-value,
.rc-kpi .rc-kpi-value,
.po-kpi .po-kpi-val {
    font-size: 1.5rem !important;
    font-weight: 800;
    line-height: 1.05;
}
.kpi-card .kpi-icon,
.grn-kpi .grn-kpi-icon,
.pr-kpi .pr-kpi-icon,
.rv-kpi .rv-kpi-icon,
.rc-kpi .rc-kpi-icon {
    font-size: 1.35rem !important;
    margin-bottom: .15rem !important;
}
.kpi-card .kpi-label,
.grn-kpi .grn-kpi-label,
.pr-kpi .pr-kpi-label,
.rv-kpi .rv-kpi-label,
.rc-kpi .rc-kpi-label,
.po-kpi .po-kpi-lbl {
    font-size: .6rem !important;
    margin: .15rem 0 !important;
    color: #6B7280;
}
.kpi-card .kpi-sub,
.grn-kpi .grn-kpi-sub,
.pr-kpi .pr-kpi-sub {
    font-size: .68rem !important;
    font-weight: 600;
}
.kpi-card .card-body,
.grn-kpi .card-body,
.pr-kpi .card-body,
.rv-kpi .card-body,
.rc-kpi .card-body { padding: .65rem .5rem !important; }

/* ── Tab heading sizes ─────────────────────────────────────── */
.nav-tabs .nav-link { padding: .42rem .85rem; font-size: .8rem !important; }

/* ── Tighter section card body ─────────────────────────────── */
.tab-section-card .card-body,
.grn-tab-card    .card-body,
.pr-tab-card     .card-body,
.rv-tab-card     .card-body,
.rc-tab-card     .card-body { padding: .9rem !important; }

/* ── Section-card filter row ───────────────────────────────── */
.grn-section-card .card-body,
.pr-section-card  .card-body,
.rv-section-card  .card-body,
.rc-section-card  .card-body { padding: .7rem .9rem !important; }

/* ── Search box inside tables ──────────────────────────────── */
.grn-search-box, .pr-search-box, .rv-search-box, .rc-search-box {
    height: 30px; font-size: .78rem !important;
}

/* ── Drill-link consistency ────────────────────────────────── */
.grn-drill-link, .pr-row-link, .rv-row-link, .rc-row-link, .grn-row-link {
    font-size: inherit;
}

/* Reduce margin between heading and filter card */
.tab-content > .tab-pane { padding-top: 0; }

/* Empty progress bar baseline */
.pr-progress, .rc-progress { margin-bottom: 2px; }

/* ============================================================
   CLICKABLE KPI CARDS — global, applies via .kpi-clickable
   ============================================================ */
.card.kpi-clickable {
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
    position: relative;
}
.card.kpi-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.14) !important;
}
.card.kpi-clickable::after {
    content: '\F284';            /* bi-arrow-up-right-square */
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 5px; right: 7px;
    font-size: .7rem;
    color: #CBD5E1;
    opacity: .8;
}
.card.kpi-clickable:hover::after { color: #6366F1; opacity: 1; }


/* ============================================================
   TOOLTIP VISUAL HINTS — any <th[title]> or .tip[title] becomes
   visually discoverable as hoverable for full-form / formula
   ============================================================ */
/* GOTCHA: Bootstrap MOVES the title attribute to data-bs-original-title the
   moment it initialises a tooltip (Site.Master initTooltips runs on DOM ready
   + on every MutationObserver hit).  So a rule written against [title] alone
   applies for a few milliseconds and then silently stops matching — the
   "this is hoverable" cue disappeared as soon as the page booted.  Every
   selector below must therefore match BOTH attributes. */
th[title], th[data-bs-original-title],
.tip[title], .tip[data-bs-original-title],
[data-bs-toggle="tooltip"] {
    cursor: help;
}
/* Subtle dotted underline on table headers that have tooltips */
th[title]:not(.tooltip-skipped),
th[data-bs-original-title]:not(.tooltip-skipped) {
    text-decoration: underline dotted rgba(255, 255, 255, 0.35);
    text-underline-offset: 2px;
}
/* Light-themed tables (white background) need darker underline */
.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, 0.25);
}
/* In-content help labels (inside cells) get a soft outline */
.tip[title],
.tip[data-bs-original-title] {
    border-bottom: 1px dotted #94A3B8;
}
/* Style the tooltip itself — larger, dark, soft shadow */
.tooltip {
    --bs-tooltip-bg: #0F172A;
    --bs-tooltip-color: #F1F5F9;
    --bs-tooltip-max-width: 340px;
    font-size: .8rem;
}
.tooltip-inner {
    text-align: left;
    line-height: 1.4;
    padding: .55rem .75rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    border-radius: .4rem;
}
/* Inside tooltip — small code/formula style */
.tooltip-inner code,
.tooltip-inner strong {
    color: #FCD34D;
    font-weight: 700;
}

/* ============================================================
   Shared item code / name picker  (Scripts/erp-item-picker.js)
   The dropdown is a position:fixed child of <body>, so it never
   gets clipped by an overflow-x:auto filter strip.
   ============================================================ */
.eip-drop        { position:fixed; z-index:2000; width:420px; max-width:92vw; background:#fff;
                   border:1px solid #CBD5E1; border-radius:.45rem;
                   box-shadow:0 10px 28px rgba(0,0,0,.18); display:none; overflow:hidden; }
.eip-drop.show   { display:block; }
.eip-head        { display:flex; align-items:center; gap:.3rem; padding:.35rem .5rem;
                   background:#F0FDF4; border-bottom:1px solid #DCFCE7;
                   font-size:.68rem; color:#166534; font-weight:700; }
.eip-head .cnt   { margin-right:auto; font-weight:600; }
.eip-head button { border:1px solid #86EFAC; background:#fff; color:#15803D;
                   border-radius:.3rem; font-size:.64rem; font-weight:700;
                   padding:1px 7px; cursor:pointer; white-space:nowrap; }
.eip-head button:hover:not(:disabled) { background:#DCFCE7; }
.eip-head button:disabled { opacity:.45; cursor:default; }
.eip-list        { max-height:262px; overflow-y:auto; }
.eip-item        { display:flex; align-items:center; gap:.4rem; padding:4px 8px; margin:0;
                   cursor:pointer; border-bottom:1px solid #F1F5F9; font-size:.72rem; }
.eip-item:last-child { border-bottom:0; }
.eip-item:hover, .eip-item.active { background:#F0FDF4; }
.eip-item input  { accent-color:#15803D; flex:0 0 auto; margin:0; }
.eip-item .code  { font-family:monospace; font-weight:700; color:#0E7490; flex:0 0 auto; }
.eip-item .name  { color:#475569; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.eip-foot        { padding:3px 8px; background:#F8FAFC; border-top:1px solid #F1F5F9;
                   font-size:.63rem; color:#94A3B8; }
.eip-empty       { padding:8px 10px; color:#94A3B8; font-size:.73rem; }

.eip-chips       { display:flex; flex-wrap:wrap; gap:4px; margin-top:.4rem; }
.eip-chips:empty { display:none; }
.eip-chip        { display:inline-flex; align-items:center; gap:5px; background:#ECFDF5;
                   color:#166534; border:1px solid #A7F3D0; border-radius:1rem;
                   padding:1px 5px 1px 9px; font-size:.67rem; font-weight:600; max-width:250px; }
.eip-chip .lbl   { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.eip-chip .x     { cursor:pointer; border:0; background:#A7F3D0; color:#166534; padding:0;
                   border-radius:50%; width:15px; height:15px; line-height:13px;
                   text-align:center; font-size:.66rem; flex:0 0 auto; }
.eip-chip .x:hover { background:#6EE7B7; }
.eip-chip.more   { background:#F1F5F9; color:#64748B; border-color:#E2E8F0; padding:1px 9px; }
.eip-chip.clr    { background:#FEF2F2; color:#991B1B; border-color:#FECACA;
                   padding:1px 9px; cursor:pointer; }
.eip-chip.clr:hover { background:#FEE2E2; }
.eip-selcnt      { background:#15803D; color:#fff; border-radius:99px; font-size:.6rem;
                   font-weight:700; padding:1px 6px; margin-left:.25rem; }
