:root {
    /* Brand chrome — sidebar / topbar / auth shell only, never CTAs */
    --brand-900: #0f172a;
    --brand-800: #1e293b;
    --brand-700: #334155;
    --brand-fg:  #f8fafc;

    /* Primary — every CTA, focus ring, link */
    --primary-50:  #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-fg:  #ffffff;

    /* Accent — sparing */
    --accent-500: #14b8a6;
    --accent-600: #0d9488;

    /* Surfaces */
    --page:         #f1f5f9;
    --panel:        #ffffff;
    --panel-subtle: #f8fafc;
    --line:         #e2e8f0;
    --line-strong:  #cbd5e1;
    --text:         #0f172a;
    --muted:        #64748b;

    /* Semantic tones */
    --tone-good:    #16a34a;
    --tone-good-bg: #dcfce7;
    --tone-bad:     #dc2626;
    --tone-bad-bg:  #fee2e2;
    --tone-warn:    #d97706;
    --tone-warn-bg: #fef3c7;
    --tone-info:    #0284c7;
    --tone-info-bg: #e0f2fe;

    /* Spacing scale (4px base) */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 24px; --s-6: 32px; --s-7: 48px;

    /* Radius scale */
    --r-sm: 6px;  --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

    /* Type scale */
    --fs-xs: 0.75rem; --fs-sm: 0.85rem; --fs-md: 0.95rem;
    --fs-lg: 1.1rem;  --fs-xl: 1.5rem;

    /* Elevation */
    --shadow:    0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    /* Motion */
    --t-fast: 120ms ease;
    --t-base: 200ms ease;
    --t-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Focus ring — single canonical definition */
    --ring: 0 0 0 3px color-mix(in srgb, var(--primary-600) 35%, transparent);

    /* Temporary aliases for legacy token names — remove once grep is clean.
       See docs/design-system.md §2.4. */
    --purple:          var(--brand-900);
    --purple-dark:     var(--brand-800);
    --blue:            var(--primary-600);
    --green:           var(--tone-good);
    --sidebar-active:  var(--brand-700);

    /* Sidebar (independent from brand so it can be light in light mode) */
    --sidebar-w:          248px;
    --sidebar-w-collapsed: 64px;
    --sidebar-bg:         #f8fafc;
    --sidebar-bg-hover:   #eef2ff;
    --sidebar-fg:         #0f172a;
    --sidebar-fg-muted:   #64748b;
    --sidebar-border:     #e2e8f0;
    --sidebar-active-bg:  #e0e7ff;
    --sidebar-active-fg:  #3730a3;
    --sidebar-accent:     #6366f1;

    /* Topbar — mirrors the sidebar palette so chrome reads as one surface */
    --topbar-bg:          var(--sidebar-bg);
    --topbar-bg-hover:    var(--sidebar-bg-hover);
    --topbar-fg:          var(--sidebar-fg);
    --topbar-fg-muted:    var(--sidebar-fg-muted);
    --topbar-border:      var(--sidebar-border);
    --topbar-active-bg:   var(--sidebar-active-bg);
    --topbar-active-fg:   var(--sidebar-active-fg);
    --topbar-accent:      var(--sidebar-accent);

    /* Font roles (single source of truth — §10) */
    --font-sans:    "Source Sans Pro", "Segoe UI", Arial, sans-serif;
    --font-mono:    "JetBrains Mono", "Consolas", ui-monospace, monospace;
    --font-display: var(--font-sans);
    --lh-tight: 1.2;
    --lh-snug:  1.35;
    --lh-base:  1.55;
    --lh-loose: 1.7;
}

[data-theme="dark"] {
    --brand-900: #020617;
    --brand-800: #0f172a;
    --brand-700: #1e293b;
    --brand-fg:  #f1f5f9;

    --primary-50:  #1e3a8a33;
    --primary-100: #1e40af44;
    --primary-500: #60a5fa;
    --primary-600: #3b82f6;
    --primary-700: #2563eb;

    --accent-500: #2dd4bf;
    --accent-600: #14b8a6;

    --page:         #0f172a;
    --panel:        #1e293b;
    --panel-subtle: #0f172a;
    --line:         #334155;
    --line-strong:  #475569;
    --text:         #f1f5f9;
    --muted:        #94a3b8;

    --tone-good:    #22c55e;
    --tone-good-bg: #14532d66;
    --tone-bad:     #ef4444;
    --tone-bad-bg:  #7f1d1d66;
    --tone-warn:    #f59e0b;
    --tone-warn-bg: #78350f66;
    --tone-info:    #38bdf8;
    --tone-info-bg: #07598566;

    --shadow:    0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);

    /* Sidebar — dark variant */
    --sidebar-bg:         #0b1220;
    --sidebar-bg-hover:   #131c2f;
    --sidebar-fg:         #e2e8f0;
    --sidebar-fg-muted:   #94a3b8;
    --sidebar-border:     #1f2a44;
    --sidebar-active-bg:  rgba(99, 102, 241, 0.18);
    --sidebar-active-fg:  #c7d2fe;
    --sidebar-accent:     #818cf8;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Source Sans Pro", "Segoe UI", Arial, sans-serif;
    font-size: clamp(14px, 0.9vw, 16px);
    background: var(--page);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.auth-page {
    min-height: 100vh;
    padding: clamp(18px, 4vw, 44px);
    background:
        linear-gradient(135deg, rgba(74, 29, 184, 0.12), rgba(0, 108, 255, 0.08)),
        var(--page);
}
.auth-shell {
    display: grid;
    grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 480px);
    width: min(1080px, 100%);
    min-height: min(720px, calc(100vh - 88px));
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
}
.auth-identity {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: clamp(28px, 4vw, 48px);
    background:
        linear-gradient(145deg, rgba(74, 29, 184, 0.96), rgba(22, 68, 160, 0.96)),
        #4020a0;
    color: #fff;
}
.auth-brand-mark {
    position: relative;
    display: inline-grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.65rem;
    font-weight: 900;
}
.auth-brand-mark i {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--green);
}
.auth-kicker {
    margin: 0 0 10px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}
.auth-identity h1 {
    max-width: 620px;
    margin: 0;
    font-size: 2.25rem;
    line-height: 1.08;
}
.auth-copy {
    max-width: 560px;
    margin: 14px 0 0;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.6;
}
.auth-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.auth-status-grid div {
    min-height: 82px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}
.auth-status-grid span {
    display: block;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
    font-weight: 800;
}
.auth-status-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 0.95rem;
}
.auth-card {
    align-self: center;
    width: 100%;
    padding: clamp(26px, 3.5vw, 42px);
    background: #fff;
}
.auth-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 34px;
}
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    color: var(--purple);
    font-weight: 900;
    font-size: 0.95rem;
}
.auth-brand i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
}
.auth-secure-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #edf7f1;
    color: #087a47;
    font-size: 0.75rem;
    font-weight: 900;
}
.auth-card h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.75rem;
}
.auth-card p {
    margin: 0 0 24px;
    color: var(--muted);
}
.auth-form {
    display: grid;
    gap: 16px;
}
.auth-form label:not(.auth-check) {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 800;
}
.auth-form input[type="email"],
.auth-form input[type="password"] {
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    color: var(--text);
}
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    outline: 0;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 108, 255, 0.12);
}
.auth-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}
.auth-form .button-primary {
    width: 100%;
    min-height: 46px;
    margin-top: 8px;
    border-radius: 8px;
}

/* ============================================================================
   Chrome — design-system.md §11 (color roles), §19 (placement), §24 (sidebar)
   ============================================================================ */
.erp-app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns var(--t-base);
}
[data-sidebar-collapsed="1"] .erp-app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* Sidebar — brand chrome surface */
.erp-sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    height: 100vh;
    overflow: hidden;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    border-right: 1px solid var(--sidebar-border);
    /* Snappy expand (120ms ease-out instead of 200ms ease — feels instant
       without losing motion). will-change hints the compositor to allocate a
       layer; `contain: layout style` keeps sidebar layout work from spilling
       into a page-wide reflow when the page contains a 1000-row table. */
    transition: width 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: width;
    contain: layout style;
}

.erp-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 18px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    font-size: var(--fs-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
}
.erp-brand-logo {
    display: block;
    max-height: 32px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
/* Theme-aware logo swap. Light is the default; dark theme flips it.
   Both images are loaded, only one is shown — no extra request avoided. */
.erp-brand-logo--dark { display: none; }
[data-theme="dark"] .erp-brand-logo--light { display: none; }
[data-theme="dark"] .erp-brand-logo--dark { display: block; }

/* When the sidebar is collapsed (and not hovered) the brand becomes a compact
   icon block — let the logo scale down to fit the 64px rail. */
@media (min-width: 721px) {
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .erp-brand-logo {
        max-height: 26px;
    }
}

.erp-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 10px 8px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-border) transparent;
}
.erp-sidebar-nav::-webkit-scrollbar { width: 6px; }
.erp-sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }
.erp-sidebar-nav::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--sidebar-fg-muted) 35%, transparent); }

.nav-link,
.nav-group > summary {
    position: relative;
    display: grid;
    grid-template-columns: 24px 1fr 14px;
    align-items: center;
    gap: 12px;
    min-height: 36px;
    padding: 0 10px;
    margin: 0 2px;
    border-radius: var(--r-sm);
    color: var(--sidebar-fg);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
.nav-link { grid-template-columns: 24px 1fr; }
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary .nav-chevron {
    color: var(--sidebar-fg-muted);
    font-size: 13px;
    font-weight: 400;
    transition: transform var(--t-fast);
    justify-self: end;
}
.nav-group[open] > summary .nav-chevron { transform: rotate(180deg); }

@media (hover: hover) {
    .nav-link:hover,
    .nav-group > summary:hover {
        background: var(--sidebar-bg-hover);
        color: var(--sidebar-fg);
    }
}
.nav-link:focus-visible,
.nav-group > summary:focus-visible {
    box-shadow: var(--ring);
    outline: none;
}

.nav-link.active,
.nav-group > summary.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-fg);
    font-weight: 600;
}
.nav-link.active::before,
.nav-group > summary.active::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--sidebar-accent);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--sidebar-fg-muted);
}
.nav-link.active .nav-icon,
.nav-group > summary.active .nav-icon { color: var(--sidebar-active-fg); }

.nav-children {
    padding: 2px 0 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.nav-children a {
    display: block;
    padding: 6px 10px 6px 48px;
    margin: 0 2px;
    border-radius: var(--r-sm);
    color: var(--sidebar-fg-muted);
    font-size: 12.5px;
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) {
    .nav-children a:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-fg); }
}
.nav-children a.active {
    color: var(--sidebar-active-fg);
    background: var(--sidebar-active-bg);
    font-weight: 600;
}
.nav-children a:focus-visible { box-shadow: var(--ring); outline: none; }

/* Sidebar footer (collapse handle + version label) */
.erp-sidebar-foot {
    padding: 8px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sidebar-pin {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--sidebar-fg-muted);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
@media (hover: hover) {
    .sidebar-pin:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-fg); }
}
.sidebar-pin:focus-visible { box-shadow: var(--ring); outline: none; }
.sidebar-pin .icon { width: 18px; height: 18px; transition: transform var(--t-fast); }
[data-sidebar-collapsed="1"] .sidebar-pin .icon { transform: rotate(180deg); }
.sidebar-foot-label {
    font-size: var(--fs-xs);
    color: var(--sidebar-fg-muted);
}

/* ----------------------------------------------------------------
   Collapsed-to-icons state (desktop only). The grid column stays at
   the narrow width, but the sidebar element is pinned `fixed` so it
   can overlay the main content when hovered — auto-expand pattern.
   Mobile uses its own drawer (see `max-width: 720px` block below).
   ---------------------------------------------------------------- */
@media (min-width: 721px) {
    /* Sidebar stays sticky in grid flow but its width follows hover state.
       When hovered the wider width overflows the narrow grid column,
       overlaying (not shifting) the main content. */
    [data-sidebar-collapsed="1"] .erp-sidebar {
        width: var(--sidebar-w-collapsed);
        overflow: visible; /* let tooltips + hover-expansion escape */
        transition: width 120ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 120ms ease;
    }
    /* Auto-expand on hover. :focus-within deliberately omitted — focused
       elements inside the sidebar (e.g. tabbing through nav items) were
       holding the sidebar open in a stuck state that felt laggy. */
    [data-sidebar-collapsed="1"] .erp-sidebar:hover {
        width: var(--sidebar-w);
        box-shadow: var(--shadow-lg);
        z-index: 5;
    }

    /* When collapsed AND not expanded: hide labels, chevrons, version, brand wordmark.
       Uses structural selectors so it works even if Blade class names drift. */
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-label,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-chevron,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-link > span:not(.nav-icon),
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-group > summary > span:not(.nav-icon),
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-group > summary > b,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .erp-brand > span,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .sidebar-foot-label { display: none; }

    /* When collapsed AND not expanded: centre icons, hide group children entirely */
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-link,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-group > summary {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 0;
        margin: 0 6px;
    }
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-link.active::before,
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-group > summary.active::before {
        left: -6px;
    }
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .erp-brand { justify-content: center; padding: 0; }
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .erp-sidebar-foot { justify-content: center; }
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) .nav-children { display: none; }

    /* Tooltip for items in the collapsed (not-hovered) bar */
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) [data-label] { position: relative; }
    [data-sidebar-collapsed="1"] .erp-sidebar:not(:hover) [data-label]:hover::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--sidebar-fg);
        color: var(--sidebar-bg);
        padding: 4px 8px;
        border-radius: 5px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        pointer-events: none;
        z-index: 60;
        box-shadow: var(--shadow);
    }
}

