/* =============================================================================
   POS Application Stylesheet — V23.0 Tailscale Fingerprint
   Ultra-clean, minimal borders, airy spacing
   ============================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* =============================================================================
   1. PAGE LOAD & TRANSITION EFFECTS
   ============================================================================= */

/* Anti-flash: hide body until page is fully ready */
html.lang-loading body { opacity: 0 !important; }
html.lang-ready body { opacity: 1; transition: opacity 0.15s ease-in; }

/* Page transition overlay — prevents white flash between pages */
#page-transition-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--color-background, #f5f5f5);
    z-index: 999999; pointer-events: none;
    opacity: 0; transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
#page-transition-overlay.active { opacity: 1; }
body.page-loading { overflow: hidden; }

/* =============================================================================
   2. ANIMATIONS & KEYFRAMES
   ============================================================================= */

/* Content & rows — no opacity animations (prevents flashing) */
.pos-main, main { opacity: 1; }
.product-table tbody tr, .sales-list tr { opacity: 1; }
.pos-card, .summary-card, .stat-card { transition: box-shadow 0.15s ease; }

/* Modal open/close — scale + fade */
@keyframes modalOpen {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal[style*="display: block"], .modal[style*="display:block"],
#purchase-modal[style*="display: block"], #purchase-modal[style*="display:block"],
#detail-modal[style*="display: block"], #detail-modal[style*="display:block"] {
    animation: modalOpen 0.2s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Smooth dropdown/select interactions */
select, input, textarea {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Active nav link — instant highlight, no jarring change */
.nav-btn {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease !important;
}
.nav-btn:active {
    transform: scale(0.97);
    transition: transform 0.08s ease !important;
}

/* Toast slide-in */
@keyframes toastSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
#toast-notification.show {
    animation: toastSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Skeleton loading placeholder */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-row td {
    background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-border) 50%, var(--color-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 3px;
    color: transparent !important;
    user-select: none;
}
.skeleton-row td * { visibility: hidden; }

/* =============================================================================
   3. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================= */
:root {
    /* ── Navigation ── */
    --nav-bg: #ffffff;
    --nav-bg-flat: #ffffff;
    --nav-bg-hover: #f9fafb;
    --nav-active-bg: transparent;
    --nav-text: #6b6b70;
    --nav-text-active: #1d1d1f;

    /* ── Core Palette — monochrome BLACK accent (modern, unified) ── */
    --color-primary: #1d1d1f;
    --color-primary-dark: #000000;
    --color-primary-light: #f1f1f3;
    --color-primary-glow: rgba(0, 0, 0, 0.06);
    --color-on-primary: #ffffff;   /* text/icon sitting on a primary-filled surface */

    --color-green: #059669;
    --color-green-dark: #047857;
    --color-green-light: #ecfdf5;
    --color-green-glow: rgba(5, 150, 105, 0.06);

    --color-red: #dc2626;
    --color-red-dark: #b91c1c;
    --color-red-light: #fef2f2;
    --color-red-glow: rgba(220, 38, 38, 0.06);

    --color-amber: #d97706;
    --color-amber-light: #fffbeb;
    --color-amber-glow: rgba(217, 119, 6, 0.06);
    --color-amber-border: #fcd34d;

    --color-green-border: #a7f3d0;
    --color-red-border: #fecaca;

    --color-cyan: #0891b2;
    --color-violet: #7c3aed;
    --color-violet-light: #f5f3ff;
    --color-orange: #e67e22;
    --color-orange-light: #fff7ed;

    /* ── Text & Surface — Tailscale's near-monochrome ── */
    --color-text: #1d1d1f;
    --color-text-secondary: #6b6b70;
    --color-text-muted: #a1a1a6;
    --color-background: #f5f5f7;
    --color-surface: #ffffff;
    --color-border: #e4e4e7;
    --color-border-light: #ededf0;

    /* ── Typography — Cairo primary (Arabic-first UI), system stack as fallback ── */
    --font-main: 'Cairo', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Arabic', 'Segoe UI', system-ui, sans-serif;
    --font-arabic: 'Cairo', 'Segoe UI Arabic', 'Segoe UI', system-ui, sans-serif;

    /* ── Shadows — subtle depth cues ── */
    --shadow-xs: 0 0 0 .5px rgba(0,0,0,0.03), 0 1px 1px rgba(0,0,0,0.04);
    --shadow-sm: 0 0 0 .5px rgba(0,0,0,0.035), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 0 0 .5px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 0 0 .5px rgba(0,0,0,0.04), 0 10px 28px rgba(0,0,0,0.08);
    --shadow-xl: 0 0 0 .5px rgba(0,0,0,0.05), 0 20px 48px rgba(0,0,0,0.12);

    /* ── Shape — crisp, near-square corners (user preference: ~square).
       lg/xl kept tiny so cards/panels/modals are square too; pills stay round. ── */
    /* ONE unified radius for every rectangular element — inputs, buttons, cards, panels,
       toolbars, modals — so shapes read as a single system across all tabs. Pills/circles
       (--radius-pill, 50%) stay round. */
    --radius-sm: 10px;
    --radius: 10px;
    --radius-lg: 10px;
    --radius-xl: 10px;
    --radius-pill: 100px;
    --transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-spring: all 0.28s cubic-bezier(0.34, 1.32, 0.64, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* ── Airy spacing scale ── */
    --space-xs: 4px;
    --space-sm: 6px;
    --space-md: 10px;
    --space-lg: 14px;
    --space-xl: 20px;

    /* ── Fixed Sizing ── */
    --input-height: 28px;
    --btn-height: 28px;
    --btn-height-sm: 24px;

    /* ── Global accent for native controls ── */
    accent-color: var(--color-primary);
}

/* =============================================================================
   3b. DARK MODE — flips the design tokens; every surface built on the CSS
   variables adapts automatically. Toggled by `theme-dark` on <html>.
   ============================================================================= */
:root.theme-dark {
    --nav-bg: #1c1c1e;
    --nav-bg-flat: #1c1c1e;
    --nav-bg-hover: #2c2c2e;
    --nav-active-bg: transparent;
    --nav-text: #a1a1a6;
    --nav-text-active: #f2f2f7;

    --color-primary: #f2f2f7;   /* accent inverts to near-white on dark surfaces */
    --color-primary-dark: #d1d1d6;
    --color-primary-light: #2c2c2e;
    --color-primary-glow: rgba(255, 255, 255, 0.10);
    --color-on-primary: #1d1d1f;

    --color-green: #10b981;
    --color-green-dark: #059669;
    --color-green-light: #13291f;
    --color-green-glow: rgba(16, 185, 129, 0.10);
    --color-green-border: #1e5340;

    --color-red: #f87171;
    --color-red-dark: #ef4444;
    --color-red-light: #2b1618;
    --color-red-glow: rgba(248, 113, 113, 0.10);
    --color-red-border: #5e2b2b;

    --color-amber: #f0a53a;
    --color-amber-light: #2a2010;
    --color-amber-glow: rgba(240, 165, 58, 0.10);
    --color-amber-border: #5c4519;

    --color-cyan: #22b8cf;
    --color-violet: #a78bfa;
    --color-violet-light: #241f33;
    --color-orange: #f0894a;
    --color-orange-light: #2a1c12;

    --color-text: #f2f2f7;
    --color-text-secondary: #b4b4bb;
    --color-text-muted: #9a9aa1;
    --color-background: #1c1c1e;
    --color-surface: #2c2c2e;
    --color-border: #3a3a3c;
    --color-border-light: #323234;

    --shadow-xs: 0 0 0 .5px rgba(0,0,0,0.5), 0 1px 1px rgba(0,0,0,0.4);
    --shadow-sm: 0 0 0 .5px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 0 0 .5px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 0 0 .5px rgba(0,0,0,0.5), 0 10px 28px rgba(0,0,0,0.55);
    --shadow-xl: 0 0 0 .5px rgba(0,0,0,0.6), 0 20px 48px rgba(0,0,0,0.6);

    color-scheme: dark;
}
:root.theme-dark body { background-color: var(--color-background); color: var(--color-text); }

/* =============================================================================
   4. BASE RESET & TYPOGRAPHY
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: var(--font-main); }

body {
    font-family: var(--font-main);
    direction: rtl;
    background-color: var(--color-background);
    color: var(--color-text);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    line-height: 1.4;
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Removed contain:style — it was causing rendering glitches and flash-through */
img { content-visibility: auto; }

/* Thin OUTLINE icons app-wide — match the reference's clean line-icon look.
   FILL 0 = outline (not filled); lighter weight = thinner strokes. The `span.`
   selector out-specifies Google's base .material-symbols-rounded regardless of
   stylesheet load order. */
span.material-symbols-rounded,
span.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
/* Lucide SVG icons — icons.js swaps the Material glyph for a Lucide SVG (exact
   reference icon design). The SVG sizes to the element's font-size and inherits
   its color via stroke=currentColor. */
.material-symbols-rounded > svg.lucide-svg,
.material-symbols-outlined > svg.lucide-svg {
    width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0;
}

/* =============================================================================
   5. NAVIGATION (Header, Topbar, Nav Buttons)
   ============================================================================= */
.pos-container { display: flex; flex-direction: column; height: 100%; }

.pos-header {
    background: var(--nav-bg);
    color: var(--color-text);
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    flex-shrink: 0;
    position: relative;
    height: 42px;
    border-bottom: 1px solid var(--color-border);
}

.header-brand { display: flex; align-items: center; gap: 8px; }
.pos-header h1 {
    font-size: 0.8rem; font-weight: 700; margin: 0;
    color: var(--color-text); letter-spacing: 0;
}

.mobile-menu-btn {
    display: none; background: transparent; border: none; font-size: 1.3rem;
    color: var(--color-text); cursor: pointer; padding: 4px;
}

/* Nav: Tailscale-style — clean icons + text, subtle active */
.main-nav { display: flex; gap: 0; align-items: stretch; height: 100%; }
.main-nav .nav-btn {
    color: var(--nav-text); text-decoration: none;
    padding: 0 8px; height: 100%;
    font-weight: 500; font-size: 0.78rem;
    transition: color 0.15s ease;
    white-space: nowrap; line-height: 40px;
    display: inline-flex; align-items: center; gap: 3px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.main-nav .nav-btn .material-symbols-rounded {
    font-size: 1rem;
    font-variation-settings: 'wght' 300, 'FILL' 0, 'opsz' 20;
    opacity: 0.7;
}
.main-nav .nav-btn.active {
    color: var(--nav-text-active);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}
.main-nav .nav-btn.active .material-symbols-rounded { opacity: 1; }
.main-nav .nav-btn:hover:not(.active) {
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-bottom-color: var(--color-primary-glow);
}
.main-nav a[style*="margin-right: auto"] {
    background: var(--color-red) !important;
    color: white !important; margin-right: 0 !important; margin-left: auto;
    border-radius: var(--radius); border-bottom: 2px solid transparent !important;
    padding: 0 14px !important; height: 34px; line-height: 34px; align-self: center;
    font-size: 0.78rem !important;
}

/* =============================================================================
   6. LAYOUT COMPONENTS (Containers, Grid, Flex)
   ============================================================================= */
.pos-main, .warehouse-main, .report-main {
    display: flex; flex: 1; padding: 12px; gap: 10px; overflow: hidden; align-items: stretch;
}
.warehouse-main { display: flex; flex-direction: row; align-items: stretch; overflow: hidden; }
.product-list-panel { flex: 1 1 0%; display: flex; flex-direction: column; overflow: hidden; padding: 10px 12px; min-width: 0; }
.product-form-panel { flex: 0 0 440px; overflow-y: auto; padding: 12px 14px; }
.settings-panel {
    background: var(--color-surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--color-border);
    padding: 10px; height: auto !important; overflow: visible !important;
}
.control-panel {
    flex: 0 0 33%; max-width: 33%; display: flex; flex-direction: column;
    gap: 6px; overflow-y: auto; padding-bottom: 6px;
    background: transparent !important; border: none !important; box-shadow: none !important;
}
.sales-panel { flex: 0 0 67%; max-width: 67%; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.report-main { overflow-y: auto; flex-direction: column; }
.settings-user-section { display: flex; gap: 10px; padding: 0; }

/* =============================================================================
   7. CARDS & PANELS
   ============================================================================= */
.product-list-panel, .product-form-panel, .control-panel > div, .settings-form-container,
.report-filters, .report-content-wrapper, .sales-panel {
    background: var(--color-surface); border-radius: var(--radius-lg);
    border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
}

/* =============================================================================
   8. FORM ELEMENTS (Inputs, Selects, Textareas)
   ============================================================================= */
.form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.form-row .form-group { flex: 1; min-width: 0; }
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 500;
    color: var(--color-text-secondary); font-size: 0.72rem;
    letter-spacing: normal;
}
input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], input[type="datetime-local"],
select, textarea {
    width: 100%; height: var(--input-height); padding: 0 10px; font-size: 0.78rem;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background-color: var(--color-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    color: var(--color-text); line-height: normal;
    appearance: none; -webkit-appearance: none;
    font-weight: 500;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M3 5l3 3 3-3H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
    padding-left: 28px;
    cursor: pointer;
    accent-color: var(--color-primary);
}
select option {
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-surface);
    line-height: 1.5;
    min-height: 28px;
}
select option:checked,
select option:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}
select:hover {
    border-color: var(--color-text-muted);
}
textarea { height: auto; padding: 6px 8px; min-height: 50px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); }
input:disabled, select:disabled { background-color: var(--color-border-light); cursor: not-allowed; color: var(--color-text-muted); }
.form-group-row { display: flex; gap: 8px; }
.form-group-row .form-group { flex: 1; }
#fees-section input[type="number"] { text-align: center; font-weight: 600; }
#delivery-fee-input { color: var(--color-green); border-color: var(--color-green-border); background-color: var(--color-green-light); }
#discount-input { color: var(--color-red); border-color: var(--color-red-border); background-color: var(--color-red-light); }

/* =============================================================================
   9. BUTTONS
   ============================================================================= */
.btn {
    height: var(--btn-height); padding: 0 12px; font-size: 0.78rem; font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
    font-family: var(--font-main); transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; gap: 5px; line-height: 1; white-space: nowrap;
    letter-spacing: 0; box-shadow: var(--shadow-xs);
}
.btn:hover { box-shadow: var(--shadow-sm); }

.btn-primary { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-dark { background: var(--color-text); color: var(--color-surface); border-color: var(--color-text); }
.btn-dark:hover { background: var(--color-text-secondary); border-color: var(--color-text-secondary); }

.btn-danger { background: var(--color-red); color: white; border-color: var(--color-red); }
.btn-danger:hover { background: var(--color-red-dark); border-color: var(--color-red-dark); }
.btn-danger-outline { background: var(--color-red-light); color: var(--color-red); border: 1px solid var(--color-red); }
.btn-danger-outline:hover { background: var(--color-red); color: white; }

.btn-secondary {
    background: var(--color-surface); color: var(--color-text);
    border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

.btn-outline {
    background: var(--color-surface); color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

.btn-full-width { width: 100%; }

/* Small buttons */
.btn-small, .product-table .btn-small-pay, .product-table .btn-edit, .product-table .btn-view {
    height: var(--btn-height-sm); padding: 0 8px; font-size: 0.7rem;
    border-radius: var(--radius); border: 1px solid var(--color-border);
    cursor: pointer; font-family: var(--font-main);
    margin-left: 3px; color: var(--color-text-secondary); font-weight: 500;
    background: var(--color-surface); transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
}
.product-table .btn-small-pay:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }
.product-table .btn-edit:hover, .product-table .btn-view:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }

.btn-delete, .btn-small-cancel, .product-table .btn-small-cancel, .product-table .btn-delete {
    height: var(--btn-height-sm); padding: 0 8px; font-size: 0.7rem;
    border-radius: var(--radius); margin-left: 3px; font-weight: 500; cursor: pointer;
    background: var(--color-red); color: white !important; border: 1px solid var(--color-red);
    transition: var(--transition); font-family: var(--font-main);
    display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.btn-delete:hover, .btn-small-cancel:hover { background: var(--color-red-dark); border-color: var(--color-red-dark); }
.btn-delete-item {
    width: 26px; height: 26px; font-size: 0.78rem; margin: 0 auto; padding: 0;
    background: var(--color-red-light) !important; color: var(--color-red) !important; border: 1px solid var(--color-red) !important;
    border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
}
.btn-delete-item:hover { background: var(--color-red) !important; color: white !important; }

/* =============================================================================
   10. TABLES
   ============================================================================= */
.table-container {
    flex: 1; overflow: auto; border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); background: var(--color-surface);
}
.product-table { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 0.78rem; overflow: hidden; }
.product-table th, .product-table td {
    padding: 5px 10px; text-align: start;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.78rem; white-space: nowrap;
    font-weight: 500; line-height: 1.4;
}
.product-table th {
    background: var(--color-background);
    font-weight: 600; color: var(--color-text-secondary);
    position: sticky; top: 0; font-size: 0.68rem;
    letter-spacing: 0; z-index: 5;
    border-bottom: 1px solid var(--color-border);
    padding: 5px 10px;
}
.product-table tbody tr { transition: background 0.1s; cursor: pointer; }
.product-table tbody tr:hover { background: var(--color-background); }
.product-table tfoot td { font-weight: 700; font-size: 0.78rem; background: var(--color-background); border-top: 1px solid var(--color-border); }
/* ── Warehouse product table: 14-column layout ──
   No. | SKU | Product | Cost | Unit Price | Box Price | Wholesale | Whole-WS | Stock | Alert | Unit | Category | Country | Actions
   The Product-name column is the dominant one (wraps to 2–3 lines); money columns
   never wrap; every value is shown in full and the columns fit the table width. */
.warehouse-products-table { table-layout: fixed; }
.warehouse-products-table thead th {
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
}
.warehouse-products-table tbody tr:nth-child(even) { background: var(--color-background); }
.warehouse-products-table tbody tr:hover { background: var(--color-background); }

/* 1 — product number */
.warehouse-products-table th:nth-child(1), .warehouse-products-table td:nth-child(1) {
    width: 4%; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default;
}
/* 2 — SKU: wraps so the whole code is readable */
.warehouse-products-table th:nth-child(2), .warehouse-products-table td:nth-child(2) {
    width: 9%; white-space: normal; word-break: break-all; overflow-wrap: anywhere;
    font-size: 0.74rem; color: var(--color-text-muted); line-height: 1.4;
}
/* 3 — PRODUCT NAME: the dominant column, wraps to 2–3 lines, full name always shown */
.warehouse-products-table th:nth-child(3), .warehouse-products-table td:nth-child(3) {
    width: 24%; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
    line-height: 1.4; font-weight: 600; text-align: start;
}
/* 4–8 — money columns: right-aligned, tabular, single line (full number always shown) */
.warehouse-products-table th:nth-child(4), .warehouse-products-table td:nth-child(4),
.warehouse-products-table th:nth-child(5), .warehouse-products-table td:nth-child(5),
.warehouse-products-table th:nth-child(6), .warehouse-products-table td:nth-child(6),
.warehouse-products-table th:nth-child(7), .warehouse-products-table td:nth-child(7),
.warehouse-products-table th:nth-child(8), .warehouse-products-table td:nth-child(8) {
    text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.8rem;
}
.warehouse-products-table th:nth-child(4), .warehouse-products-table td:nth-child(4) { width: 8%; }
.warehouse-products-table th:nth-child(5), .warehouse-products-table td:nth-child(5) { width: 7%; }
.warehouse-products-table th:nth-child(6), .warehouse-products-table td:nth-child(6) { width: 8%; }
.warehouse-products-table th:nth-child(7), .warehouse-products-table td:nth-child(7) { width: 6%; }
.warehouse-products-table th:nth-child(8), .warehouse-products-table td:nth-child(8) { width: 6%; }
/* 9 — stock (box/unit breakdown, may be 2 lines) */
.warehouse-products-table th:nth-child(9), .warehouse-products-table td:nth-child(9) {
    width: 8%; white-space: normal; line-height: 1.4;
}
/* 10 — alert */
.warehouse-products-table th:nth-child(10), .warehouse-products-table td:nth-child(10) {
    width: 4%; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* 11–13 — unit / category / country: wrap so the full label shows */
.warehouse-products-table th:nth-child(11), .warehouse-products-table td:nth-child(11),
.warehouse-products-table th:nth-child(12), .warehouse-products-table td:nth-child(12),
.warehouse-products-table th:nth-child(13), .warehouse-products-table td:nth-child(13) {
    white-space: normal; text-align: center; line-height: 1.35; overflow-wrap: anywhere;
}
.warehouse-products-table th:nth-child(11), .warehouse-products-table td:nth-child(11) { width: 5%; }
.warehouse-products-table th:nth-child(12), .warehouse-products-table td:nth-child(12) { width: 6%; }
.warehouse-products-table th:nth-child(13), .warehouse-products-table td:nth-child(13) { width: 5%; }
/* 14 — actions */
.warehouse-products-table th:nth-child(14), .warehouse-products-table td:nth-child(14) {
    width: 4%; text-align: center; white-space: nowrap;
}
.product-table td { vertical-align: middle; }

/* ── Resolution-adaptive sizing (customers run everything from small laptops to 4K) ──
   The table never shrinks below a legible width; on wide screens it fills the space
   (proportional columns + sticky header), and on narrower laptops it scrolls
   horizontally instead of squishing the columns. Phones (≤768px) use cards instead. */
.warehouse-products-table { min-width: 1060px; }
@media (max-width: 1100px) {
    .wh-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* Denser cells on common laptop widths so all 14 columns fit comfortably */
@media (max-width: 1440px) {
    .warehouse-products-table th, .warehouse-products-table td { padding-top: 8px; padding-bottom: 8px; padding-inline: 9px; }
}
@media (max-width: 1280px) {
    .warehouse-products-table { font-size: 0.78rem; }
    .warehouse-products-table th, .warehouse-products-table td { padding-inline: 7px; }
    .warehouse-products-table td:nth-child(4), .warehouse-products-table td:nth-child(5),
    .warehouse-products-table td:nth-child(6), .warehouse-products-table td:nth-child(7),
    .warehouse-products-table td:nth-child(8) { font-size: 0.76rem; }
}

/* ── Warehouse: product-detail MODAL (opens centered like the purchases edit window) ── */
#wh-detail-modal { width: 94%; max-width: 700px; padding: 0; }
#detail-content { padding: 16px 20px; }
.wh-detail-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}
.wh-detail-head h2 { font-size: 1rem; margin: 0; font-weight: 700; color: var(--color-text); }
.wh-detail-flow { display: block; }
/* Read-only fields flow as a calm multi-column sheet instead of one tall column */
#detail-content #product-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 9px 14px; align-items: end;
}
#detail-content #product-form > .form-group-row,
#detail-content #product-form > .wh-span,
#detail-content #product-form > hr,
#detail-content #product-form > .form-buttons,
#detail-content #product-form > #edit-redirect-msg { grid-column: 1 / -1; }
#detail-content #product-form > .form-group-row { display: flex; gap: 18px; margin: 0; }
#detail-content #product-form > .form-group-row > .form-group { flex: 1; }
#detail-content #product-form > hr { margin: 4px 0; border: none; border-top: 1px solid var(--color-border); }
#detail-content #product-images-section { margin-top: 14px; border-top: none !important; padding-top: 0 !important; }
/* On wide screens the image gallery sits beside the detail fields */
@media (min-width: 760px) {
    .wh-detail-flow { display: flex; gap: 24px; align-items: flex-start; }
    .wh-detail-flow > #product-form { flex: 1 1 auto; min-width: 0; }
    .wh-detail-flow > #product-images-section {
        flex: 0 0 210px; margin-top: 0;
        border-inline-start: 1px solid var(--color-border) !important; padding-inline-start: 20px !important;
    }
}

/* Invoices table widths are defined by the class-based .col-* block below
   (8 columns). The old positional nth-child(1..9) block was removed — it was
   written for a defunct 9-column layout and skewed the current columns. */

/* Stock display badges */
.stock-detail { display: inline-flex; align-items: center; gap: 2px; margin-inline-end: 6px; }
.stock-badge {
    display: inline-block; font-weight: 600; font-size: 0.78rem; padding: 3px 8px;
    border-radius: var(--radius-sm); min-width: 20px; text-align: center;
}
.stock-badge.box { background: var(--color-primary-light); color: var(--color-primary); }
.stock-badge.unit { background: var(--color-background); color: var(--color-text-secondary); }
.stock-lbl { font-size: 0.78rem; color: var(--color-text-secondary); }
.stock-total { display: block; font-size: 0.78rem; color: var(--color-text-muted); margin-top: 1px; }

/* =============================================================================
   11. POS SALES LIST
   ============================================================================= */
.sales-list-header {
    display: grid; grid-template-columns: 40% 15% 18% 17% 10%; padding: 5px 10px; font-weight: 500;
    border-bottom: 1px solid var(--color-border); background: var(--color-surface); gap: 3px;
    font-size: 0.7rem; color: var(--color-text-muted); letter-spacing: 0;
}
.sales-list-body { flex: 1; overflow-y: auto; padding: 0; }
.sales-item {
    display: grid; grid-template-columns: 33% 25% 15% 17% 10%; padding: 4px 10px;
    border-bottom: 1px solid var(--color-border-light); font-size: 0.68rem; gap: 3px;
    align-items: center; transition: background 0.1s; font-weight: 400;
}
.sales-item:hover { background: var(--color-primary-light); }
.sales-item .product-name-cell { text-align: left !important; white-space: normal !important; word-wrap: break-word !important; line-height: 1.5; display: block; width: 100%; }
.sales-item span:first-child { text-align: left !important; white-space: normal !important; }
.sales-total {
    padding: 8px 10px; border-top: 1px solid var(--color-border);
    background: var(--color-surface); text-align: left;
}
.sales-total h3 { font-size: 1rem; font-weight: 700; color: var(--color-primary); font-variant-numeric: tabular-nums; }
#barcode-input { text-align: start; font-size: 0.8rem; }
.item-qty-wrapper input, .item-price-wrapper input { padding: 2px 4px; font-size: 0.68rem; height: 24px; }
.item-stock-hint, .item-cost-hint { font-size: 0.78rem; margin-top: 2px; }

/* POS cart — merged quantity steppers ( − input + unit ) with smart unit labels */
.sales-item .item-qty-wrapper { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.qty-stepper { display: flex; align-items: center; gap: 2px; }
.qty-stepper input.qty-box, .qty-stepper input.qty-unit {
    width: 40px; height: 26px; padding: 2px; font-size: 0.82rem; text-align: center;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-surface); color: var(--color-text); -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-step {
    width: 24px; height: 26px; flex: 0 0 auto; padding: 0;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-background); color: var(--color-text);
    font-size: 1rem; font-weight: 700; line-height: 1; cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: center;
}
.qty-step:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }
.qty-step:active { transform: scale(0.92); }
.qty-unit-lbl { font-size: 0.68rem; color: var(--color-text-secondary); margin-inline-start: 2px; white-space: nowrap; }
.qty-size-badge { font-size: 0.7em; background: var(--color-amber, #d97706); color: #fff; padding: 1px 6px; border-radius: 3px; margin-inline-start: 4px; font-weight: 700; }

/* Per-line price tier toggle ( عادي / جملة / ج.الجملة ) inside a cart line */
.pos-tier-toggle { display: inline-flex; margin-top: 5px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.pos-tier-btn {
    font-size: 0.68rem; padding: 3px 8px; border: none; line-height: 1.2; cursor: pointer;
    background: var(--color-surface); color: var(--color-text-secondary);
    border-inline-start: 1px solid var(--color-border);
}
.pos-tier-btn:first-child { border-inline-start: none; }
.pos-tier-btn:hover { background: var(--color-background); }
.pos-tier-btn.active { background: var(--color-primary); color: var(--color-on-primary); font-weight: 700; }
.transaction-type {
    display: flex; background: var(--color-background); border-radius: var(--radius);
    padding: 3px; margin-bottom: 6px; border: 1px solid var(--color-border);
}
.transaction-type input[type="radio"] { display: none; }
.transaction-type label {
    flex: 1; text-align: center; padding: 5px; font-weight: 500; font-size: 0.76rem;
    color: var(--color-text-secondary); border-radius: var(--radius); cursor: pointer;
    transition: var(--transition);
}
.transaction-type input[type="radio"]:checked + label {
    background: var(--color-surface); color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}

/* =============================================================================
   12. LOGIN PAGE
   ============================================================================= */
.login-body {
    height: 100vh; width: 100vw; overflow: hidden; margin: 0;
    background: #0a0f22;
    background-image: url('login-bg.svg?v=2');
    background-size: cover; background-position: center center;
    background-repeat: no-repeat;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.login-body::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(8, 12, 28, 0.35) 0%, rgba(10, 20, 45, 0.12) 50%, rgba(8, 12, 28, 0.4) 100%);
    z-index: 1;
}
.login-body::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.35) 100%);
    z-index: 2;
}
.login-container {
    position: relative !important; top: auto !important; left: auto !important;
    /* Compact login card */
    transform: none !important;
    z-index: 500; width: 90%; max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    padding: 32px 30px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: loginCardAppear 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes loginCardAppear {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-form { padding: 0 !important; }
.login-form h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; color: var(--color-text); letter-spacing: 0; }
.login-form .form-group { margin-bottom: 10px; }
.login-form .form-group label { font-weight: 600; color: var(--color-text); font-size: 0.78rem; }
.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
    height: 38px; font-size: 0.78rem; font-weight: 500;
    border-radius: var(--radius-sm); border: 1.5px solid var(--color-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-form input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.login-form .btn-primary {
    height: 40px !important; font-size: 0.8rem !important; font-weight: 700 !important;
    border-radius: var(--radius-sm) !important; letter-spacing: 0;
    background: var(--color-text) !important; color: var(--color-surface) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
}
.login-form .btn-primary:hover {
    background: #1a1a2e !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-1px);
}
.login-form .btn-outline {
    height: 38px !important; font-size: 0.78rem !important; font-weight: 600 !important;
    border-radius: var(--radius-sm) !important; border: 1.5px solid var(--color-border) !important;
}

/* Login page language toggle — glass effect */
#login-lang-toggle button {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600 !important;
    transition: all 0.2s ease;
}
#login-lang-toggle button:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: white !important;
}

