/* ============================================================================
   Qrixo Accounting — Design System
   A dense, professional, enterprise-grade visual language modeled on the
   information density of tools accountants actually live in (ledgers,
   spreadsheets, ERP back-offices) rather than a marketing-site aesthetic.
   ============================================================================ */

:root {
    /* Core palette — deep navy ink with a single confident blue accent */
    --ink-900: #0b1220;
    --ink-800: #111a2e;
    --ink-700: #1a2540;
    --ink-600: #28304a;

    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff4ff;

    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-alt: #f7f8fb;

    --text: #131826;
    --text-muted: #5b6478;
    --text-faint: #8b93a7;

    --border: #e1e5ec;
    --border-strong: #cbd2de;

    --success: #15803d;
    --success-bg: #e7f6ec;
    --danger: #b91c1c;
    --danger-bg: #fdecec;
    --warning: #b45309;
    --warning-bg: #fdf2dc;
    --info: #1d4ed8;
    --info-bg: #e9f0fe;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-raised: 0 4px 14px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);

    --sidebar-width: 252px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-num:  'Inter', 'Tabular Nums', ui-monospace, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--font-sans); letter-spacing: -0.015em; color: var(--text); }

h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 1.1rem; }
h2 { font-size: 1.02rem; font-weight: 700; margin: 0 0 0.8rem; }
h3 { font-size: 0.9rem; font-weight: 700; margin: 0 0 0.6rem; }

/* ============ AUTH PAGES (login) ============ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.18), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(37, 99, 235, 0.12), transparent 45%),
        linear-gradient(160deg, var(--ink-900) 0%, #0d1526 55%, #070b14 100%);
    padding: 1.5rem;
}

.auth-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.auth-box {
    background: var(--surface);
    padding: 2.6rem 2.4rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 380px;
    border: 1px solid rgba(255,255,255,0.06);
}

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #1e40af);
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.auth-box h1 {
    margin: 0;
    font-size: 1.3rem;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.83rem;
    margin: 0.35rem 0 1.6rem;
}

.auth-box label {
    display: block;
    margin-bottom: 1.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

.auth-box input {
    width: 100%;
    padding: 0.62rem 0.75rem;
    margin-top: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 400;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: var(--font-sans);
}

.auth-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-block {
    width: 100%;
    padding: 0.7rem;
    font-size: 0.92rem;
    font-weight: 700;
    margin-top: 0.4rem;
    justify-content: center;
}

.demo-hint {
    text-align: center;
    font-size: 0.76rem;
    color: var(--text-faint);
    margin: 1.3rem 0 0;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.demo-hint strong { color: var(--text-muted); }

.auth-footer {
    color: rgba(255,255,255,0.55);
    font-size: 0.74rem;
}

/* ============ APP SHELL ============ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar — deep ink, not white: gives the software an enterprise weight */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--ink-900);
    border-right: 1px solid rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.15rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-badge {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--primary), #1e40af);
    color: #fff;
    font-weight: 800;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #f3f5f9;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.7rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.46rem 0.7rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: #aab2c5;
    font-size: 0.81rem;
    font-weight: 500;
    transition: background 0.13s, color 0.13s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.09);
    color: #f1f5f9;
    text-decoration: none;
}

.nav-item.active,
.nav-item.active:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #ffffff;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #3b82f6;
    text-decoration: none;
}

.nav-item-sub.active {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.nav-item-sub.active .nav-icon {
    color: #93c5fd;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.nav-item:hover .nav-icon {
    transform: scale(1.14) rotate(-6deg);
}

.sidebar-footer {
    padding: 0.7rem 0.65rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.7rem 0.7rem;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.22);
    color: #93b4ff;
    font-weight: 700;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #f3f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.68rem;
    color: #7c869c;
    text-transform: capitalize;
}