/* ----- Main column ----- */
.erp-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Topbar — sits on the --topbar-* surface (aliases sidebar palette) */
.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 0 16px 0 20px;
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: 0 1px 0 var(--topbar-border);
    /* Defensive: keep the topbar within the viewport on small screens
       even if a future item is wider than expected. Items get clipped
       on the right rather than pushing the whole page wider than the
       viewport (which created a horizontal scrollbar in mobile and
       made the whole layout feel broken). */
    max-width: 100vw;
    overflow-x: clip;
}
.topbar-spacer { flex: 1; }
.topbar-hamburger { display: none; }

/* Breadcrumb / current page title */
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: 4px;
}
.topbar-breadcrumb__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--topbar-fg);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 36ch;
}
@media (max-width: 720px) { .topbar-breadcrumb { display: none; } }

/* Generic icon-button used by search, hamburger, help, theme toggle, bell */
.erp-topbar .icon-button {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--topbar-fg-muted);
    border-radius: 7px;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
@media (hover: hover) {
    .erp-topbar .icon-button:hover {
        background: var(--topbar-bg-hover);
        color: var(--topbar-fg);
        border-color: var(--topbar-border);
    }
}
.erp-topbar .icon-button:focus-visible { box-shadow: var(--ring); outline: none; }

.topbar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid var(--topbar-border);
    border-radius: 7px;
    color: var(--topbar-fg);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
@media (hover: hover) {
    .topbar-button:hover {
        background: var(--topbar-bg-hover);
        color: var(--topbar-active-fg);
        border-color: var(--topbar-active-bg);
    }
}
.topbar-button:focus-visible { box-shadow: var(--ring); outline: none; }

.topbar-date {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 8px;
    color: var(--topbar-fg-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.account-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: var(--topbar-bg-hover);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    color: var(--topbar-fg);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.account-pill--with-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    height: auto;
    padding: 4px 12px;
    border-radius: 18px;
    line-height: 1.15;
}
.account-pill__name { font-size: 12.5px; font-weight: 600; }
.account-pill__meta {
    font-size: 11px;
    font-weight: 500;
    color: var(--topbar-fg-muted);
    letter-spacing: 0.01em;
}
@media (hover: hover) {
    .account-pill:hover {
        background: var(--topbar-active-bg);
        color: var(--topbar-active-fg);
    }
    .account-pill:hover .account-pill__meta { color: var(--topbar-active-fg); opacity: .8; }
}
.account-pill:focus-visible { box-shadow: var(--ring); outline: none; }

.logout-form { margin: 0; }

/* Theme toggle */
.erp-topbar .theme-toggle {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--topbar-fg-muted);
    border-radius: 7px;
}
.erp-topbar .theme-toggle:hover {
    background: var(--topbar-bg-hover);
    color: var(--topbar-fg);
    border-color: var(--topbar-border);
}

/* Tenant pill (kept for multi-business/super-admin path) */
.erp-topbar .tenant-pill {
    background: var(--topbar-bg-hover);
    border: 1px solid transparent;
    color: var(--topbar-fg);
}
.erp-topbar .tenant-pill:hover {
    background: var(--topbar-active-bg);
    color: var(--topbar-active-fg);
}

/* Bell */
.erp-topbar .bell-wrap .icon-button {
    background: transparent;
    color: var(--topbar-fg-muted);
}
.erp-topbar .bell-wrap .icon-button:hover { background: var(--topbar-bg-hover); color: var(--topbar-fg); }
.erp-topbar .bell-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--tone-bad);
    color: #fff;
    border-radius: var(--r-pill);
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 0 0 2px var(--topbar-bg);
}

/* Severity rail on individual bell items */
.bell-item {
    border-left: 3px solid transparent;
    padding-left: 9px;
}
.bell-item[data-severity="critical"] { border-left-color: var(--tone-bad); }
.bell-item[data-severity="warning"]  { border-left-color: var(--tone-warn); }
.bell-item[data-severity="info"]     { border-left-color: var(--tone-info); }
.bell-item[data-severity="success"]  { border-left-color: var(--tone-good); }

/* Bell row wrapper houses the item link + the dismiss button. */
.bell-item-wrap {
    position: relative;
    display: block;
}
.bell-item-wrap .bell-item {
    padding-right: 32px; /* leave room for the ✕ */
}
.bell-item-dismiss {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--topbar-muted, #6b7280);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 120ms, background 120ms;
}
.bell-item-dismiss:hover {
    opacity: 1;
    background: color-mix(in srgb, currentColor 12%, transparent);
}

/* One-time push-opt-in nudge inside the bell panel */
.bell-push-nudge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--topbar-accent) 8%, transparent);
    border-bottom: 1px solid var(--topbar-border);
    font-size: 12px;
    color: var(--topbar-fg);
}
.bell-push-nudge button {
    background: transparent;
    border: 1px solid var(--topbar-border);
    border-radius: 5px;
    padding: 3px 9px;
    font-size: 11.5px;
    color: var(--topbar-fg);
    cursor: pointer;
}
.bell-push-nudge button:hover { background: var(--topbar-bg-hover); }
.bell-push-nudge [data-push-enable] {
    border-color: var(--topbar-accent);
    color: var(--topbar-active-fg);
    background: var(--topbar-active-bg);
}
.bell-push-nudge [data-push-dismiss] {
    margin-left: auto;
    width: 22px;
    padding: 0;
    line-height: 1;
}

/* Help / shortcuts popover (mirrors .bell-panel) */
.help-wrap { position: relative; display: inline-block; }
.help-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    border: 1px solid var(--topbar-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 40;
    overflow: hidden;
}
.help-wrap.is-open .help-panel { display: block; }
.help-panel__header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--topbar-border);
    font-size: 12.5px;
    font-weight: 600;
}
.help-panel__list { padding: 6px; }
.help-panel__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12.5px;
}
.help-panel__row:hover { background: var(--topbar-bg-hover); }
.help-panel__row kbd {
    background: var(--topbar-bg-hover);
    border: 1px solid var(--topbar-border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--topbar-fg);
}
.help-panel__foot {
    padding: 10px 14px;
    border-top: 1px solid var(--topbar-border);
    text-align: right;
}
.help-panel__foot a {
    color: var(--topbar-active-fg);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}
.help-panel__foot a:hover { text-decoration: underline; }

/* Location pill (single-business multi-location variant of the switcher) */
.erp-topbar .location-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: var(--topbar-bg-hover);
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--topbar-fg);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}
.erp-topbar .location-pill:hover { background: var(--topbar-active-bg); color: var(--topbar-active-fg); }

/* Stop impersonation row at the top of the tenant menu */
.tenant-row--stop-impersonation {
    background: color-mix(in srgb, var(--tone-bad) 12%, transparent);
    color: var(--tone-bad);
    font-weight: 600;
    border-bottom: 1px solid var(--topbar-border);
}
.tenant-row--stop-impersonation:hover { background: color-mix(in srgb, var(--tone-bad) 20%, transparent); }

/* Content area */
.erp-content {
    min-width: 0;
    padding: var(--s-5) clamp(16px, 2vw, 28px);
}

/* Page heading — typography per §10 */
.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}
.page-heading h1 {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: 700;
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
}
.page-heading p {
    margin: var(--s-1) 0 0;
    color: var(--muted);
    font-size: var(--fs-sm);
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

/* Mobile chrome */
@media (max-width: 720px) {
    .erp-app {
        grid-template-columns: 1fr;
    }
    .erp-sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        width: min(280px, calc(100vw - 48px));
        transform: translateX(-100%);
        transition: transform var(--t-base);
        border-right: 1px solid var(--sidebar-border);
    }
    /* JS calls toggleAttribute('data-drawer-open', open) which sets the
       attribute with an EMPTY value (not "1"). Match its presence, not
       its value — older selector [data-drawer-open="1"] never fired. */
    /* Sidebar's base z-index (4) sits below the backdrop (90), so lift
       it above when the drawer is open. */
    [data-drawer-open] .erp-sidebar { transform: translateX(0); z-index: 95; box-shadow: 0 0 40px rgba(0,0,0,.25); }
    [data-drawer-open] .drawer-backdrop { opacity: 1; pointer-events: auto; }
    .topbar-hamburger { display: inline-grid; }
    .erp-content { padding: var(--s-4); }
    .page-heading { flex-direction: column; }
}

/* Mobile drawer backdrop — appended to body by erp-drawer.js. Sits
   between the sidebar (z-index taken from .erp-sidebar) and the page
   so a tap outside closes the drawer. Hidden when no drawer is open. */
.drawer-backdrop {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0, 0, 0, .45);
    opacity: 0; pointer-events: none;
    transition: opacity var(--t-base);
}
@media (min-width: 721px) { .drawer-backdrop { display: none; } }

/* ============================================================
   Page tour (erp-tour.js) — spotlight overlay + floating tooltip.
   Overlay uses box-shadow on the spotlight to darken everything
   outside it (one element, no extra divs). Spotlight transitions
   to the next target smoothly so the eye follows.
   ============================================================ */