/* Signup form in login — glass card */
#tenant-signup-form {
    animation: loginCardAppear 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Forgot password modal on login page */
.login-body .modal-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
}
.login-body .modal-content {
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

/* =============================================================================
   13. BADGES & STATUS INDICATORS
   ============================================================================= */
.status-paid { color: var(--color-green); font-weight: 600; }
.status-pending { color: var(--color-amber); font-weight: 600; }
.status-overdue { color: var(--color-red); font-weight: 600; }
.search-container { margin-bottom: 12px; }
#invoice-search, #rfq-search { font-size: 0.8rem; }

/* =============================================================================
   14. REPORT & SETTINGS PAGES
   ============================================================================= */
.report-filters { padding: 10px 14px; }
.report-content-wrapper { padding: 14px; min-height: 200px; }
.settings-form-container { padding: 10px; margin-bottom: 8px; border-radius: var(--radius-lg); }

/* =============================================================================
   15. MODALS & OVERLAYS
   ============================================================================= */
.modal-overlay, #modal-overlay, #transfer-modal-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 2000; backdrop-filter: blur(2px);
}
.modal, #transfer-modal, #supplier-modal, #customer-modal, #rep-modal, .modal-content, #expense-modal {
    display: none; position: fixed !important; top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important; z-index: 2001 !important;
    background: var(--color-surface); padding: 14px 16px; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 580px; max-height: 90vh;
    overflow-y: auto; margin: 0 !important;
    border: 1px solid var(--color-border);
}
.modal-content h3 { margin-bottom: 10px; color: var(--color-text); font-size: 0.92rem; font-weight: 600; letter-spacing: 0; }
.show-modal { display: block !important; }
.modal-content select { text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Customers / Suppliers / Representatives — wide all-detail tables + detail shown as a modal */
.entity-table { min-width: 900px; }
.entity-table th, .entity-table td { white-space: nowrap; }
@media (max-width: 1000px) { .entity-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; } }
.entity-detail-modal { max-width: 820px !important; width: 92% !important; padding: 18px !important; }
.entity-detail-modal .table-container { overflow-x: auto; }