.nav-item-logout { color: #f29b9b; }
.nav-item-logout:hover { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
    z-index: 30;
}

.sidebar-overlay.is-visible { display: block; }

/* Main content area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

/* ── Top bar (always visible) ── */
.mobile-topbar { display: none; } /* legacy — hidden */

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 1.25rem;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.topbar-brand {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: background .12s;
}
.sidebar-toggle:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; }

/* Hide hamburger on desktop */
@media (min-width: 769px) {
    .sidebar-toggle { display: none; }
    .topbar-brand   { display: none; }
}

.topbar-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    position: relative;
    transition: background .12s, color .12s;
    /* Reset so <button>-based icons (calculator, notifications) render
       identically to the <a>-based ones (customize, settings) — without
       this, the browser's default button chrome (border + background)
       makes some icons look "boxed" while others look flat. */
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.topbar-icon-btn:hover, .topbar-icon-btn.active {
    background: var(--surface-alt);
    color: var(--primary);
}

.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid var(--surface);
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.55rem 0.28rem 0.28rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: background .12s;
    margin-left: 0.15rem;
}
.topbar-profile:hover { background: var(--surface-alt); }
.topbar-profile img {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
}
.topbar-profile span:first-child {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.topbar-profile-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 500px) {
    .topbar-profile-name { display: none; }
}

/* Container — wide working canvas, not a marketing-site column */
.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 1.6rem 2rem 3rem;
}

.container-narrow { max-width: 640px; }

/* Page header with action button */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.page-header h1 { margin: 0; }

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: -0.7rem;
    margin-bottom: 1.2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.46rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    line-height: 1.3;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); }

/* ============ KPI CARDS ============ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.3rem;
}

.kpi-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.1rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    border-top: 2.5px solid #c6cbd6;
    position: relative;
}

.kpi-card.kpi-positive { border-top-color: var(--success); }
.kpi-card.kpi-negative { border-top-color: var(--danger); }
.kpi-card.kpi-warning  { border-top-color: var(--warning); }

.kpi-label {
    display: block;
    font-size: 0.71rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    margin-bottom: 0.4rem;
}

.kpi-value {
    display: block;
    font-size: 1.32rem;
    font-weight: 700;
    font-family: var(--font-num);
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.kpi-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--text-faint);
    margin-top: 0.3rem;
}

.kpi-meta.kpi-meta-up { color: var(--success); }
.kpi-meta.kpi-meta-down { color: var(--danger); }

/* ============ STAT STRIP (compact secondary counts) ============ */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.7rem;
    margin: 0 0 1.3rem;
}

.stat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.12s, box-shadow 0.12s;
}

.stat-pill:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }

.stat-pill-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-pill-icon svg { width: 17px; height: 17px; }

.stat-pill-num { font-size: 1.05rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-pill-label { font-size: 0.71rem; color: var(--text-muted); }

/* ============ CHARTS ============ */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.3rem;
}

.chart-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.05rem 1.15rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.chart-card h2 { font-size: 0.88rem; margin: 0 0 0.7rem; color: var(--text); }

/* ============ DASHBOARD-SPECIFIC LAYOUT ============ */
.dash-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 0.85rem;
    margin: 0 0 1.3rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .dash-grid { grid-template-columns: 1fr; }
}

.panel {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.05rem 1.15rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
}

.panel-header h2 { margin: 0; }

.panel-link { font-size: 0.76rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

.mini-list { display: flex; flex-direction: column; gap: 0; }

.mini-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
    text-decoration: none;
    color: var(--text);
}

.mini-list-row:last-child { border-bottom: none; }

.mini-list-name { font-weight: 600; }
.mini-list-sub { color: var(--text-faint); font-size: 0.74rem; }
.mini-list-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-row {
    display: flex;
    gap: 0.65rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.81rem;
}

.activity-row:last-child { border-bottom: none; }

.activity-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.activity-text { color: var(--text); }
.activity-text strong { font-weight: 600; }
.activity-time { color: var(--text-faint); font-size: 0.72rem; display: block; margin-top: 0.1rem; }