.erp-tour-overlay {
    position: fixed; inset: 0; z-index: 9000;
    pointer-events: auto;
}
.erp-tour-spotlight {
    position: absolute;
    border-radius: 12px;
    /* Stacked shadows: the big 9999px darkens everything OUTSIDE the
       spotlight; the next layer adds a 3px brand-color ring hugging
       the focused element; the last is a softer 20px glow that pulses
       to draw the eye. */
    box-shadow:
        0 0 0 9999px rgba(8, 12, 24, .68),
        0 0 0 3px color-mix(in srgb, var(--accent-500) 65%, transparent),
        0 0 24px 6px color-mix(in srgb, var(--accent-500) 45%, transparent);
    transition: top var(--t-base), left var(--t-base), width var(--t-base), height var(--t-base);
    animation: tour-spot-pulse 2.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes tour-spot-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 9999px rgba(8, 12, 24, .68),
            0 0 0 3px   color-mix(in srgb, var(--accent-500) 65%, transparent),
            0 0 24px 6px color-mix(in srgb, var(--accent-500) 45%, transparent);
    }
    50% {
        box-shadow:
            0 0 0 9999px rgba(8, 12, 24, .68),
            0 0 0 4px   color-mix(in srgb, var(--accent-500) 80%, transparent),
            0 0 38px 12px color-mix(in srgb, var(--accent-500) 60%, transparent);
    }
}
@media (prefers-reduced-motion: reduce) {
    .erp-tour-spotlight { animation: none; }
}
.erp-tour-tip {
    position: absolute;
    width: 320px; max-width: calc(100vw - 32px);
    background: var(--surface-panel, #fff);
    color: var(--text, #111);
    border: 1px solid var(--border-default, rgba(0,0,0,.08));
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 28px 56px -20px rgba(0,0,0,.4);
    font-size: 13.5px; line-height: 1.55;
}
.erp-tour-tip h3 { margin: 0 0 .35rem; font-size: 15px; font-weight: 700; }
.erp-tour-tip__body div { color: var(--text-muted, #4a4f5b); }
.erp-tour-tip__ctl {
    display: flex; align-items: center; gap: .4rem;
    margin-top: .9rem; padding-top: .7rem;
    border-top: 1px solid var(--border-default, rgba(0,0,0,.08));
}
.erp-tour-tip__counter { font-size: 11px; color: var(--text-muted, #6b7480); margin-right: auto; font-variant-numeric: tabular-nums; }
.erp-tour-tip__ctl button {
    border: 1px solid var(--border-default, rgba(0,0,0,.1));
    background: transparent; color: var(--text);
    border-radius: 999px; padding: .35rem .8rem;
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: inherit;
}
.erp-tour-tip__ctl button:disabled { opacity: .4; cursor: not-allowed; }
.erp-tour-next {
    background: linear-gradient(135deg, var(--accent-500, #4a1db8), var(--accent-600, #006cff)) !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* Gallery / carousel step type (centered, no spotlight). The tip grows
   wider in this mode so module mockups have room to breathe. */
.erp-tour-tip--gallery {
    width: min(720px, calc(100vw - 32px));
}
.erp-tour-gallery {
    position: relative;
    margin-top: .9rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-sunken, #0d1426);
    border: 1px solid var(--border-default);
}
.erp-tour-gallery__track {
    display: flex; transition: transform .35s ease;
}
.erp-tour-gallery__slide {
    flex: 0 0 100%; padding: 1rem;
    display: flex; flex-direction: column; gap: .6rem;
    min-height: 320px; box-sizing: border-box;
}
.erp-tour-gallery__slide img {
    width: 100%; height: auto; max-height: 360px; object-fit: contain;
    border-radius: 8px;
}
.erp-tour-gallery__caption {
    margin: 0; font-size: 12.5px; color: var(--text-muted);
    text-align: center;
}
.erp-tour-gallery__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: var(--surface-panel); color: var(--text);
    border: 1px solid var(--border-default);
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    cursor: pointer; font-size: 20px; line-height: 1;
}
.erp-tour-gallery__nav--prev { left: 8px; }
.erp-tour-gallery__nav--next { right: 8px; }
.erp-tour-gallery__dots {
    position: absolute; bottom: 8px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 6px;
}
.erp-tour-gallery__dots button {
    width: 7px; height: 7px; border-radius: 50%;
    border: 0; background: color-mix(in srgb, var(--text-muted) 50%, transparent);
    cursor: pointer; padding: 0;
}
.erp-tour-gallery__dots button.is-on {
    background: var(--accent-500); transform: scale(1.3);
}

/* HTML mockup chrome — used by erp-tours.js to render preview cards for
   the welcome carousel. Themed via tokens so light/dark both work. */
.erp-tour-mockup {
    background: var(--surface-panel);
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border-default);
    font-size: 11.5px; line-height: 1.45;
    flex: 1; min-height: 250px;
    display: flex; flex-direction: column;
}
.erp-tour-mockup__bar {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 10px;
    background: color-mix(in srgb, var(--text-muted) 8%, transparent);
    border-bottom: 1px solid var(--border-default);
}
.erp-tour-mockup__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.erp-tour-mockup__title { margin-left: auto; font-size: 10.5px; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }
.erp-tour-mockup__body { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.erp-tour-mockup__tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.erp-tour-mockup__tile {
    padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border-default);
    background: var(--surface-sunken);
    display: flex; flex-direction: column; gap: 2px;
}
.erp-tour-mockup__tile small { color: var(--text-muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
.erp-tour-mockup__tile strong { color: var(--text); font-size: 13px; font-weight: 700; }
.erp-tour-mockup__tile[data-tone="good"] strong { color: var(--tone-good); }
.erp-tour-mockup__tile[data-tone="warn"] strong { color: var(--tone-warn); }
.erp-tour-mockup__tile[data-tone="bad"]  strong { color: var(--tone-bad); }
.erp-tour-mockup__chart {
    height: 60px; border-radius: 6px;
    background:
        linear-gradient(90deg,
            transparent 0%, transparent 12%,
            color-mix(in srgb, var(--accent-500) 40%, transparent) 12%,
            color-mix(in srgb, var(--accent-500) 40%, transparent) 13%,
            transparent 13%, transparent 100%),
        linear-gradient(180deg, color-mix(in srgb, var(--accent-500) 10%, transparent) 0%, transparent 80%);
    position: relative; overflow: hidden;
}
.erp-tour-mockup__chart::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent-500), var(--accent-600));
}
.erp-tour-mockup__split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.erp-tour-mockup__split > div { padding: 7px 9px; border-radius: 6px; background: var(--surface-sunken); }
.erp-tour-mockup__split small { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }
.erp-tour-mockup__row {
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    padding: 3px 0; align-items: baseline;
    border-bottom: 1px dashed color-mix(in srgb, var(--text-muted) 18%, transparent);
}
.erp-tour-mockup__row:last-child { border-bottom: 0; }
.erp-tour-mockup__row span { font-size: 11px; }
.erp-tour-mockup__bar-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: center; padding: 2px 0; }
.erp-tour-mockup__bar-row small { font-size: 10.5px; color: var(--text-muted); }
.erp-tour-mockup__bar-track { height: 6px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.erp-tour-mockup__bar-fill { height: 100%; border-radius: 999px; background: var(--accent-500); }
.erp-tour-mockup__bar-fill[data-tone="good"] { background: var(--tone-good); }
.erp-tour-mockup__bar-fill[data-tone="warn"] { background: var(--tone-warn); }
.erp-tour-mockup__bar-fill[data-tone="bad"]  { background: var(--tone-bad); }

/* POS mockup */
.erp-tour-mockup__pos { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; flex: 1; }
.erp-tour-mockup__pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.erp-tour-mockup__pos-tile {
    padding: 8px 6px; border-radius: 5px; background: var(--surface-sunken);
    border: 1px solid var(--border-default); font-size: 10.5px; text-align: center; line-height: 1.4;
}
.erp-tour-mockup__pos-tile b { display: block; margin-top: 2px; color: var(--accent-500); }
.erp-tour-mockup__pos-cart {
    padding: 8px 10px; border-radius: 6px;
    background: var(--surface-sunken); display: flex; flex-direction: column; gap: 3px;
}
.erp-tour-mockup__pos-cart small { color: var(--text-muted); font-size: 10px; }
.erp-tour-mockup__pos-total { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border-default); font-size: 13px; }
.erp-tour-mockup__pos-pay {
    margin-top: 6px; padding: 6px 0;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: #fff; border: 0; border-radius: 6px; font-weight: 700; cursor: default;
}

/* CRM mockup */
.erp-tour-mockup__profile {
    margin-top: auto; padding: 6px 8px; border-radius: 6px; background: var(--surface-sunken);
    display: flex; gap: 8px; align-items: center;
}
.erp-tour-mockup__avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.erp-tour-mockup__profile strong { display: block; font-size: 11.5px; }
.erp-tour-mockup__profile small { color: var(--text-muted); font-size: 10.5px; }
.erp-tour-mockup__list { display: flex; flex-direction: column; gap: 0; }

/* Branch step — vertical option list */
.erp-tour-branch { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.erp-tour-branch__opt {
    text-align: left; padding: .8rem 1rem;
    background: var(--surface-sunken); border: 1px solid var(--border-default);
    border-radius: 8px; color: var(--text); cursor: pointer; font-size: 13.5px;
    font-family: inherit; font-weight: 500;
    transition: border-color .15s, background .15s;
}
.erp-tour-branch__opt:hover {
    border-color: var(--accent-500);
    background: color-mix(in srgb, var(--accent-500) 8%, var(--surface-sunken));
}

/* Help menu — small dropdown anchored to the topbar ❓ button */
.topbar-help { position: relative; }
.topbar-help__menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--surface-panel); border: 1px solid var(--border-default);
    border-radius: 10px; padding: .35rem; min-width: 220px;
    box-shadow: 0 14px 28px -14px rgba(0,0,0,.28);
    z-index: 50;
}
.topbar-help__menu a, .topbar-help__menu button {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .7rem; border-radius: 6px;
    color: var(--text); text-decoration: none; font-size: 13px;
    background: none; border: 0; width: 100%; text-align: left;
    cursor: pointer; font-family: inherit;
}
.topbar-help__menu a:hover, .topbar-help__menu button:hover {
    background: color-mix(in srgb, var(--accent-500) 8%, transparent);
}

.panel-card,
.stat-card,
.module-card,
.hero-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.hero-card,
.panel-card,
.stat-card,
.module-card {
    padding: clamp(18px, 1.6vw, 28px);
}
.stats-grid,
.module-grid,
.content-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 20px;
}
.stats-grid,
.module-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.content-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.stat-title,
.stat-copy,
.hero-copy,
.empty-copy {
    color: var(--muted);
}
.stat-card h2,
.module-card h3,
.panel-card h3,
.hero-card h1 {
    margin: 0;
}
/* .button-primary / .button-secondary are defined in erp-foundations.css (§27).
   .module-link keeps its dashboard-card CTA shape here. */
.module-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-top: 16px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--r-md);
    background: var(--primary-600);
    color: var(--primary-fg);
    font-weight: 700;
    text-decoration: none;
    transition: background var(--t-fast);
}
@media (hover: hover) {
    .module-link:hover { background: var(--primary-700); }
}
.module-link:focus-visible { box-shadow: var(--ring); outline: none; }
.check-list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}
.empty-state {
    max-width: 760px;
    padding: clamp(24px, 3vw, 48px);
    border: 1px dashed #b8c4d4;
    border-radius: 18px;
    background: #fff;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 14px;
    color: var(--text);
    background: var(--panel);
}
.form-grid .wide {
    grid-column: 1 / -1;
}
.field-help {
    min-height: 16px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}
.field-help.error {
    color: #dc2626;
}
.field-help.success {
    color: #15803d;
}
.form-grid input.field-invalid,
.form-grid select.field-invalid,
.form-grid textarea.field-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.form-grid input.field-valid,
.form-grid select.field-valid,
.form-grid textarea.field-valid {
    border-color: #22c55e;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
}

.erp-list-card {
    padding: clamp(16px, 1.4vw, 24px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.contact-filter-card {
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
}
.filter-toggle {
    border: 0;
    background: transparent;
    color: #2f84bd;
    font-size: 1.05rem;
    font-weight: 800;
}
.filter-toggle::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 14px solid #2f84bd;
    vertical-align: middle;
}
.list-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    min-height: 56px;
    margin-bottom: 8px;
}
.list-card-header h2 {
    margin: 0;
    color: #202555;
    font-size: clamp(20px, 1.35vw, 26px);
    font-weight: 500;
}
.add-record {
    position: relative;
}
.add-record summary,
.floating-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 76px;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #6d5cff, #2879ef);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}
.add-record summary::-webkit-details-marker {
    display: none;
}
.add-record summary span,
.floating-add span {
    font-size: 1.35rem;
    line-height: 1;
}
.add-record-form {
    position: absolute;
    z-index: 6;
    top: calc(100% + 12px);
    right: 0;
    width: min(760px, calc(100vw - 360px));
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}
.erp-table-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) minmax(180px, 240px);
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.erp-table-toolbar label {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.erp-table-toolbar select,
.erp-table-toolbar input {
    min-height: 38px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0 14px;
}
.erp-table-toolbar select {
    min-width: 72px;
}
.erp-table-toolbar .page-size-custom {
    width: 86px;
}
.page-heading.compact {
    padding: 0 0 10px;
    margin-bottom: 6px;
}
.compact-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.compact-heading h1 {
    margin: 0;
    font-size: clamp(26px, 2.2vw, 40px);
}
.page-title {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: clamp(24px, 1.6vw, 32px);
    font-weight: 700;
    color: #111827;
}
.page-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
}
.products-tabs {
    margin-bottom: 14px;
}
.products-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.floating-add.small {
    min-width: 112px;
    min-height: 40px;
    padding: 0 16px;
    font-weight: 800;
}
.floating-add.small.secondary {
    background: linear-gradient(135deg, #64748b, #334155);
}
.action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.row-action-menu {
    position: relative;
}
.action-menu {
    position: relative;
    display: inline-block;
}

/* ===== Bulk-action bar (used across list pages with row checkboxes) =====
   Drop a <div class="cat-bulk" data-bulk-bar hidden> above any erp-data-table
   that has `data-bulk-check` checkboxes; the existing JS pattern (see
   expenses/categories.blade.php) wires it up. */
.cat-bulk {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 16px; background: #eff6ff; border-bottom: 1px solid #bfdbfe;
    font-size: 0.88rem; color: #1d4ed8;
}
.cat-bulk strong { color: #1e3a8a; }
.cat-bulk select {
    min-height: 32px; padding: 0 10px;
    border: 1px solid #93c5fd; border-radius: 8px;
    background: #fff; font: inherit;
}
.cat-bulk button {
    min-height: 32px; padding: 0 12px;
    border-radius: 8px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.cat-bulk__clear {
    background: transparent !important; border: 0 !important; color: #1d4ed8 !important;
    cursor: pointer; font: inherit; padding: 0 4px;
}
.cat-bulk__clear:hover { text-decoration: underline; }
.cat-col-check, .cat-col-color { width: 32px; }
.cat-col-check input[type="checkbox"],
td input[type="checkbox"][data-bulk-check] {
    width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer;
}
.row-action-menu summary::-webkit-details-marker {
    display: none;
}
.action-menu summary::-webkit-details-marker {
    display: none;
}
.action-menu summary {
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid #38bdf8;
    border-radius: 9px;
    color: #0284c7;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.row-action-menu-items {
    position: absolute;
    z-index: 8;
    top: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 4px;
}
.row-action-menu-items a,
.row-action-menu-items button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: #111827;
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}
.row-action-menu-items a:hover,
.row-action-menu-items button:hover {
    background: #f3f4f6;
}
.action-menu > div {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    gap: 4px;
    min-width: 150px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}
.action-menu a,
.action-menu button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 750;
    cursor: pointer;
}
.action-menu form {
    margin: 0;
}
.action-menu a:hover,
.action-menu button:hover {
    background: #f3f4f6;
}
.inline-edit {
    position: relative;
}
.inline-edit summary::-webkit-details-marker {
    display: none;
}
.inline-edit-form {
    position: absolute;
    z-index: 10;
    top: calc(100% + 8px);
    right: 0;
    width: min(460px, calc(100vw - 380px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}
.product-image-cell .image-placeholder {
    width: 54px;
    height: 44px;
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-size: 18px;
}
.products-module-card {
    min-height: 360px;
}
.product-add-record .add-record-form {
    width: min(520px, calc(100vw - 360px));
}
.compact-add {
    min-width: 112px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 0.95rem;
}
.purchase-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.purchase-filter-grid .field,
.purchase-form-grid .field,
.purchase-return-form .field {
    display: grid;
}
.purchase-filter-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}
.filter-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}
.purchase-summary-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    color: var(--muted);
    font-size: 0.86rem;
}
.purchase-summary-strip span {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
}
.purchase-form-card,
.purchase-lines-card {
    margin-bottom: 14px;
}
.purchase-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 18px;
}
.purchase-form-grid .two-column {
    grid-column: span 2;
}
.purchase-form-grid .field {
    gap: 7px;
}
.purchase-form-grid .field > span,
.purchase-return-form .field > span {
    color: #111827;
    font-size: 0.88rem;
    font-weight: 900;
}
.purchase-form-grid input,
.purchase-form-grid select,
.purchase-form-grid textarea,
.purchase-return-form select {
    width: 100%;
    min-height: 38px;
}
.purchase-product-picker {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 12px;
    margin-bottom: 14px;
}
.purchase-product-picker select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
}
.purchase-line-table th {
    background: #56b65a;
    color: #fff;
}
.table-input,
.purchase-line-table select {
    width: 100%;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 8px;
    background: #fff;
}
.purchase-totals {
    display: grid;
    justify-content: end;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.95rem;
}
.summary-line {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-weight: 800;
}
.purchase-total {
    grid-column: 1 / -1;
}
.totals-grid {
    align-items: end;
}
.inline-payment-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 10px;
    align-items: end;
}
.purchase-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
}
.purchase-detail-grid > div {
    display: grid;
    gap: 6px;
}
.sticky-form-actions.inline {
    position: static;
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
    background: transparent;
    padding: 0;
}
.purchase-save-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 18px 0 8px;
}
.purchase-save-actions .button-primary,
.purchase-save-actions .outline-action {
    min-width: 140px;
}
.pos-screen {
    display: grid;
    gap: 12px;
    margin: -10px -6px 0;
}
.pos-toolbar,
.pos-paybar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.pos-toolbar label,
.pos-paybar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
}
.pos-toolbar select,
.pos-toolbar input,
.pos-paybar input,
.pos-paybar select {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
}
.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.8fr);
    gap: 14px;
}
.pos-cart {
    min-height: 520px;
}
.pos-products {
    min-height: 520px;
}
.pos-tab-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.pos-tab-strip strong {
    display: grid;
    min-height: 52px;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    color: #fff;
    font-size: 1.2rem;
}
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    max-height: 620px;
    overflow: auto;
    padding-right: 6px;
}
.pos-product-card {
    display: grid;
    gap: 5px;
    min-height: 138px;
    padding: 10px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    color: #334155;
    cursor: pointer;
}
.pos-product-card .image-placeholder {
    display: grid;
    width: 54px;
    height: 44px;
    place-items: center;
    justify-self: center;
    border-radius: 6px;
    background: #e9eef3;
    color: #94a3b8;
}
.pos-product-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pos-total-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 1.05rem;
    font-weight: 900;
}
.pos-total-strip input {
    width: 110px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 8px;
}
.pos-grand-total {
    margin-left: auto;
    font-size: 1.2rem;
    font-weight: 900;
}
.pos-terminal-body {
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    background: #eef3f7;
    color: #111827;
}
.pos-terminal {
    display: grid;
    grid-template-rows: 56px auto minmax(0, 1fr) 76px;
    gap: 10px;
    height: 100vh;
}
.pos-terminal-topbar {
    display: grid;
    grid-template-columns: minmax(240px, 300px) 150px repeat(8, minmax(58px, max-content)) minmax(120px, max-content);
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
}
.pos-location-control {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 0.82rem;
}
.pos-location-control select,
.pos-field select,
.pos-field input,
.pos-field button,
.pos-expense-form input,
.pos-expense-form select,
.pos-expense-form textarea {
    min-height: 34px;
    width: 100%;
    border: 1px solid #ccd5e1;
    background: #fff;
    color: #374151;
    padding: 0 10px;
    font-size: 0.82rem;
}
.pos-date-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    border-radius: 6px;
    background: linear-gradient(135deg, #7067f5, #4f7df3);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
}
.pos-tool-button,
.pos-expense-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0 0 1px #dbe3ee, 0 3px 8px rgba(15, 23, 42, 0.08);
    color: #2868e8;
    font-size: 0.76rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}