/* =============================================================================
   16. TOAST NOTIFICATIONS
   ============================================================================= */
#toast-notification {
    visibility: hidden; opacity: 0; min-width: 200px;
    background: var(--color-text); color: var(--color-surface); text-align: center;
    border-radius: var(--radius-lg); padding: 6px 12px; position: fixed; z-index: 99999;
    left: 50%; transform: translateX(-50%); top: -60px;
    font-size: 0.68rem; font-weight: 600; box-shadow: var(--shadow-lg);
    transition: top 0.3s ease, opacity 0.2s ease;
}
#toast-notification.show { visibility: visible; opacity: 1; top: 14px; }
#toast-notification.error { background: var(--color-red); }
#toast-notification.store-order { background: var(--color-primary); text-align: right; min-width: 320px; padding: 10px 16px; font-size: 0.82rem; }
.suggestion-item, .customer-suggestion-item { padding: 7px 10px; cursor: pointer; font-size: 0.88rem; border-inline-start: 3px solid transparent; transition: none; }
.suggestion-item.sg-expired { background: var(--color-red-light); }
.suggestion-item.sg-near-expiry { background: var(--color-red-light); }
.suggestion-item.sg-low-stock { background: var(--color-amber-light); }
.suggestion-item:hover, .suggestion-item.active,
.customer-suggestion-item:hover, .customer-suggestion-item.active { background: var(--color-primary-light) !important; border-inline-start-color: var(--color-primary); }