.quick-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.85rem 0.6rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-alt);
    text-decoration: none;
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.12s, background 0.12s;
}

.quick-link:hover { border-color: var(--primary); background: var(--primary-light); }

.quick-link svg { width: 19px; height: 19px; color: var(--primary); }

/* ============ TABLES ============ */
.table-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.05rem 1.15rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    margin-bottom: 1.1rem;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table th, .data-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--text-faint);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface-alt);
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============ BADGES & STATUS PILLS ============ */
.badge, .status {
    display: inline-block;
    padding: 0.13rem 0.5rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.badge-asset      { background: var(--info-bg); color: var(--info); }
.badge-liability  { background: var(--danger-bg); color: var(--danger); }
.badge-equity     { background: #f1e9fe; color: #6d28d9; }
.badge-income     { background: var(--success-bg); color: var(--success); }
.badge-expense    { background: var(--warning-bg); color: var(--warning); }
.badge-journal    { background: #eef0f4; color: #43485a; }
.badge-payment    { background: var(--danger-bg); color: var(--danger); }
.badge-receipt    { background: var(--success-bg); color: var(--success); }
.badge-contra     { background: #e7e9fc; color: #4338ca; }

.status-posted    { background: var(--success-bg); color: var(--success); }
.status-draft     { background: var(--warning-bg); color: var(--warning); }
.status-cancelled { background: var(--danger-bg); color: var(--danger); }

/* ============ FILTER TABS (segmented control) ============ */
.filter-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 1.1rem;
    padding: 3px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.filter-tabs a {
    padding: 0.4rem 0.95rem;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.79rem;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
}

.filter-tabs a:hover { color: var(--text); }

.filter-tabs a.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(15,23,42,0.08);
}

/* ============ INLINE SLIDE-DOWN PANEL (create/edit without leaving the page) ============ */
.slide-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-raised);
    margin-bottom: 1.1rem;
    overflow: hidden;
    animation: slideDown 0.18s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}

.slide-panel-header h2 { margin: 0; }

.slide-panel-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
}

.slide-panel-close:hover { background: var(--border); color: var(--text); }

.slide-panel-body {
    padding: 1.2rem 1.3rem 1.4rem;
}

.slide-panel-body label {
    display: block;
    margin-bottom: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

.slide-panel-body label input,
.slide-panel-body label select,
.slide-panel-body label textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--surface);
}

.slide-panel-body label input:focus,
.slide-panel-body label select:focus,
.slide-panel-body label textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.slide-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem 1.3rem;
    margin-bottom: 1.1rem;
}

.slide-panel-grid label { margin-bottom: 0; }

.slide-panel-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.slide-panel-grid.cols-1 { grid-template-columns: 1fr; }

.span-2 { grid-column: span 2; }

@media (max-width: 800px) {
    .slide-panel-grid,
    .slide-panel-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .slide-panel-grid,
    .slide-panel-grid.cols-3 { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
}

.btn-toolbar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

/* ============ CONFIRM MODAL (delete / deactivate) ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.is-visible { display: flex; }

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    animation: modalPop 0.16s ease;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.4rem auto 0;
}

.modal-icon svg { width: 22px; height: 22px; }

.modal-body { padding: 0.9rem 1.5rem 1.4rem; text-align: center; }

.modal-body h3 { margin: 0 0 0.4rem; font-size: 1rem; }

.modal-body p { margin: 0; font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; }

.modal-actions {
    display: flex;
    gap: 0.6rem;
    padding: 0 1.5rem 1.5rem;
}

.modal-actions .btn { flex: 1; justify-content: center; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; }

/* ============ ROLE PERMISSION MATRIX (Users page) ============ */
.role-matrix-wrap { overflow-x: auto; }

.role-matrix th, .role-matrix td { text-align: center; }
.role-matrix td:first-child, .role-matrix th:first-child { text-align: left; }

.perm-yes { color: var(--success); font-weight: 700; }
.perm-no { color: var(--border-strong); }
.perm-partial { color: var(--warning); font-weight: 700; font-size: 0.7rem; }


/* ============ FORMS ============ */
.form-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.3rem 1.4rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    max-width: 720px;
}