.pos-tool-button.danger {
    color: #ef4444;
}
.pos-tool-button.green {
    color: #059669;
}
.pos-tool-button.display {
    color: #7c3aed;
}
.pos-tool-button.muted {
    color: #94a3b8;
}
.pos-expense-button {
    justify-self: end;
    min-width: 116px;
    color: #111827;
}
.pos-terminal-error {
    margin: 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.84rem;
    font-weight: 900;
}
.pos-terminal-main {
    display: grid;
    grid-template-columns: minmax(620px, 1.1fr) minmax(520px, 0.9fr);
    gap: 14px;
    min-height: 0;
    padding: 0 16px;
}
.pos-order-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-panel, #fff);
    color: var(--text);
    box-shadow: var(--shadow);
}
.pos-input-row {
    display: grid;
    grid-template-columns: minmax(220px, 0.44fr) minmax(360px, 1fr);
    gap: 10px;
}
.pos-quick-row {
    display: grid;
    grid-template-columns: minmax(220px, 0.5fr) minmax(220px, 0.5fr) minmax(160px, 1fr);
    gap: 10px;
}
.pos-field {
    display: grid;
    gap: 5px;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 900;
}
.pos-field.product-search {
    grid-template-columns: minmax(0, 1fr) 72px;
    align-items: end;
}
.pos-field.product-search span {
    grid-column: 1 / -1;
}
.pos-field.product-search button {
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}
.pos-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin-top: 18px;
    font-size: 0.82rem;
    font-weight: 900;
}
.pos-check input {
    width: 20px;
    height: 20px;
}
.pos-cart-table {
    min-height: 0;
    overflow: auto;
    border-bottom: 1px solid var(--border-default, #e5e7eb);
}
.pos-cart-table table {
    width: 100%;
    border-collapse: collapse;
}
.pos-cart-table th,
.pos-cart-table td {
    padding: 9px 8px;
    border: 1px solid var(--border-default, #edf0f4);
    text-align: left;
}
.pos-cart-table th {
    font-size: 0.82rem;
    font-weight: 900;
}
.pos-cart-table th:not(:first-child),
.pos-cart-table td:not(:first-child) {
    text-align: center;
}
.pos-cart-table th:last-child {
    width: 48px;
}
.pos-cart-table .table-input {
    max-width: 72px;
    min-height: 30px;
    text-align: center;
}
.pos-cart-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    background: var(--surface-panel);
    color: var(--text);
    padding-top: 10px;
    border-top: 1px solid var(--border-default, #edf0f4);
    font-size: 0.9rem;
    font-weight: 900;
}
/* Legacy flat-summary tile styling. The current POS markup wraps
   each metric in a .tile div with .lbl/.val spans; that styling
   lives inline in pos.blade.php using --surface-* tokens so it
   theme-flips correctly. Scoping these to direct children
   (> span, > button) keeps the legacy POS variants working
   without painting white pills over the nested spans in dark mode. */
.pos-cart-summary > span,
.pos-cart-summary > button {
    display: grid;
    gap: 3px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-sunken, #f8fafc);
    color: var(--text-strong, #0f172a);
    text-align: left;
    font-weight: 900;
}
.pos-cart-summary > button {
    cursor: pointer;
}
.pos-side-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
}
.pos-customer-display {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 0;
    padding: 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow);
}
.pos-customer-display > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #cbd5e1;
    font-weight: 900;
}
.pos-customer-display > div:first-child strong {
    color: #86efac;
    font-size: 1.35rem;
}
.pos-customer-lines {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 0;
    overflow: auto;
    color: #e2e8f0;
    font-size: 0.78rem;
}
.pos-customer-lines div,
.pos-customer-display dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
}
.pos-customer-display dl {
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 0.8rem;
}
.pos-customer-display dd {
    margin: 0;
    font-weight: 900;
}
.pos-product-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
}
.pos-product-filters {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr);
    gap: 8px;
}
.pos-product-filters input,
.pos-product-filters select {
    min-height: 36px;
    border: 1px solid var(--border-default, #d8e1ec);
    border-radius: 8px;
    padding: 0 10px;
    background: var(--surface-panel, #fff);
    color: var(--text);
    font-size: 0.8rem;
}
.pos-terminal-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding: 0 4px 4px;
}
.pos-terminal-product {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 3px;
    min-height: 126px;
    padding: 9px 8px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-panel, #fff);
    color: var(--text, #374151);
    box-shadow: var(--shadow);
    cursor: pointer;
}
.pos-product-image {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    background: #e8edf2;
    color: #64748b;
    font-weight: 900;
}
.pos-terminal-product strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 500;
}
.pos-terminal-product small,
.pos-terminal-product em {
    color: #374151;
    font-size: 0.68rem;
    font-style: normal;
}
.pos-terminal-paybar {
    display: grid;
    grid-template-columns: repeat(4, minmax(76px, max-content)) repeat(4, minmax(112px, max-content)) minmax(200px, 1fr) minmax(180px, max-content);
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.1);
}
.pos-mode-button {
    display: grid;
    justify-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    color: #1f2937;
    font-weight: 800;
    cursor: pointer;
}
.pos-mode-button.draft {
    color: #0284c7;
}
.pos-mode-button.quotation {
    color: #d59600;
}
.pos-mode-button.suspend {
    color: #ef4444;
}
.pos-mode-button.credit {
    color: #5656b4;
}
.pos-mode-button.card {
    color: #e11d48;
}
.pos-pay-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}
.pos-pay-button.multiple {
    background: #06264a;
}
.pos-pay-button.card {
    background: #7c3aed;
}
.pos-pay-button.cash {
    background: #2bbd83;
}
.pos-pay-button.cancel {
    background: #e53025;
}
.pos-total-payable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #111827;
    font-size: 1rem;
    font-weight: 900;
    text-align: right;
}
.pos-total-payable strong {
    color: #137a4d;
    font-size: 1.45rem;
}
.pos-recent-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    background: #6864e8;
    color: #fff;
    font-weight: 900;
    text-decoration: none;
}
.pos-small-dialog {
    width: min(520px, calc(100vw - 32px));
}
.pos-calculator-input {
    font-size: 1.2rem;
}
.pos-calculator-result {
    font-size: 1.6rem;
}
.pos-empty-products {
    grid-column: 1 / -1;
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 12px;
    background: #fff;
}
.pos-calculator output {
    display: block;
    min-height: 58px;
    padding: 12px;
    border-radius: 10px;
    background: #0f172a;
    color: #86efac;
    text-align: right;
    font-size: 1.6rem;
    font-weight: 900;
}
.pos-calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.pos-calculator-grid button {
    min-height: 44px;
    border: 1px solid #d8e1ec;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-weight: 900;
    cursor: pointer;
}
.pos-calculator-grid [data-calc-back],
.pos-calculator-grid [data-calc-equals] {
    grid-column: span 2;
    background: #2563eb;
    color: #fff;
}
.customer-display-body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(circle at top left, #312e81, #020617 55%);
    color: #fff;
}
.customer-display-screen {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 22px;
    min-height: 100vh;
    padding: 28px;
}
.customer-display-hero,
.customer-display-card,
.customer-display-totals {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    background: rgba(15, 23, 42, 0.78);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(12px);
}
.customer-display-hero {
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 36px;
}
.customer-display-hero span,
.customer-display-hero small {
    color: #c4b5fd;
    font-weight: 900;
}
.customer-display-hero strong {
    color: #86efac;
    font-size: clamp(3.2rem, 9vw, 7rem);
    line-height: 1;
}
.customer-display-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    padding: 26px;
}
.customer-display-card header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.customer-display-card h1 {
    margin: 0;
    font-size: 1.8rem;
}
.customer-display-card header span {
    color: #c4b5fd;
    font-weight: 900;
}
.customer-display-lines {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 0;
    overflow: auto;
    padding-top: 18px;
}
.customer-display-lines div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
    font-weight: 900;
}
.customer-display-lines small {
    color: #c4b5fd;
}
.customer-display-totals {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
}
.customer-display-totals div {
    display: grid;
    gap: 8px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.04);
}
.customer-display-totals span {
    color: #c4b5fd;
    font-weight: 900;
}
.customer-display-totals strong {
    font-size: 1.6rem;
}
.customer-display-totals .total strong {
    color: #86efac;
    font-size: 2rem;
}
.outline-action,
.danger-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}
.outline-action {
    border: 1px solid #7367f0;
    color: #7367f0;
}
.danger-action {
    border: 1px solid #ff4d5d;
    color: #ff3b4f;
}
.product-create-form {
    display: grid;
    gap: 18px;
}
.product-form-card {
    border-radius: 8px;
}
.product-form-grid {
    gap: 18px 28px;
}
.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.product-form-grid .field span,
.product-form-grid .checkbox-field span,
.import-form .field span,
.label-option span {
    color: #111827;
    font-size: 0.92rem;
    font-weight: 900;
}
.product-form-grid input,
.product-form-grid select,
.product-form-grid textarea,
.label-options-grid input,
.label-options-grid select,
.search-field input {
    border-radius: 0;
}
.product-form-grid small {
    color: var(--muted);
    font-size: 0.78rem;
}
.checkbox-strip {
    display: grid;
    gap: 6px;
}
.checkbox-strip p {
    margin: 0;
    color: var(--muted);
    font-style: italic;
}
.price-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
    border: 1px solid var(--line);
}
.price-grid .field {
    padding: 14px;
    border-right: 1px solid var(--line);
}
.price-grid .field:last-child {
    border-right: 0;
}
.price-grid .field span {
    margin: -14px -14px 12px;
    padding: 10px 12px;
    background: #56b65a;
    color: #fff;
}
.sticky-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1.35fr 1fr 0.9fr auto;
    gap: 8px;
    padding: 12px;
    background: rgba(232, 239, 245, 0.92);
    backdrop-filter: blur(8px);
}
.save-option {
    min-height: 54px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}