/* Unified dropdown/suggestion list style — matches customer list design */
.dropdown-list {
    position: absolute; top: 100%; left: 0; width: 100%;
    z-index: 10000; background: var(--color-surface); border: 1px solid var(--color-border); border-top: none;
    max-height: 400px; overflow-y: auto; box-shadow: var(--shadow-md);
    border-radius: 0 0 var(--radius) var(--radius);
}
.dropdown-list-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--color-border-light);
    font-size: 0.88rem; display: flex; justify-content: space-between; align-items: center;
    transition: background 0.1s;
}
.dropdown-list-item:last-child { border-bottom: none; }
.dropdown-list-item:hover, .dropdown-list-item.active {
    background-color: var(--color-primary-light); border-inline-end: 3px solid var(--color-primary);
}
.dropdown-list-item .item-secondary {
    font-size: 0.8rem; color: var(--color-text-secondary); direction: ltr;
}
.dropdown-list-empty {
    padding: 12px 14px; font-size: 0.85rem; color: var(--color-text-muted); text-align: center;
}

/* =============================================================================
   17. SWITCHES & TOGGLES
   ============================================================================= */
.switch-group {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--color-border);
    margin-bottom: 0; background: transparent;
    transition: var(--transition);
}
.switch-group:last-child { border-bottom: none; }
.switch-group:hover { background: transparent; }
.switch-label { font-weight: 500; color: var(--color-text); font-size: 0.68rem; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--color-border); transition: .2s ease; border-radius: 22px;
}
.slider:before {
    position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
    background: white; transition: .2s ease; border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
input:checked + .slider { background: var(--color-primary); }
input:checked + .slider:before { transform: translateX(18px); }

/* =============================================================================
   18. STAT CARDS
   ============================================================================= */
.stats-row { display: flex; gap: 6px; margin: 0 0 6px 0; }
.stat-card {
    flex: 1; background: var(--color-surface); padding: 6px 10px;
    border-radius: var(--radius); border: 1px solid var(--color-border);
    transition: var(--transition); box-shadow: var(--shadow-xs);
}
.stat-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.stat-card .stat-label { color: var(--color-text-secondary); font-size: 0.62rem; margin-bottom: 1px; font-weight: 500; text-transform: none; letter-spacing: normal; }
.stat-card .stat-value { font-size: 1rem; font-weight: 700; color: var(--color-text); letter-spacing: 0; font-variant-numeric: tabular-nums; line-height: 1.25; }

.stat-card.danger { border-right: 3px solid var(--color-red); }
.stat-card.danger .stat-value { color: var(--color-red); }
.stat-card.success { border-right: 3px solid var(--color-green); }
.stat-card.success .stat-value { color: var(--color-green); }

/* =============================================================================
   19. FILTER BARS & SEARCH
   ============================================================================= */
.filter-bar {
    display: flex; gap: 8px; background: var(--color-surface); padding: 10px 12px;
    border-radius: var(--radius-lg); border: 1px solid var(--color-border);
    align-items: center; margin-bottom: 14px;
    flex-wrap: wrap;
}
.filter-bar input, .filter-bar select { height: var(--input-height); padding: 0 10px; font-size: 0.8rem; }
.filter-bar .btn { height: var(--btn-height-sm); padding: 0 12px; font-size: 0.76rem; }

/* =============================================================================
   20. TEMPLATE SELECTOR
   ============================================================================= */
.template-grid { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.template-option {
    border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 6px;
    cursor: pointer; width: 90px; text-align: center; transition: var(--transition); font-size: 0.78rem;
}
.template-option:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.template-option.selected {
    border-color: var(--color-primary); background: var(--color-primary-light); font-weight: 500;
    box-shadow: 0 0 0 1px var(--color-primary);
}
.template-preview {
    height: 42px; background: var(--color-background); margin-bottom: 5px;
    border-radius: var(--radius); display: flex; align-items: center;
    justify-content: center; font-size: 0.68rem; color: var(--color-text-muted);
}

/* =============================================================================
   21. CURRENCY OPTIONS
   ============================================================================= */
.currency-options.disabled { opacity: 0.5; pointer-events: none; filter: grayscale(1); }

/* =============================================================================
   22. FORM BUTTONS
   ============================================================================= */
.form-buttons { margin-top: 8px; display: flex; gap: 5px; }
.form-buttons .btn { flex: 1; }

/* =============================================================================
   23. ACCORDION
   ============================================================================= */
.accordion-header {
    padding: 5px 8px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    cursor: pointer; font-weight: 600; font-size: 0.68rem;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px; transition: var(--transition); color: var(--color-text);
}
.accordion-header:hover { background: var(--color-primary-light); color: var(--color-primary); }

/* =============================================================================
   24. POS-SPECIFIC COMPONENTS (Control Panel, Inputs, Checkout)
   ============================================================================= */
.control-panel { gap: 12px !important; }
.pos-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 14px 16px;
    transition: var(--transition); box-shadow: var(--shadow-xs);
}
.pos-card:hover { box-shadow: var(--shadow-sm); border-color: var(--color-border); }
.pos-card-header {
    display: flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.pos-card-header .material-symbols-rounded { color: var(--color-primary); font-size: 1rem; }
.pos-card-title { font-size: 0.82rem; font-weight: 600; color: var(--color-text); text-transform: none; letter-spacing: normal; }
.pos-label { display: block; font-weight: 600; font-size: 0.7rem; color: var(--color-text-secondary); margin-bottom: 4px; text-transform: none; letter-spacing: normal; }
.pos-label-sm { display: block; font-weight: 500; font-size: 0.64rem; color: var(--color-text-muted); margin-bottom: 2px; }

.pos-input-main {
    width: 100%; height: var(--input-height); padding: 0 10px; font-size: 0.88rem;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background: var(--color-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-weight: 400;
}
.pos-input-main:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); outline: none; }

.pos-input-num {
    width: 100%; height: var(--input-height); padding: 0 8px; font-size: 0.88rem; font-weight: 500; text-align: center;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background: var(--color-surface);
    font-variant-numeric: tabular-nums;
}
.pos-input-sm {
    width: 100%; height: var(--btn-height-sm); padding: 0 6px; font-size: 0.78rem;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background: var(--color-surface);
    font-weight: 400;
}
.pos-select {
    width: 100%; height: var(--input-height); padding: 0 8px; font-size: 0.88rem; font-weight: 400;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background: var(--color-surface); cursor: pointer;
    padding-left: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M3 5l3 3 3-3H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 8px center;
}

.pos-btn-add {
    width: 100%; margin-top: 4px; height: var(--btn-height); font-size: 0.85rem; font-weight: 500;
    background: var(--color-primary); color: var(--color-on-primary); border: none; border-radius: var(--radius);
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.pos-btn-add:hover { background: var(--color-primary-dark); }

.pos-input-fee {
    width: 100%; height: var(--input-height); padding: 0 8px; font-size: 0.88rem; font-weight: 500; text-align: center;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-main); background: var(--color-surface); color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.pos-input-fee:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 2px var(--color-primary-glow); }

.pos-tax-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--color-background); padding: 8px 12px; border-radius: var(--radius);
    margin-top: 6px; border: 1px solid var(--color-border-light); font-size: 0.78rem;
}

.pos-btn-draft {
    height: var(--btn-height); padding: 0 14px; font-size: 0.88rem; font-weight: 500;
    background: var(--color-amber); color: white;
    border: none; border-radius: var(--radius);
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
}
.pos-btn-draft:hover { filter: brightness(0.9); }

.pos-btn-drafts-view {
    height: var(--btn-height); padding: 0 12px; font-size: 0.88rem; font-weight: 400;
    background: var(--color-surface); color: var(--color-text-secondary);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
}
.pos-btn-drafts-view:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

.pos-btn-checkout {
    flex: 2; height: var(--btn-height); font-size: 0.88rem; font-weight: 500;
    background: var(--color-primary); color: var(--color-on-primary); border: none; border-radius: var(--radius);
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 5px;
}
.pos-btn-checkout:hover { background: var(--color-primary-dark); }

.pos-btn-cancel {
    height: var(--btn-height); padding: 0 12px; font-size: 0.88rem; font-weight: 400;
    background: var(--color-surface); color: var(--color-text-secondary);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    cursor: pointer; font-family: var(--font-main); transition: var(--transition);
}
.pos-btn-cancel:hover { background: var(--color-red-light); color: var(--color-red); border-color: var(--color-red-border); }

.pos-checkout-card { background: var(--color-surface); border-color: var(--color-border); padding: 8px 12px; }

/* =============================================================================
   25. PAYMENT TYPE TOGGLE
   ============================================================================= */
.payment-type-toggle {
    display: flex; gap: 0; border: 1px solid var(--color-border); border-radius: var(--radius);
    overflow: hidden; background: var(--color-background);
}
.pay-type-btn {
    flex: 1; height: var(--btn-height); font-size: 0.78rem; font-weight: 500; border: none;
    background: transparent; color: var(--color-text-secondary); cursor: pointer;
    transition: var(--transition); font-family: var(--font-main);
    display: flex; align-items: center; justify-content: center; gap: 3px;
}
.pay-type-btn.active { background: var(--color-primary); color: var(--color-on-primary); }
.pay-type-btn:not(.active):hover { background: var(--color-primary-light); color: var(--color-primary); }

/* =============================================================================
   26. SETTINGS PAGE (Vertical Tabs Layout)
   ============================================================================= */
.settings-layout {
    display: flex; gap: 0; flex: 1; overflow: hidden; height: calc(100vh - 42px);
}
.settings-sidebar {
    width: 210px; min-width: 210px; background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    overflow-y: auto; padding: 8px 0;
}
.settings-sidebar .sidebar-group { margin-bottom: 10px; }
.settings-sidebar .sidebar-group-title {
    font-size: 0.68rem; font-weight: 700; color: var(--color-text-muted);
    letter-spacing: 0;
    padding: 0 12px; margin-bottom: 3px;
}
.settings-sidebar .sidebar-link {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; font-size: 0.76rem; font-weight: 400;
    color: var(--color-text-secondary); cursor: pointer;
    transition: var(--transition); text-decoration: none; border-right: 3px solid transparent;
}
.settings-sidebar .sidebar-link:hover { background: var(--color-primary-light); color: var(--color-primary); }
.settings-sidebar .sidebar-link.active {
    color: var(--color-text); background: var(--color-background);
    border-right-color: var(--color-primary); font-weight: 600;
}
.settings-sidebar .sidebar-link .material-symbols-rounded { font-size: 0.88rem; }