.form-card label {
    display: block;
    margin-bottom: 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.form-card input, .form-card select, .form-card textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    margin-top: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--text);
}

.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-card input:disabled { background: var(--surface-alt); color: var(--text-faint); }

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

/* ============ ALERTS ============ */
.alert {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(21,128,61,0.18); }
.alert-error   { background: var(--danger-bg); color: var(--danger); border-color: rgba(185,28,28,0.18); }

/* ============ RESPONSIVE ============ */
@media (max-width: 880px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0,0,0,0.25);
    }

    .sidebar.is-open { transform: translateX(0); }

    .app-main { margin-left: 0; }



    .app-topbar { display: flex; }
    .sidebar-toggle { display: flex; }
    .topbar-brand   { display: block; }

    .container { padding: 1.1rem 1rem 2.2rem; }

    .page-header { flex-direction: column; align-items: stretch; }

    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* ============ DASHBOARD DATE RANGE BAR ============ */
.dash-range-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.dash-range-btn {
    padding: 0.38rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.12s;
    white-space: nowrap;
}

.dash-range-btn:hover { border-color: var(--primary); color: var(--primary); }
.dash-range-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.dash-range-custom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.dash-range-custom input[type="date"] {
    padding: 0.38rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--surface);
}

/* ============ COA CODE GUIDE ============ */
.coa-code-guide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
    padding: 0.65rem 0.85rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
}