.save-option.warning {
    background: #f7b500;
}
.save-option.muted {
    background: #5d5aa7;
}
.save-option.danger {
    background: #d81459;
}
.save-option.primary {
    min-width: 110px;
    background: #6d78ff;
}
.button-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: #00a66a;
    color: #fff;
    font-weight: 900;
}
.import-card,
.price-import-card,
.labels-card {
    margin-bottom: 16px;
    border-radius: 8px;
}
.import-form {
    display: grid;
    grid-template-columns: minmax(260px, 420px) auto 1fr;
    align-items: end;
    gap: 22px;
}
.price-import-card {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 440px);
    gap: 40px;
}
.instructions-block {
    margin-top: 90px;
}
.instructions-block p {
    margin: 4px 0;
}
.labels-card h2,
.import-card h2,
.price-import-card h2 {
    margin: 0 0 18px;
    color: #202555;
    font-size: 1.15rem;
    font-weight: 500;
}
.search-field {
    display: grid;
    grid-template-columns: 48px minmax(260px, 720px);
    margin: 0 auto 18px;
    max-width: 820px;
}
.search-field span {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-right: 0;
    color: transparent;
}
.search-field span::before {
    content: "Search";
    color: #4b5563;
    font-size: 0.75rem;
}
.label-options-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    border: 1px solid var(--line);
}
.label-product-picker {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(130px, 0.5fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}
.label-option {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.label-option input[type="number"],
.label-option select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    padding: 0 12px;
}
.barcode-setting {
    max-width: 420px;
}
.form-actions.center {
    justify-content: center;
}
.button-primary.large {
    min-width: 150px;
    height: 56px;
    font-size: 1.05rem;
    font-weight: 700;
}
.label-preview-card[hidden] {
    display: none;
}
.label-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.product-label {
    display: grid;
    gap: 4px;
    min-height: 104px;
    padding: 10px;
    border: 1px solid #111827;
    border-radius: 4px;
    background: #fff;
    color: #111827;
    font-size: 0.8rem;
}
.product-label strong {
    font-size: 0.95rem;
}
.product-label b {
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid #111827;
    text-align: center;
    letter-spacing: 0.08em;
}
.stock-report-table {
    min-width: 2050px;
}
.stock-report-table tbody tr:nth-child(odd) {
    background: #f4dddd;
}
.stock-report-table tfoot th,
.stock-report-table tfoot td {
    background: #d4d8e0;
    font-weight: 900;
}
.manufacturing-card,
.manufacturing-settings-card,
.manufacturing-summary-card {
    border-radius: 8px;
}
.manufacturing-table {
    min-width: 1080px;
}
.manufacturing-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0 0;
}
.danger-action.solid {
    border-color: #ef335f;
    background: #ef335f;
    color: #fff;
}
.manufacturing-recipe-form {
    width: min(920px, calc(100vw - 360px));
}
.manufacturing-lines {
    display: grid;
    gap: 10px;
}
.manufacturing-lines h3 {
    margin: 8px 0 0;
    color: #202555;
    font-size: 1rem;
}
.manufacturing-line-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.4fr) minmax(120px, 0.4fr);
    gap: 10px;
}
.recipe-view-panel {
    color: #111827;
}
.recipe-view-panel h3 {
    margin: 0 0 8px;
}
.recipe-view-panel ul {
    margin: 6px 0 12px;
    padding-left: 18px;
}
.manufacturing-settings-form {
    display: grid;
    gap: 20px;
}
.manufacturing-settings-card {
    display: grid;
    grid-template-columns: 240px minmax(260px, 1fr) minmax(240px, 0.8fr) minmax(260px, 0.9fr);
    align-items: center;
    gap: 28px;
    padding: 0;
    overflow: hidden;
}
.settings-sidebar {
    align-self: stretch;
    display: grid;
    place-items: center;
    min-height: 84px;
    background: linear-gradient(135deg, #5c5ff0, #2f7dea);
    color: #fff;
    font-weight: 800;
}
.manufacturing-settings-card .field,
.manufacturing-settings-card .checkbox-field {
    margin: 0;
}
.manufacturing-settings-actions {
    justify-content: flex-end;
}
.manufacturing-version {
    margin: 8px 0 0 22px;
    color: var(--muted);
}
.manufacturing-version code {
    color: #e11d48;
    background: #fff;
    padding: 2px 8px;
    border-radius: 6px;
}
.manufacturing-report-filters {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(150px, 190px) minmax(150px, 190px) auto;
    justify-content: end;
    align-items: end;
    gap: 12px;
    margin-bottom: 24px;
}
.manufacturing-report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 30px;
}
.manufacturing-summary-card dl {
    margin: 0;
    display: grid;
    gap: 10px;
}
.manufacturing-summary-card div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    padding: 10px 12px;
}
.manufacturing-summary-card div:nth-child(odd) {
    background: #f7f7f7;
}
.manufacturing-summary-card dt {
    font-weight: 900;
}
.manufacturing-summary-card dd {
    margin: 0;
}
.manufacturing-report-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    gap: 36px;
    align-items: center;
    margin-bottom: 24px;
}
.report-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 0;
    color: #fff;
    font-weight: 800;
}
.report-action.cyan {
    background: #18bfd7;
}
.report-action.amber {
    background: #ffad3b;
}
.report-action.rose {
    background: #ef335f;
}
.info-dot {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #13bde5;
    color: #fff;
    font-size: 0.78rem;
}
.erp-table-scroll {
    overflow: auto;
    border-bottom: 8px solid #ddd;
    border-radius: 8px;
}
.erp-data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}
.contact-ledger-table {
    min-width: 1680px;
}
.erp-data-table th,
.erp-data-table td {
    padding: 10px 11px;
    border: 1px solid #edf0f4;
    text-align: left;
    vertical-align: middle;
}
.erp-data-table th {
    font-size: clamp(13px, 0.88vw, 16px);
    font-weight: 900;
}
.erp-data-table tbody tr:nth-child(odd) {
    background: #f7f7f7;
}
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.row-actions form {
    margin: 0;
}
.row-actions button {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: #fff;
    font-weight: 800;
}

.settings-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.settings-summary-grid p,
.muted-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}
.btn-edit {
    border: 1px solid #6d67ff;
    color: #6d67ff;
}
.btn-view {
    border: 1px solid #00a8ff;
    color: #00a8ff;
}
.btn-delete {
    border: 1px solid #ff4152;
    color: #ff4152;
}
.icon-plus-button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #00a8ff;
    border-radius: 50%;
    background: #fff;
    color: #00a8ff;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 900;
}
.erp-dialog {
    width: min(900px, calc(100vw - 32px));
    max-height: min(86vh, 760px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.erp-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}
.dialog-card {
    display: grid;
    gap: 14px;
    width: 100%;
    max-height: inherit;
    padding: 20px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
    margin: 0;
    color: var(--navy);
    font-size: clamp(1.15rem, 2vw, 1.55rem);
}
.dialog-header button {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.dialog-actions .button-primary {
    min-height: 38px;
    margin-top: 0;
}
.record-details {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
    margin: 0;
}
.record-details dt {
    color: var(--muted);
    font-weight: 800;
}
.record-details dd {
    margin: 0;
    color: var(--text);
    font-weight: 700;
}
.custom-fields-dialog {
    width: min(620px, calc(100vw - 32px));
}
.custom-field-details {
    grid-template-columns: 150px 1fr;
}
.import-card {
    display: grid;
    gap: 24px;
    margin-bottom: 18px;
}
.import-form {
    display: flex;
    align-items: flex-start;
    gap: clamp(18px, 8vw, 160px);
}
.import-form label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 800;
}
.import-form .button-primary {
    margin-top: 22px;
}
.template-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    background: #00b879;
    color: #fff;
    font-weight: 900;
}
.import-copy {
    margin: 0 0 18px;
    color: var(--text);
}
.import-instructions-table {
    min-width: 900px;
}
.erp-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    font-size: 0.9rem;
}
.pagination {
    display: flex;
}
.pagination button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}
.pagination .active {
    background: #337ab7;
    color: #fff;
}
.column-menu {
    position: absolute;
    z-index: 10;
    display: grid;
    gap: 8px;
    min-width: 240px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}