.settings-content {
    flex: 1; overflow-y: auto; padding: 16px 24px; padding-bottom: 60px;
}
.settings-content .settings-page { display: none; width: 100%; }
.settings-content .settings-page.active { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-content: start; }
.settings-content .settings-page .page-title,
.settings-content .settings-page .page-description,
.settings-content .settings-page .sub-header { grid-column: 1 / -1; }
.settings-content .settings-page--full.active { grid-template-columns: 1fr; }
.settings-content .sub-banner { width: 100%; }
.settings-content .page-title {
    font-size: 1.1rem; font-weight: 700; color: var(--color-text);
    margin-bottom: 2px; letter-spacing: 0;
}
.settings-content .page-description {
    font-size: 0.68rem; color: var(--color-text-secondary);
    margin-bottom: 14px; font-weight: 400;
}
.settings-content .section-block {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 10px;
}
.settings-content .section-block h4 {
    font-size: 0.92rem; font-weight: 600; color: var(--color-text);
    margin-bottom: 8px; padding-bottom: 0; border-bottom: none;
    letter-spacing: 0;
}

/* =============================================================================
   27. RESPONSIVE / MEDIA QUERIES
   ============================================================================= */
@media (max-width: 992px) {
    body { overflow-y: auto; }
    .main-nav .nav-btn { padding: 0 6px; font-size: 0.66rem; }
    .main-nav .nav-btn .material-symbols-rounded { font-size: 0.9rem; }
    .warehouse-main td, .product-list-panel td { padding: 4px 6px !important; font-size: 0.68rem; }
    .sales-item { padding: 4px 8px; font-size: 0.68rem; }
    .stats-row { flex-direction: column; }
    .settings-sidebar { width: 190px; min-width: 190px; }
    .settings-content { padding: 14px; }
}

@media (max-width: 768px) {
    .main-nav {
        display: none; flex-direction: column; position: absolute; top: 100%; right: 0;
        background: var(--color-surface); box-shadow: var(--shadow-lg);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg); width: 100%; z-index: 1000; padding: 8px;
        border: 1px solid var(--color-border); border-top: none;
    }
    .main-nav.show { display: flex; }
    .main-nav .nav-btn { border-bottom: none !important; height: auto; line-height: 1.4; padding: 10px 14px; }
    .main-nav .nav-btn.active { background: var(--color-primary-light); border-radius: var(--radius); }
    .mobile-menu-btn { display: block; }
    .warehouse-main, .pos-main { flex-direction: column; overflow-y: auto; }
    .control-panel, .sales-panel, .product-list-panel, .product-form-panel { flex: 1 1 auto; max-width: 100%; }
    .pos-header { padding: 0 12px; }

    /* ── POS card-mode (mobile): pin the checkout controls (total + payment + pay) as an
       always-visible bottom action bar, so the cashier never has to scroll past the whole
       product list to reach them. Products + cart items scroll above the bar. ── */
    .pos-main.pos-cardmode { flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 172px; }
    .pos-main.pos-cardmode > .pos-products,
    .pos-main.pos-cardmode > .pos-cart { flex: 0 0 auto; width: 100%; max-width: 100%; }
    .pos-main.pos-cardmode .pos-cart-foot {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.12);
        padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
        display: flex; flex-direction: column; gap: 6px;
    }
    .pos-main.pos-cardmode .pos-cart-foot .pos-totals { margin: 0; }
    .pos-main.pos-cardmode .pos-cart-foot .pos-trow { padding: 1px 0; font-size: 0.8rem; }
    .pos-main.pos-cardmode .pos-cart-foot .pos-trow.grand { font-size: 0.98rem; }
    .pos-main.pos-cardmode .pos-cart-foot .pos-pay { padding: 12px; font-size: 0.92rem; }
    /* Give the product grid a comfortable, self-contained scroll feel */
    .pos-main.pos-cardmode .pos-grid { padding-bottom: 8px; }

    /* Settings layout mobile */
    .settings-layout { flex-direction: column; }
    .settings-sidebar { width: 100%; min-width: auto; border-left: none; border-bottom: 1px solid var(--color-border); overflow-x: auto; display: flex; padding: 0; }
    .settings-sidebar .sidebar-group { display: flex; margin: 0; }
    .settings-sidebar .sidebar-group-title { display: none; }
    .settings-sidebar .sidebar-link { white-space: nowrap; border-right: none; border-bottom: 2px solid transparent; padding: 12px 16px; }
    .settings-sidebar .sidebar-link.active { border-bottom-color: var(--color-primary); border-right-color: transparent; }
    .settings-content .settings-page.active { grid-template-columns: 1fr; }

    /* POS mobile enhancements */
    .pos-card { padding: 8px; margin-bottom: 6px; }
    .pos-grid-3 { grid-template-columns: 1fr 1fr; gap: 6px; }
    .pos-btn-add { padding: 10px; font-size: 0.82rem; }
    .pos-input-main { font-size: 0.85rem; padding: 8px 10px; }
    .pos-input-num, .pos-select { font-size: 0.82rem; padding: 6px 8px; }
    .pos-label, .pos-label-sm { font-size: 0.78rem; }

    /* Sales list mobile */
    .sales-item { padding: 8px; gap: 6px; font-size: 0.78rem; }
    .sales-item .product-name-cell { font-size: 0.78rem; min-width: 60px; }
    .sales-item .item-price-wrapper { min-width: auto; }
    .sales-item .item-price-wrapper input { width: 60px; font-size: 0.78rem; }
    .sales-item .item-qty-wrapper input { width: 36px; font-size: 0.78rem; padding: 3px; }
    .sales-item .item-stock-hint { font-size: 0.65rem; }
    .sales-item .btn-delete { padding: 2px 6px; font-size: 0.66rem; }
    .sales-panel-header { font-size: 0.82rem; padding: 8px; }

    /* Totals section mobile */
    .total-row { font-size: 0.82rem; padding: 4px 0; }
    .total-label, .total-value { font-size: 0.82rem; }

    /* Modals mobile */
    .modal-content { width: 95% !important; max-width: 95% !important; padding: 14px; max-height: 90vh; overflow-y: auto; }

    /* Table mobile - horizontal scroll */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .product-table { min-width: 600px; }
    .product-table th, .product-table td { padding: 6px 8px; font-size: 0.78rem; white-space: nowrap; }

    /* Warehouse mobile */
    .wh-stats { grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
    .wh-stat { padding: 6px 8px; }
    .wh-stat .wh-stat-label { font-size: 0.65rem; }
    .wh-stat .wh-stat-val { font-size: 0.9rem; }
    .wh-toolbar { flex-wrap: wrap; gap: 4px; padding: 6px 8px; }
    .wh-toolbar input, .wh-toolbar select { font-size: 0.78rem; padding: 5px 8px; }
    .product-form-panel { padding: 6px !important; }
    .product-form-panel h2 { font-size: 0.85rem; }
    .form-group-row { flex-direction: column; gap: 4px; }

    /* Reports mobile */
    .report-controls-bar { flex-direction: column; gap: 8px; }
    .report-controls-bar .control-group { width: 100%; }
    .report-controls-bar select, .report-controls-bar input { width: 100%; }
    .dash-stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .dash-stat { padding: 8px; }

    /* Purchases mobile */
    .po-item-row { padding: 6px; }

    /* Header mobile */
    .header-brand h1 { font-size: 0.82rem; }
    #exchange-rate-badge { font-size: 0.65rem !important; padding: 2px 6px !important; }

    /* Treasury mobile */
    .treasury-grid { grid-template-columns: 1fr; }
    .treasury-card { padding: 10px; }

    /* Filter bars mobile */
    .filter-bar, .filter-row { flex-direction: column; gap: 6px; }
    .filter-bar input, .filter-bar select { width: 100%; }
}

/* Extra small screens */
@media (max-width: 480px) {
    .pos-grid-3 { grid-template-columns: 1fr; gap: 4px; }
    .wh-stats { grid-template-columns: 1fr; }
    .sales-item { flex-wrap: wrap; }
    .sales-item > * { flex: 1 1 auto; }
    .product-table { min-width: 500px; }
    .dash-stats-grid { grid-template-columns: 1fr; }
    .stats-row .stat-card { min-width: auto; }
    .main-nav .nav-btn { padding: 8px 12px; font-size: 0.78rem; }
    .header-brand h1 { font-size: 0.78rem; }
}

/* =============================================================================
   28. SCROLLBAR
   ============================================================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* =============================================================================
   29. SIDEBAR NAV MODE (Tailscale-inspired)
   ============================================================================= */
html.nav-sidebar { overflow: hidden; }
html.nav-sidebar .pos-container { flex-direction: row; height: 100vh; }