.coa-code-range {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.asset-range     { background: var(--info-bg);    color: var(--info); }
.liability-range { background: var(--danger-bg);  color: var(--danger); }
.equity-range    { background: #f1e9fe;            color: #6d28d9; }
.income-range    { background: var(--success-bg); color: var(--success); }
.expense-range   { background: var(--warning-bg); color: var(--warning); }

.ac-type-hint {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.3rem;
}
.ac-hint-ok   { color: var(--success); }
.ac-hint-warn { color: var(--warning); }

/* ============ ACTION BUTTONS (small pill buttons in table rows) ============ */
.act-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.24rem 0.6rem;
    border-radius: 6px;
    font-size: 0.73rem;
    font-weight: 700;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
    transition: filter 0.12s, transform 0.1s;
    font-family: var(--font-sans);
}
.act-btn:hover { filter: brightness(0.96); text-decoration: none; }
.act-btn:active { transform: scale(0.96); }
.act-btn.view      { background: #eef2f7; color: #475569; }
.act-btn.reconcile { background: #dbeafe; color: #1d4ed8; }
.act-btn.edit       { background: #fef3c7; color: #92400e; }
.act-btn.activate   { background: #dcfce7; color: #15803d; }
.act-btn.deactivate { background: #fef3c7; color: #b45309; }
.act-btn.danger     { background: #ffedd5; color: #c2410c; }
.act-btn.del        { background: #fee2e2; color: #b91c1c; }

/* Clickable status badge (Active/Inactive) — same look as .status/.badge
   but with a pointer cursor and subtle hover lift, since clicking it
   toggles the account's active state directly. */
.status-toggle {
    cursor: pointer;
    border: none;
    transition: transform 0.1s, filter 0.12s;
    font-family: var(--font-sans);
}
.status-toggle:hover { filter: brightness(0.95); }
.status-toggle:active { transform: scale(0.95); }

/* ============ REPORT PAGES ============ */

.nav-group-label {
    display: block;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6b85;
    padding: 0.9rem 0.7rem 0.25rem;
}

/* ── Collapsible sidebar group headers (Inventory, Sales, Purchase, etc.) ─
   Each group's label is inside a clickable header row with an arrow;
   clicking it collapses/expands that group's items. State is remembered
   per-tab (sessionStorage) so it persists across page navigations, same
   as the sidebar's own collapse/scroll memory. */
.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding-right: 0.7rem;
    padding-left: 0.7rem;
    flex-shrink: 0;
}
.nav-group-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-right: 0.55rem;
    color: #6b7a99;
    transition: transform 0.28s cubic-bezier(.34,1.56,.64,1), color 0.18s ease;
}
.nav-group-header:hover .nav-group-icon {
    color: #c7d2fe;
    transform: scale(1.15) rotate(-8deg);
}
.nav-group-header .nav-group-label { flex: 1; min-width: 0; padding: 0.9rem 0 0.25rem 0; }
.nav-group-header:hover .nav-group-label { color: #cbd5e1; }
.nav-group-arrow {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #5f6b85;
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), color 0.18s ease;
}
.nav-group-header:hover .nav-group-arrow { color: #94a3b8; transform: translateY(1px); }
.nav-group-header.is-collapsed .nav-group-arrow { transform: rotate(-90deg); }
.nav-group-header.is-collapsed:hover .nav-group-arrow { transform: rotate(-90deg) translateY(1px); }
.nav-group-body {
    max-height: 1200px;
    overflow: hidden;
    opacity: 1;
    flex-shrink: 0; /* .sidebar-nav is a column flexbox — without this, the
                        browser can shrink/expand this row unpredictably. */
    transition: max-height 0.32s cubic-bezier(.4,0,.2,1), opacity 0.24s ease;
}
.nav-group-body.is-collapsed {
    max-height: 0;
    opacity: 0;
}
/* Icon-only collapsed sidebar: groups are never body-collapsed (labels/
   arrows are hidden anyway, and icons must stay reachable). */
.sidebar.is-collapsed .nav-group-body { max-height: none !important; opacity: 1 !important; }
.sidebar.is-collapsed .nav-group-arrow { display: none !important; }
.sidebar.is-collapsed .nav-group-icon { margin-right: 0; }

/* Prevents the "flash of wrong state" on page load: while the tiny inline
   script (in sidebar.php, right after the nav) is deciding which groups
   should start expanded, transitions are suppressed — so the very first
   paint already shows the correct final state instead of animating from
   the server-rendered default. Removed a tick later once decided. */
.nav-group-body.no-transition, .nav-group-header.no-transition .nav-group-arrow {
    transition: none !important;
}

.nav-item-sub {
    padding-left: 0.9rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

.gl-lines-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.gl-lines-table {
    min-width: 720px;
}

.gl-lines-table th, .gl-lines-table td {
    white-space: normal;
}

.gl-lines-table select,
.gl-lines-table input {
    width: 100%;
    padding: 0.38rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.btn-remove-line {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 1.05rem;
    cursor: pointer;
    line-height: 1;
}

.btn-remove-line:hover { background: #fbdada; }

.gl-lines-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.gl-totals {
    display: flex;
    gap: 1.1rem;
    font-size: 0.83rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.balance-indicator {
    font-weight: 700;
    padding: 0.18rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-muted);
}

.balance-indicator.balance-ok {
    background: var(--success-bg);
    color: var(--success);
}

.balance-indicator.balance-bad {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Filter bar (history & ledger pages) */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    margin-bottom: 1.1rem;
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-muted);
    gap: 0.28rem;
}

.filter-bar input,
.filter-bar select {
    padding: 0.42rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    min-width: 150px;
    font-family: var(--font-sans);
}

/* Voucher meta grid (view & ledger pages) */
.voucher-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.1rem;
}

.voucher-meta-item {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    font-size: 0.86rem;
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.1rem 0;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1.8rem 0;
}

table tfoot td {
    border-top: 2px solid var(--border-strong);
    border-bottom: none;
    font-weight: 700;
}

/* Checkbox label (used in customer/supplier edit forms) */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Inline VAT % label inside gl-totals row */
.inline-vat-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    margin: 0;
}

.inline-vat-label input {
    padding: 0.28rem 0.5rem;
    margin: 0;
}

/* Quick action button row (Cash & Bank index page) */
.quick-actions-row {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.1rem;
    flex-wrap: wrap;
}


/* ════════════════════════════════════════════════════════════════════
   GLOBAL RESPONSIVE SAFETY NET
   Applies across all pages regardless of inline styles.
   Forces two-column grids/flex layouts to stack on small screens,
   and prevents horizontal scroll/overflow.
   ════════════════════════════════════════════════════════════════════ */

/* Prevent any element from forcing horizontal scroll */
html, body { overflow-x: hidden; max-width: 100%; }
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
table { max-width: 100%; }

/* Tablet & below: collapse most 2-3 column layouts to a single column */
@media (max-width: 900px) {
    /* Generic grid layouts used across forms (e.g. grid-template-columns:1fr 1fr) */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    /* Flex rows with multiple side-by-side blocks wrap instead of overflowing
       (excludes sidebar/app-shell structural containers) */
    [style*="display:flex"][style*="gap"]:not(.sidebar, .app-shell, .app-main) {
        flex-wrap: wrap !important;
    }
}

/* Mobile: tighten padding and stack everything further */
@media (max-width: 600px) {
    .container, main.container { padding: 1rem 0.75rem 2rem !important; }

    /* Two-column summary/payment panels (sales, purchase forms) */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Tables that are too wide: allow horizontal scroll within a contained wrapper
       instead of breaking the page layout */
    table { display: block; overflow-x: auto; white-space: nowrap; }
    thead, tbody, tr { display: revert; }

    /* Action button rows wrap instead of overflowing */
    .btn-toolbar, [class*="action-bar"] { flex-wrap: wrap !important; }

    /* Form label/value rows that were side-by-side become stacked */
    [style*="display:flex"][style*="justify-content:space-between"] {
        flex-wrap: wrap !important;
    }
}

/* Extra-narrow phones */
@media (max-width: 380px) {
    .container, main.container { padding: 0.75rem 0.6rem 1.5rem !important; }
    h1 { font-size: 1.2rem !important; }
}


/* ════════════════════════════════════════════════════════════════════
   COLLAPSIBLE SIDEBAR
   ════════════════════════════════════════════════════════════════════ */
.sidebar { transition: width 0.2s ease, transform 0.25s ease; overflow: visible; }

.sidebar-toggle-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    position: absolute !important;
    top: 1.2rem !important;
    right: -13px !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    background-color: #0b1220 !important;
    border: 1.5px solid rgba(255,255,255,0.25) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    transition: background-color 0.15s ease !important;
}
.sidebar-toggle-btn:hover { background-color: #1e293b !important; }
.sidebar-toggle-btn svg {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    flex-shrink: 0 !important;
    display: block !important;
    color: #ffffff !important;
    stroke: #ffffff !important;
    transition: transform 0.2s ease !important;
}

/* Collapsed state */
.sidebar.is-collapsed { width: 64px; }
.sidebar.is-collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }
.sidebar.is-collapsed .brand-name,
.sidebar.is-collapsed .nav-item span,
.sidebar.is-collapsed .nav-group-label,
.sidebar.is-collapsed #menuSearch,
.sidebar.is-collapsed .sidebar-brand + div {
    display: none !important;
}
.sidebar.is-collapsed .sidebar-brand { justify-content: center; padding: 1.15rem 0.6rem; }
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 0.5rem; }
.sidebar.is-collapsed .nav-icon { margin: 0; }

/* Tooltip on hover when collapsed */
.sidebar.is-collapsed .nav-item { position: relative; }
.sidebar.is-collapsed .nav-item:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 999;
    pointer-events: none;
}

.app-main { transition: margin-left 0.2s ease; }
.app-shell.is-sidebar-collapsed .app-main { margin-left: 64px; }


/* ════════════════════════════════════════════════════════════════════
   MOBILE: neutralize desktop sidebar-collapse toggle
   Placed at the very end of the stylesheet so it always wins the
   cascade over the desktop .sidebar-toggle-btn rules defined earlier.
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 880px) {
    .sidebar-toggle-btn { display: none !important; }
    .sidebar.is-collapsed { width: var(--sidebar-width) !important; }
    .sidebar.is-collapsed .brand-name,
    .sidebar.is-collapsed .nav-item span,
    .sidebar.is-collapsed .nav-group-label,
    .sidebar.is-collapsed #menuSearch,
    .sidebar.is-collapsed .sidebar-brand + div {
        display: revert !important;
    }
    .sidebar.is-collapsed .sidebar-brand { justify-content: flex-start !important; padding: 1.15rem 1.1rem !important; }
    .sidebar.is-collapsed .nav-item { justify-content: flex-start !important; padding: 0.46rem 0.7rem !important; }
    .app-shell.is-sidebar-collapsed .app-main { margin-left: 0 !important; }
    /* On mobile the desktop icon-only mode never actually applies (the menu
       is always shown full-width via the hamburger), so group collapsing
       should keep working normally instead of being force-expanded. */
    .sidebar.is-collapsed .nav-group-arrow { display: block !important; }
    .sidebar.is-collapsed .nav-group-body { max-height: 1200px !important; opacity: 1 !important; }
    .sidebar.is-collapsed .nav-group-body.is-collapsed { max-height: 0 !important; opacity: 0 !important; }
}


/* ════════════════════════════════════════════════════════════════════
   CATEGORY FILTER STRIPS (product search in New Sale / New Purchase)
   Forces horizontal scroll within the available width instead of
   overflowing the page and pushing content off-screen on smaller
   monitors/laptops.
   ════════════════════════════════════════════════════════════════════ */
.cat-strip {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.35rem !important;
}
.cat-strip::-webkit-scrollbar { height: 5px; }
.cat-strip::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.cat-strip .cat-chip,
.cat-strip button {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Ensure the wrapping card/container can't be forced wider than the
   viewport by its children (this is the root cause of the right-side
   panel being pushed off-screen) */
.cat-strip,
.cat-strip ~ * {
    min-width: 0;
}


/* ════════════════════════════════════════════════════════════════════
   POS-STYLE LAYOUTS (New Sale / New Purchase: product list + summary)
   Grid items default to min-width:auto, which lets long content (like
   the category filter strip) force the whole grid wider than the
   viewport, pushing the right-hand summary panel off-screen. Setting
   min-width:0 lets the left column shrink and scroll internally instead.
   ════════════════════════════════════════════════════════════════════ */
.pos-layout { min-width: 0; max-width: 100%; }
.pos-layout > * { min-width: 0; }

/* ════════════════════════════════════════════════════════════════════
   Hide browser-native password reveal/clear icons (Edge/IE add their
   own eye icon inside <input type="password">, via these vendor
   pseudo-elements). Several pages already have a custom show/hide
   button, and without this the native one renders on top of it,
   looking like two overlapping eye icons.
   ════════════════════════════════════════════════════════════════════ */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }

/* ════════════════════════════════════════════════════════════════════
   PRINT — hide navigation chrome everywhere (sidebar, topbar/hamburger,
   action buttons) so printing any page only shows the actual content,
   not the app's menu. Anything else that shouldn't appear on a printed
   page can opt in with class="no-print".
   ════════════════════════════════════════════════════════════════════ */
@media print {
    .sidebar, .sidebar-overlay, .sidebar-toggle-btn,
    .app-topbar, .mobile-topbar,
    #qaFabWrap,
    .no-print {
        display: none !important;
    }
    .app-shell, .app-main {
        margin-left: 0 !important;
        display: block !important;
        width: 100% !important;
    }
    body { background: #fff !important; }
    .container { max-width: 100% !important; }
    a[href]::after { content: '' !important; } /* don't print raw URLs after links */
}