.column-menu strong {
    margin-bottom: 4px;
}
.column-menu label {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
}
.column-menu button {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}
.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* Laravel paginator template (resources/views/vendor/pagination/tailwind.blade.php). */
.erp-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.erp-pagination__meta {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.erp-pagination__meta strong { color: var(--text); font-weight: 700; }
.erp-pagination__list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.erp-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.erp-pagination__btn:hover { background: var(--surface-sunken, #f1f5f9); }
.erp-pagination__btn.is-active {
    background: var(--primary-600, #2563eb);
    border-color: var(--primary-600, #2563eb);
    color: #fff;
    cursor: default;
}
.erp-pagination__btn.is-disabled {
    color: #cbd5e1;
    background: #fff;
    cursor: not-allowed;
}
.erp-pagination__sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 34px;
    color: var(--muted);
    font-size: 13px;
}
@media (max-width: 540px) {
    .erp-pagination { flex-direction: column; align-items: stretch; }
    .erp-pagination__list { justify-content: center; }
}

.home-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
    align-items: center;
    gap: clamp(14px, 1.6vw, 24px);
    margin: calc(clamp(14px, 1.4vw, 24px) * -1) calc(clamp(14px, 1.4vw, 24px) * -1) 22px;
    padding: clamp(24px, 3vw, 42px) clamp(14px, 1.4vw, 24px) clamp(54px, 4.5vw, 76px);
    background: linear-gradient(180deg, var(--purple), var(--purple-dark));
}
.home-hero h1 {
    margin: 0;
    min-width: 0;
    color: #fff;
    font-size: clamp(24px, 2.25vw, 42px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-filters {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    justify-content: stretch;
    gap: 12px;
    min-width: 0;
}
.home-filters select,
.home-filters button,
.home-panel select,
.table-actions input,
.table-actions select {
    min-height: 44px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0 14px;
}
.home-filters select {
    min-width: 0;
    width: 100%;
}
.home-filters button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 150px;
    border-radius: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.date-filter-popover {
    position: absolute;
    z-index: 8;
    top: calc(100% + 10px);
    right: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.date-filter-popover[hidden] {
    display: none;
}
.date-filter-popover label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}
.date-filter-popover input {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: var(--panel);
    color: var(--text);
}
.date-filter-popover div {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.date-filter-popover a,
.date-filter-popover button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
}
.date-filter-popover a {
    color: var(--muted);
}
.date-filter-popover button {
    border: 0;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}
.home-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(12px, 1.2vw, 18px);
    margin-top: clamp(-56px, -3.2vw, -36px);
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}
.home-metric {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 88px;
    padding: clamp(14px, 1.1vw, 20px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.home-metric p {
    margin: 0 0 6px;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.9rem;
}
.home-metric strong {
    font-family: Consolas, monospace;
    font-size: clamp(18px, 1.15vw, 23px);
}
.metric-symbol,
.panel-icon {
    width: clamp(40px, 2.8vw, 56px);
    height: clamp(40px, 2.8vw, 56px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #e0f3ff;
    color: #0ea5e9;
    font-size: clamp(17px, 1.15vw, 23px);
}
.metric-symbol.green { background: #d8f8e4; color: #08b47b; }
.metric-symbol.yellow,
.panel-icon.yellow { background: #fff0bd; color: #ff9800; }
.metric-symbol.red { background: #ffe1e1; color: #f23b3b; }
.panel-icon.orange { background: #fff7e8; color: #ff9800; }

.home-panel {
    margin-bottom: 24px;
    padding: clamp(16px, 1.35vw, 24px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.home-panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.home-panel-title h2 {
    margin: 0;
    color: #202555;
    font-size: clamp(18px, 1.3vw, 25px);
}
.home-panel-title.split {
    justify-content: space-between;
}
.home-panel-title.split > div {
    display: flex;
    align-items: center;
    gap: 12px;
}
.home-panel-title select {
    min-width: min(280px, 100%);
}
.home-two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}
.narrow-panel {
    max-width: min(760px, 100%);
}

.sales-chart {
    display: grid;
    grid-template-columns: 62px 1fr;
    min-height: clamp(240px, 24vw, 430px);
    border-top: 1px dashed #dbe3ef;
}
.chart-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 10px 34px 0;
    color: #475569;
    text-align: right;
}
.chart-body {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    min-width: 0;
    padding: 20px 12px 40px;
    overflow-x: hidden;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 13%, #e5e7eb calc(13% + 1px));
}
.chart-point {
    width: 100%;
    min-width: 16px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}
.chart-point span {
    width: 6px;
    min-height: 2px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(180deg, #7ab7ef, #ff9b45);
}
.chart-point small {
    position: absolute;
    bottom: -28px;
    left: 50%;
    width: 82px;
    transform: translateX(-50%) rotate(-42deg);
    transform-origin: center;
    color: #475569;
    font-size: 0.68rem;
    white-space: nowrap;
}
.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.table-actions button {
    min-height: 30px;
    border: 1px solid #a9b5c7;
    border-radius: 10px;
    background: #fff;
    color: #94a0b3;
    font-weight: 700;
    font-size: 0.78rem;
}
.table-actions.toolbar {
    display: grid;
    grid-template-columns: auto repeat(5, max-content) minmax(160px, 220px);
    align-items: center;
}
.responsive-table {
    overflow: auto;
    border-bottom: 8px solid #ddd;
    border-radius: 8px;
}
.responsive-table table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    background: #fff;
}
.responsive-table th,
.responsive-table td {
    padding: 10px 11px;
    border: 1px solid #edf0f4;
    text-align: left;
    vertical-align: middle;
}
.responsive-table th {
    font-size: clamp(13px, 0.85vw, 16px);
    font-weight: 900;
}
.responsive-table tbody tr:nth-child(odd) {
    background: #fafafa;
}
.empty-row {
    text-align: center !important;
    color: var(--muted);
}
.table-footer {
    margin: 14px 0 0;
    font-size: 0.85rem;
}

.home-two-column .home-panel {
    min-width: 0;
}

.home-two-column .home-panel-title.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
    align-items: center;
}

.home-two-column .home-panel-title h2 {
    line-height: 1.1;
}

.dashboard-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 14px;
    padding: clamp(18px, 2vw, 28px);
    border-radius: 18px;
    background: linear-gradient(135deg, #24105f, #4f26c5 58%, #2563eb);
    box-shadow: 0 18px 50px rgba(45, 26, 130, 0.22);
    color: #fff;
}
.dashboard-command h1 {
    margin: 4px 0 6px;
    font-size: clamp(24px, 2vw, 34px);
    line-height: 1.05;
    letter-spacing: -0.035em;
}
.dashboard-command p,
.dashboard-command .eyebrow {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}
.eyebrow {
    display: inline-flex;
    color: #5a6480;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.dashboard-actions a,
.dashboard-section-heading a,
.dashboard-queue-card .home-panel-title a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
}
.dashboard-filter-card {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.dashboard-filter-card .home-filters {
    grid-template-columns: minmax(220px, 320px) minmax(220px, 320px);
    justify-content: start;
}
.dashboard-filter-card label,
.date-filter-wrap {
    display: grid;
    gap: 6px;
    color: #5a6480;
    font-size: 0.76rem;
    font-weight: 900;
}
.dashboard-filter-card select,
.dashboard-filter-card .date-filter-button {
    min-height: 38px;
    border-radius: 10px;
}
.date-filter-wrap {
    position: relative;
}
.date-filter-popover {
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
}
.date-presets {
    grid-column: 1 / -1;
    display: flex !important;
    justify-content: flex-start !important;
    flex-wrap: wrap;
}
.date-presets a {
    border: 1px solid #d9e1ef;
    background: #f8faff;
    color: #3c4664;
    font-weight: 800;
}
.date-actions {
    grid-column: 1 / -1;
}
.home-metrics {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-top: 0;
    margin-bottom: 14px;
}
.home-metric {
    min-height: 78px;
    border-radius: 16px;
}
.home-metric.compact {
    min-height: 66px;
    box-shadow: none;
}
.dashboard-secondary-metrics {
    margin-bottom: 16px;
}
.dashboard-secondary-metrics summary {
    width: max-content;
    cursor: pointer;
    color: #4f46e5;
    font-weight: 900;
}
.dashboard-secondary-metrics > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.dashboard-chart-panel {
    margin-bottom: 18px;
}
.dashboard-chart-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid #dfe6f2;
    border-radius: 999px;
    background: #f7f9fd;
}
.dashboard-chart-tabs button {
    min-height: 30px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #5b6478;
    font-weight: 900;
    padding: 0 12px;
}
.dashboard-chart-tabs button.active {
    background: #4f46e5;
    color: #fff;
}
.dashboard-chart-pane {
    display: none;
}
.dashboard-chart-pane.active {
    display: block;
}
.dashboard-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 12px;
}
.dashboard-section-heading h2 {
    margin: 2px 0 0;
    color: #151a35;
    font-size: clamp(20px, 1.5vw, 28px);
}
.dashboard-section-heading a,
.dashboard-queue-card .home-panel-title a {
    border-color: #d9e1ef;
    background: #fff;
    color: #4f46e5;
}
.dashboard-work-queues {
    gap: 14px;
}
.dashboard-queue-card {
    margin-bottom: 0;
}
.dashboard-queue-card .home-panel-title {
    margin-bottom: 12px;
}
.dashboard-queue-card .home-panel-title h2 {
    font-size: clamp(16px, 1vw, 19px);
}
.dashboard-queue-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 11px 0;
    border-top: 1px solid #edf1f7;
}
.dashboard-queue-row strong,
.dashboard-queue-row span {
    display: block;
}
.dashboard-queue-row strong {
    color: #182033;
    font-size: 0.92rem;
}
.dashboard-queue-row span {
    margin-top: 3px;
    color: #6b7280;
    font-size: 0.8rem;
}
.dashboard-queue-row b {
    color: #202555;
    font-size: 0.88rem;
    white-space: nowrap;
}
.dashboard-empty-state {
    display: grid;
    gap: 5px;
    place-items: center;
    min-height: 132px;
    padding: 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8faff;
    color: #697386;
    text-align: center;
}
.dashboard-empty-state strong {
    color: #202555;
    font-size: 0.98rem;
}
.chart-empty {
    flex-direction: column;
    inset: 20px;
    min-height: auto;
}
.sales-chart {
    min-height: clamp(220px, 20vw, 330px);
}
.chart-body {
    overflow-x: auto;
}

.sale-form {
    display: grid;
    gap: 14px;
}
.sale-location-strip {
    display: grid;
    grid-template-columns: 36px minmax(210px, 260px) 36px;
    width: max-content;
    max-width: 100%;
}
.sale-location-strip select,
.input-addon-row input,
.input-addon-row select,
.sale-product-picker select,
.sale-entry-card input,
.sale-entry-card select,
.sale-section-card input,
.sale-section-card select,
.sale-section-card textarea {
    min-height: 36px;
    width: 100%;
    border: 1px solid #d8dde7;
    border-radius: 0;
    background: #fff;
    color: #374151;
    font-size: 0.86rem;
    padding: 0 12px;
}
.sale-section-card textarea,
.sale-entry-card textarea {
    min-height: 76px;
    padding: 10px 12px;
    resize: vertical;
}
.sale-location-strip select,
.input-addon-row select {
    appearance: auto;
}
.addon-box,
.info-dot,
.addon-button {
    display: inline-grid;
    min-width: 36px;
    min-height: 36px;
    place-items: center;
    border: 1px solid #d8dde7;
    background: #fff;
    color: #172033;
    font-weight: 900;
}
.info-dot {
    border: 1px solid #d8dde7;
    background: #fff;
    color: #fff;
    font-size: 0.72rem;
    font-style: normal;
    position: relative;
    z-index: 0;
}
.info-dot::before {
    content: "";
    position: absolute;
    z-index: -1;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    background: #24c3e6;
}
.info-dot.inline {
    display: inline-grid;
    min-width: 16px;
    min-height: 16px;
    border: 0;
    vertical-align: middle;
}
.info-dot.inline::before {
    width: 15px;
    height: 15px;
}
.addon-button {
    border-color: #d8dde7;
    color: #0d6efd;
    font-size: 1.35rem;
    cursor: pointer;
}
.input-addon-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
}
.input-addon-row.split {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
}
.input-addon-row:not(.split):has(.addon-box):not(:has(.info-dot)):not(:has(.addon-button)) {
    grid-template-columns: 36px minmax(0, 1fr);
}
.sale-entry-card,
.sale-section-card,
.sale-lines-card {
    border-radius: 14px;
    padding: 18px 28px;
}
.sale-price-row {
    max-width: 380px;
    margin-bottom: 18px;
}
.sale-entry-grid {
    display: grid;
    grid-template-columns: minmax(300px, 1.05fr) minmax(260px, 0.9fr) minmax(300px, 1fr);
    gap: 28px;
    align-items: start;
}
.sale-customer-pane,
.sale-middle-pane,
.sale-right-pane {
    display: grid;
    gap: 14px;
}
.sale-address-block {
    display: grid;
    gap: 3px;
    min-height: 48px;
    color: #586273;
    font-size: 0.84rem;
}
.sale-address-block strong,
.sale-form .field > span {
    color: #111827;
    font-weight: 900;
}
.sale-service-staff {
    margin-top: 42px;
}
.sale-file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 106px;
    min-height: 36px;
}
.sale-file-row input {
    border-right: 0;
    padding: 6px;
}
.sale-file-row span {
    display: grid;
    place-items: center;
    background: #0d6efd;
    color: #fff;
    font-weight: 900;
    font-size: 0.84rem;
}
.sale-form small {
    color: #6b7280;
    font-size: 0.8rem;
    line-height: 1.4;
}
.sale-lines-card {
    padding-top: 22px;
}
.sale-lines-card .purchase-line-table th {
    background: #fff;
    color: #111827;
    border: 1px solid #edf0f4;
    text-align: center;
}
.sale-lines-card .purchase-line-table td {
    border: 1px solid #edf0f4;
}
.sale-lines-card .purchase-line-table .empty-row td {
    padding: 14px;
    background: #fafafa;
}
.sale-remove-heading {
    width: 64px;
    font-size: 2rem;
    line-height: 1;
}
.sale-remove-line {
    width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 8px;
    font-size: 1.15rem;
    line-height: 1;
}
.sale-lines-card .purchase-totals {
    display: flex;
    justify-content: flex-end;
    gap: 28px;
    margin: 0 0 18px;
    padding: 10px 0;
    border-bottom: 1px solid #edf0f4;
    background: #fafafa;
    font-weight: 900;
}
.sale-product-picker {
    display: grid;
    grid-template-columns: 36px minmax(280px, 1fr) 36px;
    max-width: 760px;
    margin: 0 auto 4px;
}
.sale-discount-grid,
.sale-shipping-grid,
.sale-payment-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 14px 28px;
    align-items: start;
}
.sale-summary-note {
    align-self: end;
    min-height: 36px;
    padding-top: 9px;
    color: #111827;
    font-weight: 900;
}
.sale-note-field,
.sale-payment-note {
    grid-column: 1 / -1;
}
.sale-expense-row {
    grid-column: 1 / 3;
    display: flex;
    justify-content: center;
    align-self: end;
}
.sale-expense-row .button-primary {
    min-height: 34px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 0.84rem;
}
.sale-payable-note {
    align-self: end;
    justify-self: end;
    color: #111827;
    font-weight: 900;
}
.sale-payment-card h2 {
    margin: 0 0 18px;
    color: #26235d;
    font-size: 1.05rem;
}
.advance-balance {
    grid-column: 1 / -1;
    font-weight: 900;
}
.sale-divider {
    grid-column: 1 / -1;
    height: 1px;
    margin: 14px 0;
    background: #9ca3af;
}
.change-return {
    display: grid;
    gap: 5px;
}
.change-return b {
    font-size: 1.25rem;
}
.balance-note {
    grid-column: 1 / -1;
    justify-self: end;
    font-weight: 900;
}
.sale-save-actions {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 0 24px;
}
.sale-save-actions .button-primary,
.sale-save-actions .button-success {
    min-width: 78px;
    min-height: 58px;
    border-radius: 8px;
    font-size: 0.95rem;
}
.sales-filter-card {
    padding: 0;
    overflow: hidden;
}
.sales-filter-card summary {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 0 16px;
    list-style: none;
    cursor: pointer;
}
.sales-filter-card summary::-webkit-details-marker {
    display: none;
}
.sales-filter-card .purchase-filter-grid {
    padding: 0 16px 16px;
}
.sales-list-card {
    padding: 16px 18px 20px;
}
.sales-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.sales-list-header h2 {
    margin: 0;
    color: #202555;
    font-size: 1.05rem;
    font-weight: 500;
}
.sales-list-header .floating-add {
    position: static;
}
.sales-table-wrap {
    overflow: auto;
    border-bottom: 8px solid #a3a3a3;
    border-radius: 8px;
}
.sales-register-table {
    min-width: 1920px;
    font-size: 0.76rem;
}
.sales-register-table th,
.sales-register-table td {
    padding: 9px 7px;
    line-height: 1.25;
}
.sales-register-table th {
    color: #111827;
    font-size: 0.76rem;
    white-space: nowrap;
}
.sales-register-table td {
    color: #0f172a;
}
.sales-register-table .action-menu summary {
    min-height: 24px;
    padding: 3px 9px;
    border-color: #00a8ff;
    border-radius: 5px;
    color: #008fdf;
    font-size: 0.7rem;
}
.sales-register-table .action-menu summary::after {
    content: "⌄";
    margin-left: 4px;
}
.sales-status {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
}
.sales-status.due {
    background: #f59e0b;
}
.sales-status.partial {
    background: #06b6d4;
}
.sales-status.paid {
    background: #7bd95d;
}
.sales-status.neutral {
    background: #94a3b8;
}
.sales-total-row {
    background: #d0d5dd !important;
    font-weight: 800;
}
.sales-total-row td {
    padding-top: 12px;
    padding-bottom: 12px;
    border-color: #eef1f5;
    vertical-align: middle;
}
.sales-total-row span {
    display: block;
    margin: 2px 0;
    font-weight: 500;
}
.tag-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.68rem;
    font-weight: 700;
}
.discount-bulk-actions {
    margin-top: 10px;
}
.sales-register-table .row-actions .outline-action,
.sales-register-table .row-actions .danger-action {
    min-height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.68rem;
}
.page-heading h1 small {
    margin-left: 8px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
}
.report-filter-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}
.report-filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 360px) auto;
    gap: 10px;
    align-items: end;
}
.report-filter-form > .field span {
    display: none;
}
.report-date-menu {
    position: relative;
}
.report-date-menu summary {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 7px;
    background: #6d67ff;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    list-style: none;
    cursor: pointer;
}
.report-date-menu summary::-webkit-details-marker {
    display: none;
}
.report-date-panel {
    position: absolute;
    right: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 150px 150px auto auto;
    gap: 8px;
    min-width: 520px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}
.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.report-summary-card h2 {
    margin: 0 0 12px;
    color: #25275d;
    font-size: 1rem;
    font-weight: 500;
}
.report-metric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 10px 12px;
    background: #f7f7f7;
    font-size: 0.82rem;
}
.report-metric-row + .report-metric-row {
    margin-top: 8px;
}
.report-overall {
    margin-bottom: 16px;
}
.report-overall p {
    margin: 7px 0;
    color: #4b5563;
    font-size: 1.15rem;
}
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 12px;
    background: #fff;
    border-radius: 8px 8px 0 0;
}
.report-tabs span,
.report-tabs a {
    padding: 12px 16px;
    border-top: 3px solid transparent;
    color: #111827;
    font-weight: 700;
    text-decoration: none;
}
.report-tabs span.active,
.report-tabs a.active {
    border-top-color: #2386c8;
    color: #25275d;
}
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 16px;
}
.report-kpi-grid article {
    display: grid;
    gap: 12px;
    container-type: inline-size;
    min-width: 0;
}
.report-kpi-grid span {
    color: #111827;
    font-size: 0.84rem;
}
.report-kpi-grid strong {
    color: #25275d;
    font-size: clamp(0.95rem, 7cqw, 1.35rem);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
@supports not (container-type: inline-size) {
    .report-kpi-grid strong { font-size: clamp(0.95rem, 1.4vw, 1.35rem); }
}

@media (max-width: 1100px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .auth-identity {
        min-height: 320px;
    }
    .erp-app {
        grid-template-columns: 1fr;
    }
    .erp-sidebar {
        position: static;
        height: auto;
        max-height: 50vh;
    }
    .erp-topbar {
        position: sticky;
    }
    .home-hero,
    .home-filters,
    .dashboard-command,
    .dashboard-filter-card .home-filters {
        grid-template-columns: 1fr;
    }
    .dashboard-actions {
        justify-content: flex-start;
    }
    .home-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 0;
    }
    .table-actions.toolbar {
        grid-template-columns: 1fr;
    }
    .erp-table-toolbar {
        grid-template-columns: 1fr;
    }
    .report-filter-form,
    .report-summary-grid,
    .report-kpi-grid {
        grid-template-columns: 1fr;
    }
    .report-date-panel {
        position: static;
        min-width: 0;
        grid-template-columns: 1fr;
    }
    .three-columns,
    .price-grid,
    .price-import-card,
    .label-options-grid,
    .label-product-picker,
    .manufacturing-line-grid,
    .manufacturing-settings-card,
    .manufacturing-report-filters,
    .manufacturing-report-grid,
    .manufacturing-report-actions,
    .purchase-filter-grid,
    .purchase-filter-grid.compact,
    .purchase-form-grid,
    .purchase-product-picker,
    .sale-entry-grid,
    .sale-discount-grid,
    .sale-shipping-grid,
    .sale-payment-grid,
    .inline-payment-form,
    .purchase-detail-grid,
    .pos-layout,
    .pos-product-grid,
    .sticky-form-actions,
    .import-form {
        grid-template-columns: 1fr;
    }
    .sale-location-strip {
        width: 100%;
        grid-template-columns: 36px minmax(0, 1fr) 36px;
    }
    .sale-expense-row,
    .sale-note-field,
    .sale-payment-note,
    .advance-balance,
    .sale-divider,
    .balance-note {
        grid-column: auto;
    }
    .compact-heading,
    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .purchase-form-grid .two-column {
        grid-column: auto;
    }
    .price-grid .field,
    .label-option {
        border-right: 0;
    }
    .list-card-header,
    .erp-table-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .add-record-form {
        position: static;
        width: 100%;
        margin-top: 12px;
    }
    .product-add-record .add-record-form {
        width: 100%;
    }
    .manufacturing-recipe-form {
        width: 100%;
    }
    .inline-edit-form {
        position: fixed;
        inset: 16px;
        width: auto;
        overflow: auto;
    }
}