html.nav-sidebar .pos-header {
    flex-direction: column; width: 190px; min-width: 190px; height: 100vh;
    border-bottom: none; border-left: 1px solid var(--color-border, #e0e0e0);
    padding: 0; align-items: stretch; justify-content: flex-start;
    background: var(--nav-bg); overflow-x: hidden; overflow-y: hidden;
    display: flex;
}

html.nav-sidebar .header-brand {
    padding: 12px 14px 10px; border-bottom: 1px solid var(--color-border, #e0e0e0);
    justify-content: center; flex-wrap: wrap;
}
html.nav-sidebar .pos-header h1 {
    font-size: 0.9375rem; text-align: center; font-weight: 800;
    letter-spacing: 0; color: var(--color-text, #202124);
}
html.nav-sidebar .mobile-menu-btn { display: none; }

html.nav-sidebar .main-nav {
    flex-direction: column; gap: 2px;
    padding: 10px 8px; align-items: stretch;
    flex: 1; overflow-y: auto;
    padding-bottom: 8px;
}
html.nav-sidebar .main-nav .nav-btn {
    height: auto; line-height: 1.4;
    padding: 7px 12px; font-size: 0.78rem; font-weight: 500;
    border-bottom: none; margin-bottom: 0;
    border-right: none; border-left: none;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 8px;
    color: var(--color-text-secondary, #5f6368);
    transition: all 0.15s ease;
}
html.nav-sidebar .main-nav .nav-btn:hover:not(.active) {
    background: var(--color-primary-light, #eff6ff); color: var(--color-primary, #37768b);
}
html.nav-sidebar .main-nav .nav-btn.active {
    color: var(--color-on-primary); background: var(--color-primary);
    border-right-color: transparent; border-bottom-color: transparent;
    font-weight: 700;
}
html.nav-sidebar .main-nav .nav-btn .material-symbols-rounded { font-size: 1.05rem; opacity: 0.6; }
html.nav-sidebar .main-nav .nav-btn.active .material-symbols-rounded { opacity: 1; }

/* Logout button in sidebar — pinned to bottom */
html.nav-sidebar .main-nav #logout-btn {
    margin-right: 0 !important; margin-left: 0 !important; margin-top: auto !important;
    border-radius: var(--radius-sm) !important; height: 34px !important;
    line-height: 34px !important; justify-content: center; align-self: stretch;
    margin-inline: 4px !important; padding: 0 !important;
    font-size: 0.78rem !important;
    background-color: var(--color-red) !important;
    border: none !important;
    color: #fff !important;
}
html.nav-sidebar .main-nav #logout-btn:hover {
    background-color: var(--color-red-dark) !important;
}

/* Main content area when sidebar is active */
html.nav-sidebar .pos-main,
html.nav-sidebar .warehouse-main,
html.nav-sidebar .report-main,
html.nav-sidebar .subscription-main,
html.nav-sidebar .accounting-page { flex: 1; height: 100vh; overflow-y: auto; }

/* Settings layout adjustment — no header height to subtract */
html.nav-sidebar .settings-layout { height: 100vh; }

/* Exchange rate badge — floating (position set via JS, this is override/fine-tune) */
#exchange-rate-badge:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; transform: translateY(-1px); }

/* Sidebar scrollbar styling */
html.nav-sidebar .main-nav::-webkit-scrollbar { width: 4px; }
html.nav-sidebar .main-nav::-webkit-scrollbar-track { background: transparent; }
html.nav-sidebar .main-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
html.nav-sidebar .main-nav::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ── Sidebar collapse toggle button ── */
.sidebar-toggle-btn {
    display: none; /* only shows in sidebar mode */
    width: 100%; height: 32px; margin-top: 4px;
    background: transparent; border: none;
    cursor: pointer; color: var(--color-text-muted);
    padding: 0; outline: none;
    font-size: 18px; line-height: 32px; text-align: center;
    border-top: 1px solid var(--color-border-light);
    transition: color 0.15s ease, background 0.15s ease;
}
.sidebar-toggle-btn:hover { color: var(--color-primary); background: var(--color-background); }
html.nav-sidebar .sidebar-toggle-btn { display: block; }

/* ── Collapsed sidebar ── */
html.nav-sidebar.sidebar-collapsed .pos-header {
    width: 56px; min-width: 56px; transition: width 0.2s ease, min-width 0.2s ease;
}
html.nav-sidebar .pos-header { transition: width 0.2s ease, min-width 0.2s ease; }
html.nav-sidebar.sidebar-collapsed .header-brand h1 { display: none; }
/* exchange rate badge is floating (position:fixed), not inside sidebar */
html.nav-sidebar.sidebar-collapsed .header-brand { padding: 12px 6px 10px; justify-content: center; }
html.nav-sidebar.sidebar-collapsed .main-nav { padding: 10px 4px; }
html.nav-sidebar.sidebar-collapsed .main-nav .nav-btn {
    padding: 10px 0; justify-content: center; font-size: 0; gap: 0;
    border-right: none; border-left: none;
}
html.nav-sidebar.sidebar-collapsed .main-nav .nav-btn .material-symbols-rounded {
    font-size: 1.2rem; margin: 0;
}
html.nav-sidebar.sidebar-collapsed .main-nav .nav-btn.active {
    background: var(--color-primary-light);
}
html.nav-sidebar.sidebar-collapsed .main-nav #logout-btn {
    font-size: 0 !important; padding: 8px 0 !important; justify-content: center !important;
}

/* =============================================================================
   30. ACTION DROPDOWN MENU (3-dot)
   ============================================================================= */
.action-cell { position: relative; text-align: center !important; }

.action-dots {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: var(--radius);
    cursor: pointer; font-size: 1.1rem; letter-spacing: 2px;
    color: var(--color-text-secondary); background: transparent;
    border: 1px solid transparent; transition: var(--transition);
    user-select: none; line-height: 1;
}
.action-dots:hover, .action-dots.active {
    background: var(--color-background); border-color: var(--color-border);
    color: var(--color-text);
}

.action-menu {
    display: none; position: fixed; z-index: 99999;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-md);
    min-width: 130px; padding: 4px 0;
}
.action-menu.show { display: block; }

/* ── Reset ALL inherited button styles inside action-menu ── */
.action-menu .action-menu-item,
.action-menu .action-menu-item.btn-delete,
.action-menu .action-menu-item.btn-edit,
.action-menu .action-menu-item.btn-view,
.action-menu .action-menu-item.btn-small-pay,
.action-menu .action-menu-item.btn-edit-user,
.action-menu .action-menu-item.btn-small-cancel {
    display: block !important;
    padding: 5px 12px !important; font-size: 0.78rem !important; font-weight: 400 !important;
    color: var(--color-text) !important; cursor: pointer;
    transition: background 0.1s; white-space: nowrap;
    border: none !important; background: none !important; width: 100%;
    text-align: start !important;
    line-height: 1.5; letter-spacing: normal;
    height: auto !important; border-radius: 0 !important;
    margin: 0 !important; box-shadow: none !important;
    text-transform: none !important;
}
.action-menu .action-menu-item:hover {
    background: var(--color-background) !important;
    color: var(--color-text) !important;
}

.action-menu-divider { height: 1px; background: var(--color-border); margin: 2px 0; }

/* =============================================================================
   31. UTILITY CLASSES
   ============================================================================= */
.text-green { color: var(--color-green) !important; }
.text-red { color: var(--color-red) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.bg-surface { background: var(--color-surface) !important; }

/* =============================================================================
   32. SELECTION & FOCUS
   ============================================================================= */
::selection { background: var(--color-primary-light); color: var(--color-text); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* =============================================================================
   33. LINKS
   ============================================================================= */
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =============================================================================
   34. RTL/LTR SUPPORT
   ============================================================================= */
html[dir="ltr"] body { direction: ltr; text-align: left; }
html[dir="ltr"] .product-table th,
html[dir="ltr"] .product-table td { text-align: left; }
html[dir="ltr"] .pos-header { direction: ltr; }
html[dir="ltr"] .main-nav { direction: ltr; }
html[dir="ltr"] .nav-btn { text-align: left; }
html[dir="ltr"] .form-group label { text-align: left; }
html[dir="ltr"] input, html[dir="ltr"] select, html[dir="ltr"] textarea { text-align: left; }
html[dir="ltr"] select { background-position: right 10px center; padding-left: 12px; padding-right: 28px; }
html[dir="ltr"] .stat-label, html[dir="ltr"] .stat-value { text-align: left; }
html[dir="ltr"] .sales-list-header { direction: ltr; }
html[dir="ltr"] .sales-item { direction: ltr; }
html[dir="ltr"] .modal-content { direction: ltr; text-align: left; }

/* Sidebar nav LTR */
html[dir="ltr"] html.nav-sidebar .main-nav {
    border-right: none; border-left: 1px solid var(--color-border);
    right: auto; left: 0;
}
html[dir="ltr"] html.nav-sidebar .main-nav .nav-btn {
    border-right: none; border-left: 2px solid transparent;
    padding-right: 12px; padding-left: 14px;
}
html[dir="ltr"] html.nav-sidebar .main-nav .nav-btn.active {
    border-left-color: var(--color-text); border-right-color: transparent;
}
html[dir="ltr"] html.nav-sidebar .pos-container { padding-right: 0; padding-left: 0; }
html[dir="ltr"] html.nav-sidebar .pos-header {
    border-left: none; border-right: 1px solid var(--color-border);
}
html[dir="ltr"] #exchange-rate-badge { left: auto !important; right: 12px !important; }

/* Settings sidebar LTR */
html[dir="ltr"] .settings-sidebar {
    border-right: none; border-left: 1px solid var(--color-border);
}
html[dir="ltr"] .sidebar-link {
    border-right: none; border-left: 2px solid transparent;
}
html[dir="ltr"] .sidebar-link.active {
    border-left-color: var(--color-text); border-right-color: transparent;
}

/* Search container LTR */
html[dir="ltr"] .search-container { direction: ltr; }

/* General LTR text alignment */
html[dir="ltr"] .page-header,
html[dir="ltr"] .section-title,
html[dir="ltr"] .section-desc,
html[dir="ltr"] .card-title { text-align: left; }

html[dir="ltr"] .pos-card { text-align: left; }
html[dir="ltr"] .pos-label { text-align: left; }
html[dir="ltr"] .pos-search-input { text-align: left; direction: ltr; }

/* Stats bar LTR */
html[dir="ltr"] .stats-bar { direction: ltr; }
html[dir="ltr"] .stat-card { text-align: left; }

/* Control panel & sales panel LTR */
html[dir="ltr"] .control-panel { text-align: left; }
html[dir="ltr"] .sales-panel { text-align: left; }
html[dir="ltr"] .sales-panel-header { direction: ltr; text-align: left; }

/* Buttons & actions alignment */
html[dir="ltr"] .btn-row,
html[dir="ltr"] .action-row,
html[dir="ltr"] .modal-footer { direction: ltr; }
html[dir="ltr"] .page-actions { direction: ltr; }

/* Treasury page LTR */
html[dir="ltr"] .treasury-card { text-align: left; }
html[dir="ltr"] .treasury-grid { direction: ltr; }

/* Modal LTR */
html[dir="ltr"] .modal-header { text-align: left; }
html[dir="ltr"] .modal-body { text-align: left; }

/* Invoice detail LTR */
html[dir="ltr"] .invoice-detail { text-align: left; direction: ltr; }

/* Expenses, Suppliers, Customers, Reps — filter bar LTR */
html[dir="ltr"] .filter-bar,
html[dir="ltr"] .filter-row { direction: ltr; }

/* Toggle switches & checkboxes */
html[dir="ltr"] .toggle-row { direction: ltr; }
html[dir="ltr"] .toggle-label { text-align: left; }

/* Sidebar logout button LTR */
html[dir="ltr"] html.nav-sidebar .main-nav #logout-btn {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Reports page LTR */
html[dir="ltr"] .reports-page { text-align: left; direction: ltr; }
html[dir="ltr"] .report-controls-bar { direction: ltr; }
html[dir="ltr"] .report-controls-bar .control-group label { text-align: left; }
html[dir="ltr"] .report-action-btns { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .dash-stat { border-right: none; border-left: 3px solid var(--color-border); }
html[dir="ltr"] .dash-stat.revenue { border-left-color: var(--color-primary); }
html[dir="ltr"] .dash-stat.expenses { border-left-color: var(--color-border); }
html[dir="ltr"] .dash-stat.profit { border-left-color: var(--color-border); }
html[dir="ltr"] .dash-stat.debt { border-left-color: var(--color-red); }
html[dir="ltr"] .report-table thead th { text-align: left; }
html[dir="ltr"] .report-table tbody td { text-align: left; }
html[dir="ltr"] .report-results-wrapper { text-align: left; direction: ltr; }

/* Settings content LTR */
html[dir="ltr"] .settings-content { text-align: left; }
html[dir="ltr"] .settings-section { text-align: left; }

/* Settings floating save button LTR */
html[dir="ltr"] .floating-save { left: auto; right: 24px; }

/* Branch cards LTR */
html[dir="ltr"] .branch-card { text-align: left; direction: ltr; }

/* Fix text direction in all inputs for LTR */
html[dir="ltr"] .pos-input-main,
html[dir="ltr"] .pos-input-num,
html[dir="ltr"] .pos-select { direction: ltr; }

/* Ensure table alignment is consistent in LTR */
html[dir="ltr"] table { direction: ltr; }
html[dir="ltr"] th { text-align: left; }
html[dir="ltr"] td { text-align: left; }

/* LTR mobile nav dropdown */
@media (max-width: 768px) {
    html[dir="ltr"] .main-nav { right: auto; left: 0; }
}

/* =============================================================================
   35. FHD+ (1920x1080 and above) OPTIMIZATIONS
   ============================================================================= */
@media (min-width: 1600px) {
    .pos-header { padding: 0 18px; }
    .main-nav .nav-btn { padding: 0 10px; font-size: 0.78rem; }
    .main-nav .nav-btn .material-symbols-rounded { font-size: 1rem; }
    .pos-main, .warehouse-main, .report-main { padding: 14px; gap: 12px; }
    .product-form-panel { flex: 0 0 480px; padding: 12px 14px; }
    .product-table th, .product-table td { padding: 5px 8px; font-size: 0.76rem; }
    .stat-card { padding: 8px 12px; }
    .stat-card .stat-value { font-size: 1.15rem; }
    .stat-card .stat-label { font-size: 0.66rem; }
    .modal-content { max-width: 680px; }
    .filter-bar { gap: 6px; }
    .filter-bar input, .filter-bar select, .filter-bar .btn { font-size: 0.78rem; padding: 4px 8px; }
    .settings-content { padding: 18px 28px; }
}

@media (min-width: 1920px) {
    .main-nav .nav-btn { padding: 0 14px; }
    .product-form-panel { flex: 0 0 520px; }
    .control-panel { flex: 0 0 33%; max-width: 33%; }
    .sales-panel { flex: 0 0 67%; max-width: 67%; }

    /* Warehouse table — more room for SKU + Product at wide screens */
    .warehouse-products-table th:nth-child(1),
    .warehouse-products-table td:nth-child(1) { width: 12%; font-size: 0.82rem; }
    .warehouse-products-table th:nth-child(2),
    .warehouse-products-table td:nth-child(2) { width: 22%; }
}

/* =============================================================================
   36. VISUAL POLISH & MICRO-INTERACTIONS (V24 Compact Edition)
   ============================================================================= */

/* ── Card hover — flat printed feel: firm the border, no lift ── */
.pos-card:hover,
.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-border);
}

/* ── Active nav items — solid primary (black) background, inverting text ── */
.shell-sidebar-nav .nav-btn.active,
html.nav-sidebar .main-nav .nav-btn.active {
    position: relative;
    font-weight: 600;
    background: var(--color-primary) !important;
    color: var(--color-on-primary) !important;
}
.shell-sidebar-nav .nav-btn.active .material-symbols-rounded,
html.nav-sidebar .main-nav .nav-btn.active .material-symbols-rounded {
    color: var(--color-on-primary) !important;
}

/* ── Table row hover — neutral darkening (matches treasury .tx-table) ── */
.product-table tbody tr:hover {
    background: var(--color-background);
}

/* ── Better focus rings ── */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 2px var(--color-primary-glow);
}

/* ── Refined badge styles ── */
.stock-badge {
    font-size: 0.64rem; padding: 2px 5px; border-radius: 3px;
    font-weight: 600;
}

/* ── Compact action menu ── */
.action-dots {
    width: 26px; height: 26px; font-size: 1rem;
}
.action-menu .action-menu-item,
.action-menu .action-menu-item.btn-delete,
.action-menu .action-menu-item.btn-edit,
.action-menu .action-menu-item.btn-view,
.action-menu .action-menu-item.btn-small-pay,
.action-menu .action-menu-item.btn-edit-user,
.action-menu .action-menu-item.btn-small-cancel {
    padding: 3px 8px !important; font-size: 0.78rem !important;
}

/* ── Compact search containers ── */
.search-container { margin-bottom: 6px; }
#invoice-search, #rfq-search { font-size: 0.68rem; }

/* ── Button active press effect ── */
.btn:active, .pos-btn-add:active, .pos-btn-checkout:active {
    transform: scale(0.97);
    transition: transform 0.06s ease !important;
}

/* ── Subtler panel borders — less visual noise ── */
.product-list-panel, .product-form-panel, .sales-panel {
    border-color: var(--color-border-light);
}

/* ── Compact POS tax row ── */
.pos-tax-row {
    padding: 4px 8px; margin-top: 3px; font-size: 0.78rem;
}

/* ── Compact payment toggle ── */
.pay-type-btn {
    height: var(--btn-height); font-size: 0.78rem;
}

/* ── Compact collapsed sidebar ── */
html.nav-sidebar.sidebar-collapsed .pos-header {
    width: 48px; min-width: 48px;
}

/* ── Status badges — more refined ── */
.status-paid, .status-pending, .status-overdue { font-size: 0.66rem; }

/* ── Smooth micro-interactions on all interactive elements ── */
.btn, .nav-btn, .pos-card, .stat-card, .filter-bar .btn,
.sidebar-link, .template-option, .action-dots {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Settings sidebar — nav-sidebar height fix ── */
html.nav-sidebar .settings-layout { height: 100vh; }

/* =============================================================================
   UI ENHANCEMENTS v24 — shared status pills, fixed-layout data tables, states
   (used by invoices tab; reusable across purchases/treasury/rfqs)
   ============================================================================= */

/* ── Status tag: flat & professional — neutral border + small colored status dot ── */
.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius);
    font-size: 0.72rem; font-weight: 600; line-height: 1.5;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    white-space: nowrap; max-width: 100%;
}
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, currentColor); flex: 0 0 auto; }
.status-pill .pill-sub { font-weight: 500; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
/* Only the DOT carries the status color; the text stays neutral for a clean, flat look */
.status-pill.is-paid     { --dot: var(--color-green); }
.status-pill.is-pending  { --dot: var(--color-amber); }
.status-pill.is-overdue  { --dot: var(--color-red); }
.status-pill.is-returned { --dot: var(--color-red); }
.status-pill.is-partial  { --dot: var(--color-amber); }
.status-pill.is-neutral  { --dot: var(--color-text-muted); }
.status-pill.is-info     { --dot: var(--color-primary); }

/* ── Invoices layout: the list panel now spans the full width (detail panel removed) ── */
.invoices-main .product-list-panel { flex: 1 1 100%; min-width: 0; width: 100%; }

/* ── Fixed-layout invoices table: no more column collisions / clipped amounts ── */
.invoices-table { table-layout: fixed; width: 100%; }
.invoices-table th, .invoices-table td {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    vertical-align: middle;
}
/* Proportional widths summing to 100% so no single column balloons.
   (JS column-resize overrides these per-user and persists to localStorage.) */
.invoices-table .col-id       { width: 6%;   color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.invoices-table .col-customer { width: 22%; }
.invoices-table .col-num      { width: 11%;  text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; }
.invoices-table .col-date     { width: 10.5%; color: var(--color-text-secondary); }
.invoices-table .col-status   { width: 12%; }
.invoices-table .col-pay      { width: 11%;  color: var(--color-text-secondary); }
.invoices-table .col-user     { width: 12%;  color: var(--color-text-secondary); }
.invoices-table .col-actions  { width: 5%;   text-align: center; }

/* ── Draggable column-resize handle (smart-table.js) ── */
.col-resizer {
    position: absolute; top: 0; bottom: 0; inset-inline-end: 0;
    width: 9px; cursor: col-resize; z-index: 6;
    touch-action: none; user-select: none;
}
.col-resizer::after {
    content: ''; position: absolute; inset-inline-end: 3px; top: 20%; bottom: 20%;
    width: 2px; background: var(--color-border); border-radius: 2px;
    opacity: 0; transition: opacity .12s ease, background .12s ease;
}
.col-resizer:hover::after, .col-resizer:active::after { opacity: 1; background: var(--color-primary); }

/* ── RFQ table: reuses the invoices smart styling, its own column proportions (sum 100%) ── */
.rfq-table .col-id       { width: 9%; }
.rfq-table .col-customer { width: 34%; }
.rfq-table .col-num      { width: 16%; }
.rfq-table .col-date     { width: 16%; }
.rfq-table .col-user     { width: 17%; }
.rfq-table .col-actions  { width: 8%; }

/* ── Shared detail modal (invoices + RFQ) ── */
.inv-modal { max-width: 850px; max-height: 88vh; overflow-y: auto; padding: 24px 28px; }
.inv-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid var(--color-border); padding-bottom: 12px; }
.inv-modal-title { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--color-primary); }
.inv-modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--color-text-secondary); padding: 4px 8px; border-radius: var(--radius); transition: background 0.2s; }
.inv-modal-close:hover { background: var(--color-background); }
.inv-modal-footer { display: flex; gap: 6px; margin-top: 16px; border-top: 1px solid var(--color-border); padding-top: 12px; }
.inv-modal-action { flex: 1; height: 40px; font-size: 0.875rem; }
.inv-modal-action-sm { flex: 0.6; height: 40px; font-size: 0.875rem; }
.inv-print-icon { font-size: 16px; vertical-align: middle; }

.invoices-table tbody tr { cursor: pointer; transition: background-color .12s ease; }
.invoices-table tbody tr:nth-child(even) { background: var(--color-background); }
.invoices-table tbody tr:hover { background: var(--color-primary-light); }
.invoices-table tbody tr.active-row {
    background: var(--color-primary-light);
    box-shadow: inset 3px 0 0 var(--color-primary);
}
.invoices-table .row-action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 26px; padding: 0; border-radius: var(--radius);
    border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text-secondary); cursor: pointer; transition: var(--transition);
}
.invoices-table .row-action-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
.invoices-table .row-action-btn .material-symbols-rounded { font-size: 17px; }

/* Sortable header affordance */
.invoices-table th.is-sortable { cursor: pointer; user-select: none; }
.invoices-table th.is-sortable:hover { color: var(--color-primary); }
.invoices-table th .sort-icon { font-size: .8em; opacity: .55; margin-inline-start: 3px; }

/* ── Empty / error / loading states for data tables ── */
.table-empty-state { text-align: center; padding: 34px 14px; color: var(--color-text-muted); }
.table-empty-state .material-symbols-rounded { font-size: 42px; opacity: .45; display: block; margin: 0 auto 6px; }
.table-empty-state .empty-title { font-weight: 600; color: var(--color-text-secondary); font-size: .85rem; }
.table-empty-state .empty-hint { font-size: .74rem; margin-top: 2px; }

/* ── Search/filter row: inline result count ── */
.inv-result-count {
    font-size: .72rem; color: var(--color-text-muted); font-weight: 600;
    white-space: nowrap; padding-inline: 4px;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .invoices-table tbody tr, .status-pill, .row-action-btn { transition: none !important; }
}