@media (max-width: 720px) {
    .auth-page {
        padding: 0;
    }
    .auth-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }
    .auth-identity {
        padding: 22px;
    }
    .auth-identity h1 {
        font-size: 1.75rem;
    }
    .auth-status-grid {
        grid-template-columns: 1fr;
    }
    .auth-card {
        padding: 24px;
    }
    .auth-card-header {
        margin-bottom: 22px;
    }
    .erp-topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .topbar-spacer {
        display: none;
    }
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .topbar-date {
        display: none;
    }
    .home-hero h1 {
        white-space: normal;
    }
    .home-metrics {
        grid-template-columns: 1fr;
    }
    .dashboard-actions,
    .dashboard-chart-tabs,
    .dashboard-section-heading {
        align-items: stretch;
        flex-direction: column;
    }
    .dashboard-actions a {
        width: 100%;
    }
    .date-filter-popover {
        width: min(100%, calc(100vw - 32px));
        grid-template-columns: 1fr;
    }
    .home-panel-title.split,
    .home-two-column .home-panel-title.split {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
.home-panel-title.split {
        flex-direction: column;
    }
}

.kitchen-actions {
    display: flex;
    gap: 10px;
}

.kitchen-screen {
    display: grid;
    gap: 14px;
}

.kitchen-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #dde2ec;
    border-radius: 14px;
    padding: 10px;
}

.kitchen-toolbar a {
    text-decoration: none;
    border: 1px solid #d8dfea;
    color: #344054;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.84rem;
    font-weight: 600;
}

.kitchen-toolbar a.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #5f58f7, #3f7ef5);
}

.kitchen-auto-refresh-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #475467;
    font-weight: 600;
}

.kitchen-auto-refresh-toggle + .kitchen-auto-refresh-toggle {
    margin-left: 8px;
}

.kitchen-refresh-countdown {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #d8dfea;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475467;
    background: #f8faff;
}

.kitchen-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.kitchen-ticket {
    border: 1px solid #e3e8f3;
    border-radius: 16px;
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 10px;
}