/* =============================================================================
   SUPPORT WIDGET — floating help icon + slide-in ticket panel
   ============================================================================= */
.support-fab {
    position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 99998;
    width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--color-primary); color: #fff; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.support-fab:hover { background: var(--color-primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.support-fab .material-symbols-rounded { font-size: 26px; }

.support-panel {
    position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 99999;
    width: 360px; max-width: calc(100vw - 40px); height: 560px; max-height: calc(100vh - 90px);
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    display: none; flex-direction: column; overflow: hidden;
    transform: translateY(12px) scale(.98); opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
.support-panel.open { display: flex; transform: translateY(0) scale(1); opacity: 1; }
.support-head {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--color-primary); color: #fff;
}
.support-head .support-title { flex: 1; margin: 0; font-size: 0.92rem; font-weight: 700; }
.support-head button { background: rgba(255,255,255,.15); border: none; color: #fff; cursor: pointer;
    width: 28px; height: 28px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; }
.support-head button:hover { background: rgba(255,255,255,.28); }
.support-head .material-symbols-rounded { font-size: 18px; }
.support-body { flex: 1; overflow-y: auto; padding: 12px; }

.support-new-btn { width: 100%; margin-bottom: 10px; }
.support-list { display: flex; flex-direction: column; gap: 6px; }
.support-item { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 9px 11px; cursor: pointer; transition: var(--transition); }
.support-item:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.support-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.support-num { font-size: 0.72rem; font-weight: 700; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.support-item.has-unread { border-color: var(--color-primary); background: var(--color-primary-light); }
.support-unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-red); margin-inline-end: 6px; vertical-align: middle; }
.support-item-title { font-size: 0.82rem; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-empty { text-align: center; color: var(--color-text-muted); padding: 30px 12px; font-size: 0.82rem; }
.support-empty .material-symbols-rounded { font-size: 40px; opacity: .45; display: block; margin: 0 auto 6px; }

.support-form { display: flex; flex-direction: column; }
.support-form label { font-size: 0.74rem; font-weight: 600; color: var(--color-text-secondary); margin: 6px 0 3px; }
.support-form input[type=text], .support-form textarea, .support-form select {
    width: 100%; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-surface); color: var(--color-text); font-size: 0.82rem;
}
.support-form textarea { resize: vertical; }
.support-row { display: flex; gap: 8px; }
.support-row > div { flex: 1; }
.support-file, .support-file-sm { cursor: pointer; color: var(--color-primary); font-size: 0.78rem; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.support-filename { font-size: 0.72rem; color: var(--color-text-muted); margin-top: 4px; }
.support-form .btn { margin-top: 12px; }
.support-msg { font-size: 0.76rem; margin-top: 8px; }
.support-msg.err { color: var(--color-red); }

.support-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.support-detail-title { font-size: 0.86rem; font-weight: 600; }
.support-stale { font-size: 0.7rem; color: var(--color-amber); background: var(--color-amber-light); border: 1px solid var(--color-amber-border); border-radius: var(--radius); padding: 6px 9px; margin-bottom: 10px; }
.support-convo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.support-bubble { max-width: 85%; padding: 7px 10px; border-radius: var(--radius-lg); font-size: 0.8rem; }
.support-bubble.them { align-self: flex-start; background: var(--color-background); border: 1px solid var(--color-border); }
.support-bubble.me { align-self: flex-end; background: var(--color-primary-light); border: 1px solid var(--color-primary); }
.support-bubble-who { font-size: 0.66rem; color: var(--color-text-muted); margin-bottom: 2px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.support-bubble-time { font-size: 0.62rem; color: var(--color-text-muted); opacity: 0.8; white-space: nowrap; direction: ltr; }
.support-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.support-att-img { display: block; line-height: 0; }
.support-att-img img { max-width: 160px; max-height: 160px; border-radius: var(--radius); border: 1px solid var(--color-border); object-fit: cover; }
.support-att-file { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; padding: 4px 8px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); text-decoration: none; color: var(--color-primary); }
.support-att-file:hover { background: var(--color-primary-light); }
.support-att-file .material-symbols-rounded { font-size: 15px; }
.support-reply { display: flex; align-items: flex-end; gap: 6px; }
.support-reply textarea { flex: 1; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.82rem; resize: none; }
.support-reply .support-send { padding: 0; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.support-file-sm { margin: 0; width: 32px; height: 36px; justify-content: center; border: 1px solid var(--color-border); border-radius: var(--radius); }
html[dir="ltr"] .support-fab, html[dir="ltr"] .support-panel { inset-inline-start: auto; inset-inline-end: 20px; }

/* ═══════════════════════════════════════════════════════════════════════════
   macOS SHARED ENHANCEMENT COMPONENTS (app-wide) — used by every screen to match
   the POS craft: page headers, segmented filters, KPI cards, empty states, icons.
   ═══════════════════════════════════════════════════════════════════════════ */
.pxi { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; color: currentColor; flex: none; }
.tnum { font-variant-numeric: tabular-nums; }

/* Page header: title + count + primary action */
.mac-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.mac-head-titles { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mac-head h1, .mac-head .mac-title { font-size: 1.02rem; font-weight: 700; color: var(--color-text); margin: 0; letter-spacing: 0; }
.mac-head .mac-count { font-size: 0.71rem; color: var(--color-text-muted); white-space: nowrap; }
.mac-head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
/* Primary "new entity" action button (customers / suppliers / representatives) — matches
   the purchases new-order button so every list header shares one action style. */
.entity-new-btn {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    height: 30px; padding: 0 12px; font-size: 0.76rem; font-weight: 600;
    border-radius: var(--radius);
}
.entity-new-btn .material-symbols-rounded { font-size: 15px; line-height: 1; }

/* Segmented control (status/type/period filters) */
.mac-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--color-background);
    border: 1px solid var(--color-border); border-radius: var(--radius); }
.mac-seg > button, .mac-seg > .mac-seg-btn { border: none; background: transparent; color: var(--color-text-secondary);
    cursor: pointer; font-family: var(--font-main); font-size: 0.76rem; font-weight: 500; padding: 4px 12px; border-radius: var(--radius-sm);
    transition: 0.15s; white-space: nowrap; }
.mac-seg > button.active, .mac-seg > .mac-seg-btn.active, .mac-seg > [aria-selected="true"] {
    background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xs); }

/* Toolbar (search + filters + actions) */
.mac-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.mac-search { position: relative; flex: 1; min-width: 170px; display: flex; align-items: center; }
.mac-search .pxi { position: absolute; inset-inline-start: 9px; font-size: 0.9rem; color: var(--color-text-muted); pointer-events: none; }
.mac-search input { width: 100%; height: 28px; border: 1px solid var(--color-border); background: var(--color-surface);
    border-radius: var(--radius); padding: 0 30px; font-family: var(--font-main); font-size: 0.78rem; color: var(--color-text); }
/* Toolbar controls sit inline. Without this they inherit the global `select/input
   { width: 100% }` and each filter is forced onto its own full-width row. */
.mac-toolbar > select, .mac-toolbar > input, .mac-toolbar > .pur-filter-field {
    width: auto; height: 28px; padding: 0 10px; font-size: 0.78rem; }
.mac-toolbar > label { font-size: 0.72rem; }
.mac-toolbar > .btn { height: 28px; padding: 0 12px; font-size: 0.78rem; }
.mac-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); }

/* KPI stat cards (dashboards) */
.mac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 6px; margin-bottom: 6px; }
.mac-stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    padding: 6px 10px; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--shadow-xs); }
.mac-stat-label { font-size: 0.62rem; color: var(--color-text-secondary); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.mac-stat-label .pxi { font-size: 0.8rem; color: var(--color-text-muted); }
.mac-stat-val { font-size: 1rem; font-weight: 700; color: var(--color-text); letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums; line-height: 1.25; }
.mac-stat-sub { font-size: 0.62rem; color: var(--color-text-muted); }

/* Empty state */
.mac-empty { text-align: center; padding: 44px 20px; color: var(--color-text-muted); }
.mac-empty .pxi { font-size: 2rem; opacity: 0.5; display: block; margin: 0 auto 8px; width: 2rem; height: 2rem; }
.mac-empty-title { font-size: 0.9rem; color: var(--color-text-secondary); font-weight: 500; }
.mac-empty-sub { font-size: 0.78rem; margin-top: 3px; }

/* Thin monochrome icon action button */
.mac-iconbtn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--color-border);
    border-radius: var(--radius); background: var(--color-surface); color: var(--color-text-secondary); cursor: pointer; transition: 0.15s; }
.mac-iconbtn:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }
.mac-iconbtn.danger:hover { background: var(--color-red-light); border-color: var(--color-red); color: var(--color-red); }
.mac-iconbtn .pxi { font-size: 0.95rem; }

/* Card-row list (alternative to tables) */
.mac-list { display: flex; flex-direction: column; gap: 8px; }
.mac-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg); transition: border-color 0.15s, box-shadow 0.15s; }
.mac-row:hover { border-color: var(--color-text-muted); box-shadow: var(--shadow-xs); }
.mac-row-ic { width: 36px; height: 36px; border-radius: var(--radius); flex: none; display: grid; place-items: center;
    background: var(--color-background); border: 1px solid var(--color-border-light); color: var(--color-text-secondary); }
.mac-row-main { flex: 1; min-width: 0; }
.mac-row-title { font-size: 0.85rem; font-weight: 500; color: var(--color-text); }
.mac-row-sub { font-size: 0.72rem; color: var(--color-text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   macOS MOTION POLISH — smooth, fast, restrained (the "everything glides" feel)
   ═══════════════════════════════════════════════════════════════════════════ */
.btn, .mac-seg > button, .mac-iconbtn, .pcard, .pcard-add, .pos-pm, .pos-pay,
.nav-btn, .action-menu-item, .mac-row, .stat-card, .pos-card, .product-table tbody tr,
.sales-item, .dropdown-list-item, .sidebar-action-btn {
    transition: background-color 0.17s var(--ease-out), color 0.17s var(--ease-out),
                border-color 0.17s var(--ease-out), box-shadow 0.2s var(--ease-out),
                transform 0.13s var(--ease-out);
}
/* Press feedback — a quick, subtle scale-in on tap/click */
.btn:active, .mac-iconbtn:active, .pcard-add:active, .pos-pay:active,
.pos-btn-add:active, .pos-btn-checkout:active, .pos-pm:active { transform: scale(0.96); }
.pcard:active { transform: scale(0.985); }
/* Segmented controls glide between selections */
.mac-seg > button, .pos-seg, .pos-pm {
    transition: color 0.16s var(--ease-out), background-color 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out);
}
/* Overlays fade smoothly */
.modal-overlay { transition: opacity 0.2s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
    .btn, .mac-iconbtn, .pcard, .pcard-add, .pos-pay, .pos-pm, .pos-btn-add { transition: none; }
    .btn:active, .mac-iconbtn:active, .pcard:active, .pcard-add:active, .pos-pay:active { transform: none; }
}