.kitchen-ticket.pending { border-left: 5px solid #f59e0b; }
.kitchen-ticket.preparing { border-left: 5px solid #3b82f6; }
.kitchen-ticket.ready { border-left: 5px solid #10b981; }
.kitchen-ticket.served { border-left: 5px solid #64748b; }

.kitchen-ticket header,
.kitchen-ticket footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.kitchen-ticket h3 {
    margin: 0;
    font-size: 1rem;
}

.kitchen-ticket p {
    margin: 0;
    color: #475467;
    font-size: 0.86rem;
}

.kitchen-ticket ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
    font-size: 0.85rem;
}

.kitchen-ticket footer form {
    margin: 0;
}

.kitchen-ticket footer button {
    white-space: nowrap;
    min-width: 82px;
    padding: 8px 10px;
}

.kitchen-empty {
    grid-column: 1 / -1;
    border: 1px dashed #c8d2e4;
    background: #fff;
    border-radius: 16px;
    padding: 48px 20px;
    text-align: center;
    color: #667085;
    font-weight: 600;
}

.orders-page-actions {
    display: flex;
    gap: 10px;
}

.orders-filter-panel,
.orders-board-card {
    background: #fff;
    border: 1px solid #dde2ec;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.orders-filter-form label {
    display: grid;
    gap: 6px;
    max-width: 340px;
}

.orders-filter-form span {
    font-size: 0.82rem;
    font-weight: 700;
    color: #344054;
}

.orders-filter-form select {
    height: 40px;
    border-radius: 10px;
    border: 1px solid #cfd7e4;
    padding: 0 12px;
    font-size: 0.9rem;
}

.orders-board-card h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1d2d63;
}

.orders-empty {
    margin: 18px 0 6px;
    text-align: center;
    color: #475467;
    font-size: 1rem;
}

.orders-grid {
    margin-top: 14px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.orders-ticket {
    border: 1px solid #e1e7f2;
    border-left: 5px solid #f59e0b;
    border-radius: 12px;
    padding: 12px;
    display: grid;
    gap: 8px;
    background: #fdfdff;
}

.orders-ticket.preparing { border-left-color: #3b82f6; }
.orders-ticket.ready { border-left-color: #10b981; }
.orders-ticket.served { border-left-color: #64748b; }
.orders-ticket.cancelled { border-left-color: #dc2626; }

.orders-ticket header,
.orders-ticket footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.orders-ticket p {
    margin: 0;
    font-size: 0.85rem;
    color: #475467;
}

.orders-ticket ul {
    margin: 0;
    padding-left: 18px;
    font-size: 0.83rem;
    display: grid;
    gap: 4px;
}

.orders-ticket footer a {
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    color: #4f46e5;
}

.notification-page {
    display: grid;
    gap: 16px;
}

.notification-group-card {
    background: #fff;
    border: 1px solid #dde3ee;
    border-radius: 14px;
    padding: 18px;
}

.notification-group-card h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: #1d2d63;
}

.notification-tab-list {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #e4e8f1;
    margin-bottom: 12px;
}

.notification-tab-list button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: #fff;
    padding: 10px 16px;
    font-size: 0.95rem;
    color: #334155;
    cursor: pointer;
}

.notification-tab-list button.active {
    color: #1d4ed8;
    border-bottom-color: #3b82f6;
}

.notification-template-panel {
    display: none;
    gap: 12px;
}

.notification-template-panel.active {
    display: grid;
}

.template-tags strong {
    display: block;
    margin-bottom: 4px;
}

.template-tags p {
    margin: 0 0 6px;
    color: #4b5563;
}

.template-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-editor-shell {
    border: 1px solid #d5dce8;
    border-radius: 8px;
    overflow: hidden;
}

.template-editor-toolbar {
    border-bottom: 1px solid #dfe5ef;
    background: #f9fbff;
    padding: 9px 12px;
    color: #475569;
    font-size: 0.85rem;
}

.template-editor-shell textarea {
    border: 0;
    border-radius: 0;
    min-height: 160px;
}

.template-auto-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding-top: 4px;
}

.template-auto-flags label {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 0.95rem;
}

.template-warning {
    border-left: 4px solid #d48a00;
    background: #fbb040;
    color: #fff;
    border-radius: 4px;
    padding: 10px 12px;
    font-weight: 600;
}

.notification-save-row {
    display: flex;
    justify-content: center;
}

.notification-save-row .button-primary.danger {
    background: #ff5861;
    border-color: #ff5861;
    min-width: 110px;
    height: 52px;
}

.settings-card {
    margin-bottom: 14px;
}

.settings-card .button-primary,
.page-actions .button-primary {
    margin-top: 0;
}

.settings-add-button {
    margin-top: 0;
}

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dce3ee;
    margin-bottom: 12px;
}

.settings-tabs button {
    border: 1px solid transparent;
    border-bottom: 0;
    background: #fff;
    color: #2f80c9;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.settings-tabs button.active {
    color: #1f2d5d;
    border-color: #dce3ee;
    border-radius: 6px 6px 0 0;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: block;
}

.settings-business-card {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 26px;
    background: #fff;
    border: 1px solid #dbe2ec;
    border-radius: 8px;
    padding: 24px;
}

.settings-inner-tabs {
    border: 1px solid #d5dbe5;
    align-self: start;
}

.settings-inner-tabs button {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #d5dbe5;
    background: #fff;
    padding: 12px 10px;
    font-weight: 700;
    color: #344054;
    cursor: default;
}

.settings-inner-tabs button.active {
    background: linear-gradient(135deg, #6258f2, #357ef1);
    color: #fff;
}

.settings-business-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 24px;
}

.settings-business-content {
    min-width: 0;
}

.settings-tab-heading {
    margin-bottom: 14px;
    border-bottom: 1px solid #e4e8f1;
    padding-bottom: 10px;
}

.settings-tab-heading h2 {
    margin: 0;
    color: #1d2d63;
    font-size: 1.05rem;
}

.settings-check-field {
    align-self: end;
    min-height: 40px;
}

.settings-wide-field {
    grid-column: 1 / -1;
}

.settings-save-row {
    display: flex;
    justify-content: center;
    padding: 24px 0 8px;
}

.settings-save-row .button-primary.danger {
    background: #ff5861;
    border-color: #ff5861;
    min-width: 150px;
    height: 54px;
}

.subscription-active {
    background: #fff;
    border: 1px solid #dbe2ec;
    border-radius: 8px;
    padding: 26px 34px;
}

.subscription-active h2,
.settings-card h2 {
    margin: 0 0 14px;
    color: #1d2d63;
    font-size: 1.05rem;
}

.subscription-plan-card {
    width: min(420px, 100%);
    border: 1px solid #edf0f5;
    border-top: 3px solid #10b981;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    text-align: center;
    padding: 18px;
}

.subscription-plan-card header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
    border-bottom: 1px solid #edf0f5;
    margin: -18px -18px 18px;
    padding: 18px;
}

.subscription-plan-card header strong {
    font-size: 1.15rem;
    color: #1d2d63;
}

.subscription-plan-card header span {
    background: #20c987;
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.subscription-plan-card p {
    margin: 4px 0;
}

/* ----- erp-ux: modal dismiss icon ----- */
.erp-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.06);
    color: #1f2937;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.erp-modal-close:hover { background: rgba(0,0,0,.12); }
[data-theme="dark"] .erp-modal-close { background: rgba(255,255,255,.08); color: #f3f4f6; }
[data-theme="dark"] .erp-modal-close:hover { background: rgba(255,255,255,.16); }

/* ----- erp-ux: bulk-select toolbar ----- */
.erp-bulk-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #111827;
    color: #f9fafb;
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    font-size: 14px;
}
.erp-bulk-bar .erp-bulk-count { font-weight: 600; }
.erp-bulk-bar .erp-bulk-actions { display: flex; gap: 8px; }
.erp-bulk-bar .erp-bulk-actions button,
.erp-bulk-bar .erp-bulk-actions [data-bulk-action] {
    background: #374151;
    color: #f9fafb;
    border: 0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.erp-bulk-bar .erp-bulk-actions [data-bulk-action]:hover { background: #4b5563; }
.erp-bulk-bar .erp-bulk-actions [data-bulk-action].danger { background: #b91c1c; }
.erp-bulk-bar .erp-bulk-actions [data-bulk-action].danger:hover { background: #dc2626; }

/* ----- print/export polish (PDF + window.print) ----- */
@media print {
    @page { size: A4; margin: 14mm 12mm; }
    body { background: #fff !important; color: #000 !important; }
    .app-sidebar, .app-topbar, .erp-sidebar, .erp-topbar, .erp-bulk-bar,
    .action-menu, details.action-menu, .warehouse-subnav, .page-actions,
    .side-sheet, .side-sheet-backdrop, form .toolbar-select, .btn, .btn-primary,
    .pagination, .erp-card-head form,
    .no-print, [data-print="hide"] { display: none !important; }
    .app-main, .app-content, .erp-main, .erp-content { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
    .erp-card { box-shadow: none !important; border: 1px solid #e5e7eb !important; page-break-inside: avoid; }
    .erp-card-head { padding: 8px 0 !important; border-bottom: 1px solid #ccc; margin-bottom: 8px; }
    table { width: 100% !important; border-collapse: collapse !important; font-size: 10pt; }
    table th, table td { padding: 4px 6px !important; border-bottom: 1px solid #e5e7eb !important; vertical-align: top; }
    table th { background: #f3f4f6 !important; text-transform: uppercase; letter-spacing: 0.04em; font-size: 9pt; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    a { color: #000 !important; text-decoration: none !important; }
    .num, td.num, th.num { text-align: right !important; font-variant-numeric: tabular-nums; }
    /* Hide the kebab action column when present. */
    th:last-child:empty, td:last-child:has(details.action-menu) { display: none !important; }
}

/* ---------- V-figure helpers (App\Support\Figure) ---------- */
.erp-figure { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.erp-figure-arrow { font-size: 0.75em; line-height: 1; opacity: 0.9; }
.erp-figure-good { color: #137333; }
.erp-figure-bad { color: #b3261e; }
.erp-figure-flat { color: #555; }

/* Subtle tinted backgrounds when wrapped in a table cell or pill */
.erp-figure-pill { padding: 2px 8px; border-radius: 999px; }
.erp-figure-pill.erp-figure-good { background: rgba(19, 115, 51, 0.08); }
.erp-figure-pill.erp-figure-bad { background: rgba(179, 38, 30, 0.08); }
.erp-figure-pill.erp-figure-flat { background: rgba(85, 85, 85, 0.06); }

@media (prefers-color-scheme: dark) {
    .erp-figure-good { color: #4ade80; }
    .erp-figure-bad { color: #f87171; }
    .erp-figure-flat { color: #9ca3af; }
}

/* ===========================================================
   Row virtualization via content-visibility.
   Tables with `data-virtualize-rows` defer off-screen row layout
   to the browser, eliminating freezes when scrolling through
   tables with 500+ rows. Chrome 85+/Edge/Firefox 125+/Safari 18+.
   ----------------------------------------------------------- */
table[data-virtualize-rows] tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: auto 38px; /* one row, used while off-screen */
}
/* Cap rows that should initially render server-side.
   `data-virtualize-rows="N"` is a hint to controllers; the CSS rule
   above applies regardless and is the actual perf win. */

/* ============================================================
   Profile page (resources/views/profile/edit.blade.php)
   ============================================================ */
.profile-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 640px;
}
.profile-card {
    /* Inherits erp-card token styling; just constrain width. */
    width: 100%;
}
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}
@media (max-width: 540px) {
    .profile-grid { grid-template-columns: 1fr; }
}
.form-stack-foot {
    margin-top: 1.25rem;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

/* ============================================================
   Token-aware form-error banner
   Replaces inline `style="color:#c00"` patterns. Adapts to
   dark mode via --tone-bad / --tone-bad-bg.
   ============================================================ */
.form-error-banner {
    margin-bottom: 1rem;
    padding: 12px 14px;
    background: var(--tone-bad-bg);
    color: var(--tone-bad);
    border: 1px solid color-mix(in srgb, var(--tone-bad) 35%, transparent);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
}
.form-error-banner strong { display: block; margin-bottom: 4px; }
.form-error-banner ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ============================================================
   Dark-mode overrides — biggest erp-shell.css offenders
   Each rule below had a hardcoded light value that fell through
   to dark mode unchanged. Map to tokens so they adapt.
   ============================================================ */
[data-theme="dark"] .auth-shell { background: var(--surface-panel); color: var(--text); }
[data-theme="dark"] .auth-identity { background: var(--surface-raised); border-color: var(--border-default); color: var(--text); }
[data-theme="dark"] .erp-form-group { background: var(--surface-panel); color: var(--text); border-color: var(--border-default); }

/* Category catalog table (.cat-table, .cat-bulk-header, .cat-hint-info) */
[data-theme="dark"] .cat-table { background: var(--surface-panel); border-color: var(--border-default); color: var(--text); }
[data-theme="dark"] .cat-bulk-header { background: var(--surface-raised); border-color: var(--border-default); }
[data-theme="dark"] .cat-hint-info { background: var(--tone-info-bg); color: var(--tone-info); }

/* Product card meta (.product-card__meta) */
[data-theme="dark"] .product-card__meta { color: var(--text-muted); border-top-color: var(--border-default); }

/* Field help text — was hardcoded to specific grays */
[data-theme="dark"] .field-help { color: var(--text-muted); }
[data-theme="dark"] .field-help.error { color: var(--tone-bad); }
[data-theme="dark"] .field-help.success { color: var(--tone-good); }

/* ============================================================
   Combobox (data-combobox <select> enhancement)
   Base styling — was previously missing, so the dropdown menu
   rendered without dimensions and felt broken.
   ============================================================ */
.cbx-wrap {
    position: relative;
    display: block;
}
.cbx-wrap .cbx-input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border-default, var(--line, #d1d5db));
    border-radius: var(--r-sm, 6px);
    background: var(--surface-panel, var(--panel, #fff));
    color: var(--text, #0f172a);
    font: inherit;
    line-height: 1.3;
    outline: none;
}
.cbx-wrap .cbx-input:focus {
    border-color: var(--brand-500, #4a1db8);
    box-shadow: var(--ring, 0 0 0 3px rgba(74, 29, 184, .15));
}
.cbx-wrap .cbx-menu {
    display: none;
    /* position/top/left/width/z-index are set by JS (position:fixed in
       viewport coords) so the menu escapes ancestor overflow:hidden and
       never sits behind the topbar/sidebar. */
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface-raised, var(--panel, #fff));
    border: 1px solid var(--border-default, var(--line, #d1d5db));
    border-radius: var(--r-sm, 6px);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, .18));
    padding: 4px;
}
.cbx-wrap.cbx-open .cbx-menu { display: block; }
.cbx-option {
    padding: 7px 10px;
    border-radius: 4px;
    font-size: var(--fs-sm, 14px);
    color: var(--text, #0f172a);
    cursor: pointer;
    user-select: none;
}
.cbx-option:hover,
.cbx-option.is-active {
    background: var(--surface-sunken, #f1f5f9);
}
.cbx-empty {
    padding: 10px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: var(--fs-sm, 13px);
}

/* ============================================================
   Tail of dark-mode rescue — table whites the override layer missed.
   These are common patterns: tbody rows on white surface, zebra
   stripes, sticky table heads.
   ============================================================ */
[data-theme="dark"] .erp-table,
[data-theme="dark"] .erp-data-table,
[data-theme="dark"] .data-table,
[data-theme="dark"] .listing-table {
    background: var(--surface-panel);
    color: var(--text);
}
[data-theme="dark"] .erp-table th,
[data-theme="dark"] .erp-data-table th,
[data-theme="dark"] .data-table th,
[data-theme="dark"] .listing-table th,
[data-theme="dark"] table th {
    background: var(--surface-sunken);
    color: var(--text-muted);
    border-color: var(--border-default);
}
[data-theme="dark"] .erp-table td,
[data-theme="dark"] .erp-data-table td,
[data-theme="dark"] .data-table td,
[data-theme="dark"] .listing-table td,
[data-theme="dark"] table td {
    background: transparent;
    color: var(--text);
    border-color: var(--border-default);
}
[data-theme="dark"] .erp-table tbody tr:nth-child(even),
[data-theme="dark"] table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-sunken) 50%, transparent);
}
[data-theme="dark"] .erp-table tbody tr:hover,
[data-theme="dark"] table tbody tr:hover {
    background: var(--surface-raised);
}

/* Table wrappers (often a card around the table that stayed white) */
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .erp-table-wrap,
[data-theme="dark"] .table-card,
[data-theme="dark"] .erp-table-card,
[data-theme="dark"] .list-card {
    background: var(--surface-panel);
    border-color: var(--border-default);
    color: var(--text);
}

/* ============================================================
   Tail fix: zebra-striped rows in .erp-data-table.
   The light-mode rule at line ~2757 sets `tr:nth-child(odd)` to
   #f7f7f7. Without this override, that bright gray persists in
   dark mode (the rows the user reported as 'still white').
   ============================================================ */
[data-theme="dark"] .erp-data-table tbody tr:nth-child(odd) {
    background: color-mix(in srgb, var(--surface-sunken) 60%, transparent);
}
[data-theme="dark"] .erp-data-table tbody tr:nth-child(even) {
    background: transparent;
}
[data-theme="dark"] .erp-data-table tbody tr:hover {
    background: var(--surface-raised);
}
[data-theme="dark"] .erp-data-table th,
[data-theme="dark"] .erp-data-table td {
    border-color: var(--border-default);
}

/* Bulk-action bar above tables (.cat-bulk + .erp-bulk-bar) */
[data-theme="dark"] .cat-bulk,
[data-theme="dark"] .erp-bulk-bar {
    background: var(--surface-raised);
    border-color: var(--border-default);
    color: var(--text);
}
[data-theme="dark"] .cat-bulk strong { color: var(--tone-info); }

/* erp-table-scroll wrapper (sometimes white card behind table) */
[data-theme="dark"] .erp-table-scroll,
[data-theme="dark"] .erp-table-footer {
    background: transparent;
    color: var(--text);
}

/* Trial banner + flash + filter chips visible above many tables */
[data-theme="dark"] .trial-banner,
[data-theme="dark"] .flash-banner--info,
[data-theme="dark"] .alert-info,
[data-theme="dark"] .info-banner {
    background: var(--tone-info-bg);
    color: var(--tone-info);
    border-color: color-mix(in srgb, var(--tone-info) 35%, transparent);
}
[data-theme="dark"] .alert-warn,
[data-theme="dark"] .flash-banner--warn,
[data-theme="dark"] .warn-banner {
    background: var(--tone-warn-bg);
    color: var(--tone-warn);
    border-color: color-mix(in srgb, var(--tone-warn) 35%, transparent);
}

/* ============================================================
   Aggressive dark-mode coverage — final pass.
   Some legacy rules use higher specificity (#id-style or
   compound class selectors) that the earlier override layer
   couldn't beat without resorting to !important. Use sparingly
   and only on background/color/border for stubborn surfaces.
   ============================================================ */
[data-theme="dark"] .erp-data-table tbody tr,
[data-theme="dark"] .erp-data-table tbody tr:nth-child(odd),
[data-theme="dark"] .erp-data-table tbody tr:nth-child(even) {
    background-color: transparent !important;
}
[data-theme="dark"] .erp-data-table tbody tr:nth-child(odd) td {
    background-color: var(--surface-sunken) !important;
    color: var(--text) !important;
}
[data-theme="dark"] .erp-data-table tbody tr:nth-child(even) td {
    background-color: var(--surface-panel) !important;
    color: var(--text) !important;
}
[data-theme="dark"] .erp-data-table tbody tr:hover td {
    background-color: var(--surface-raised) !important;
}
[data-theme="dark"] .erp-data-table thead th {
    background-color: var(--surface-sunken) !important;
    color: var(--text-muted) !important;
}

/* Generic <table> catch — same treatment for any other table */
[data-theme="dark"] .erp-card table tbody tr,
[data-theme="dark"] section table tbody tr {
    background-color: transparent !important;
}
[data-theme="dark"] .erp-card table tbody tr:nth-child(odd) td,
[data-theme="dark"] section table tbody tr:nth-child(odd) td {
    background-color: var(--surface-sunken) !important;
    color: var(--text) !important;
}
[data-theme="dark"] .erp-card table tbody tr:nth-child(even) td,
[data-theme="dark"] section table tbody tr:nth-child(even) td {
    background-color: var(--surface-panel) !important;
    color: var(--text) !important;
}

/* erp-card the table sits inside */
[data-theme="dark"] .erp-card,
[data-theme="dark"] .erp-list-card,
[data-theme="dark"] .erp-table-scroll {
    background-color: var(--surface-panel) !important;
    color: var(--text) !important;
    border-color: var(--border-default) !important;
}

/* Mini-nav (HRM / manufacturing subnav pills). Originally lived in
   app-shell.css which the layout doesn't load, so on prod the HRM page
   rendered as plain text. Moved here so it actually ships. */
.mini-nav {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}
.subnav-bar {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    margin: 4px 0 20px !important;
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    scrollbar-width: thin;
}
.mini-nav-link {
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px;
    padding: 9px 18px !important;
    border-radius: 999px !important;
    background: var(--surface-panel, #ffffff) !important;
    color: var(--text-default, #111827) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
    border: 1px solid var(--border-default, #e2e8f0) !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.mini-nav-link::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--border-default, #cbd5e1);
    transition: background-color .15s ease, transform .15s ease;
    flex: 0 0 6px;
}
.mini-nav-link:hover {
    background: var(--surface-sunken, #f1f5f9) !important;
    color: var(--accent-600, #0057cc) !important;
    border-color: var(--accent-500, #006cff) !important;
    box-shadow: 0 3px 8px rgba(0, 87, 204, 0.15);
}
.mini-nav-link:hover::before {
    background: var(--accent-500, #006cff);
}
.mini-nav-link:active { transform: translateY(1px); }
.mini-nav-link.active {
    background: linear-gradient(180deg, var(--accent-500, #006cff), var(--accent-600, #0057cc)) !important;
    color: #ffffff !important;
    border-color: var(--accent-600, #0057cc) !important;
    box-shadow: 0 4px 10px rgba(0, 87, 204, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.mini-nav-link.active::before {
    background: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.mini-nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 108, 255, 0.35);
}
button.mini-nav-link { font-family: inherit; cursor: pointer; }
[data-theme="dark"] .mini-nav-link {
    background: var(--surface-panel, #111a2e) !important;
    color: var(--text-default, #e2e8f0) !important;
    border-color: var(--border-default, #1f2a44) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .mini-nav-link::before { background: var(--border-default, #334155); }
[data-theme="dark"] .mini-nav-link:hover {
    background: var(--surface-raised, #172238) !important;
    color: #60a5fa !important;
    border-color: #2563eb !important;
}
[data-theme="dark"] .mini-nav-link.active {
    background: linear-gradient(180deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
