:root {
    --ink: #1d242c;
    --muted: #67727f;
    --line: #dfe5eb;
    --paper: #ffffff;
    --mist: #f4f7f9;
    --nav: #102129;
    --nav-soft: #18323d;
    --accent: #b2472f;
    --accent-dark: #883522;
    --green: #177245;
    --amber: #b86b00;
    --red: #b42318;
    --blue: #245d85;
    --radius: 8px;
    --sidebar-w: 246px;
    --topbar-h: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--mist);
    color: var(--ink);
    font-family: "Trebuchet MS", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ── Login ──────────────────────────────────────────────── */
.login-page {
    min-height: 100svh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #edf3f5, #f8f4ef);
    padding: 16px;
}
.login-shell {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1fr 380px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(16, 33, 41, .12);
}
.login-brand { padding: 48px; background: var(--nav); color: white; }
.login-brand h1 { margin: 0 0 16px; font-size: 42px; line-height: 1; }
.login-brand p { color: #b8c6cc; line-height: 1.7; max-width: 480px; }
.login-card { padding: 36px; }

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
    min-height: 100svh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    background: var(--nav);
    color: white;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100svh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 30;
    display: flex;
    flex-direction: column;
}
.brand { font-size: 20px; font-weight: 800; margin-bottom: 3px; letter-spacing: .2px; }
.brand-sub { color: #98aab3; font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; }
.role-card { margin: 20px 0; padding: 11px 12px; background: var(--nav-soft); border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); }
.role-card small { display: block; color: #a8bac2; margin-bottom: 4px; font-size: 11px; }
.role-card strong { font-size: 14px; }
.role-card .muted { color: #98aab3; font-size: 12px; }
.nav-section { margin: 20px 8px 5px; color: #91a5ae; font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.nav-section:first-of-type { margin-top: 4px; border-top: none; padding-top: 0; }
.nav-link { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: var(--radius); color: #d8e3e7; margin-bottom: 2px; font-size: 14px; transition: background .12s; }
.nav-link.active, .nav-link:hover { background: var(--accent); color: white; }
.nav-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.logout-button { width: 100%; margin-top: auto; padding: 10px; border: 1px solid rgba(255,255,255,.15); color: #a8bac2; background: transparent; border-radius: var(--radius); cursor: pointer; font-size: 13px; text-align: left; padding-left: 12px; }
.logout-button:hover { background: rgba(255,255,255,.06); color: white; }

/* ── Hamburger (hidden on desktop) ─────────────────────── */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--ink);
    border-radius: var(--radius);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.hamburger-btn:hover { background: var(--mist); }
.hamburger-icon { width: 20px; height: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.hamburger-icon span { display: block; height: 2px; background: currentColor; border-radius: 2px; }

/* Overlay behind open drawer */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16,33,41,.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

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

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 10px;
}
.topbar-left { min-width: 0; flex: 1; }
.topbar h2 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar > div:first-of-type span { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Content ────────────────────────────────────────────── */
.content { padding: 22px; flex: 1; }

/* ── Grids ──────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr .8fr; gap: 12px; }

/* ── Card ───────────────────────────────────────────────── */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }

/* ── Metric ─────────────────────────────────────────────── */
.metric small { color: var(--muted); display: block; margin-bottom: 6px; font-size: 12px; }
.metric strong { font-size: 22px; word-break: break-all; }
.metric.good { border-top: 3px solid var(--green); }
.metric.warn { border-top: 3px solid var(--amber); }
.metric.hot  { border-top: 3px solid var(--accent); }
.metric.info { border-top: 3px solid var(--blue); }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* ── Buttons ────────────────────────────────────────────── */
.button {
    border: 0;
    background: var(--accent);
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.button:hover { background: var(--accent-dark); }
.button:active { opacity: .85; }
.button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.button.secondary:hover { background: var(--mist); }
.button.danger { background: var(--red); }
.button.mini { padding: 6px 10px; font-size: 12px; }

/* ── Form Elements ──────────────────────────────────────── */
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 11px;
    background: white;
    font-size: 16px; /* prevents iOS auto-zoom */
    -webkit-appearance: none;
    appearance: none;
}
.input:focus { outline: 2px solid rgba(178,71,47,.2); border-color: var(--accent); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin-bottom: 12px;
}
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th {
    text-align: left;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    border-bottom: 1px solid var(--line);
    padding: 9px 10px;
    white-space: nowrap;
    background: var(--mist);
}
td { border-bottom: 1px solid var(--line); padding: 10px; font-size: 13px; vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #edf1f4; color: var(--muted); white-space: nowrap; }
.badge.green { color: var(--green); background: #e8f4ee; }
.badge.red   { color: var(--red);   background: #fbecea; }
.badge.amber { color: var(--amber); background: #fff4dd; }

/* ── POS Layout ─────────────────────────────────────────── */
.pos-grid { display: grid; grid-template-columns: 1fr 360px; gap: 14px; align-items: start; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.product-card {
    text-align: left;
    border: 1px solid var(--line);
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    min-height: 120px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: border-color .12s, box-shadow .12s;
}
.product-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(16,33,41,.08); }
.product-card:active { background: #fdf8f7; }
.product-card strong { display: block; margin: 5px 0; font-size: 13px; }
.product-card small { color: var(--muted); display: block; font-size: 11px; line-height: 1.4; }
.product-card .money { font-size: 13px; margin: 4px 0 0; }

/* ── Cart ───────────────────────────────────────────────── */
.cart-line { display: grid; grid-template-columns: 1fr 72px 88px 28px; gap: 6px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cart-line input { padding: 7px; }

/* ── Payment Summary ────────────────────────────────────── */
.summary-row { display: flex; justify-content: space-between; margin: 7px 0; font-size: 14px; }
.summary-row.total { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 900; font-size: 17px; }
.summary-row.discount { color: var(--green); }
.payment-preview { background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.change-row { background: #e8f4ee; border: 1px solid #cbe6d7; color: var(--green); border-radius: var(--radius); padding: 10px 12px; font-weight: 900; }

/* ── POS Mobile Tab Bar (hidden on desktop) ─────────────── */
.pos-tab-bar { display: none; }

/* ── Alerts ─────────────────────────────────────────────── */
.notice { padding: 11px 13px; border-radius: var(--radius); margin-bottom: 12px; background: #e8f4ee; color: var(--green); border: 1px solid #cbe6d7; font-size: 14px; }
.error  { padding: 11px 13px; border-radius: var(--radius); margin-bottom: 12px; background: #fbecea; color: var(--red);   border: 1px solid #f2cac4; font-size: 14px; }

/* ── Chart ──────────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 140px; padding-bottom: 26px; margin-top: 8px; }
.bar { flex: 1; min-width: 16px; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; opacity: 0.65; transition: opacity .15s; min-height: 8px; }
.bar:hover, .bar.bar-today { opacity: 1; }
.bar-label { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.bar-val   { position: absolute; top: -16px;  left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; }

/* ── Misc ───────────────────────────────────────────────── */
.muted { color: var(--muted); }
.money { font-weight: 800; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pagination a, .pagination span.page-disabled { padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.pagination a { color: var(--ink); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-toggle { position: fixed; opacity: 0; pointer-events: none; }
.modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(16,33,41,.52); }
.modal-toggle:checked + .modal { display: flex; }
.modal-card { width: min(760px, 100%); max-height: min(720px, 92svh); overflow-y: auto; overflow-x: hidden; background: white; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 30px 90px rgba(16,33,41,.22); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: white; z-index: 1; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.detail-box { background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.detail-box small { color: var(--muted); display: block; margin-bottom: 4px; font-size: 11px; }
.detail-box strong { font-size: 14px; word-break: break-word; }

/* ── Bulk Table ─────────────────────────────────────────── */
.bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bulk-table th { background: var(--nav); color: white; padding: 8px 6px; text-align: left; font-size: 11px; white-space: nowrap; }
.bulk-table td { padding: 5px 4px; vertical-align: top; border-bottom: 1px solid var(--line); }
.bulk-table .input { min-width: 80px; padding: 6px 8px; font-size: 13px; }
.bulk-table select.input { min-width: 100px; }
.bulk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══════════════════════════════════════════════════════
   TABLET (≤1100px)
═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    :root { --sidebar-w: 220px; }
    .pos-grid { grid-template-columns: 1fr 310px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr 300px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════
   MOBILE (≤820px) — sidebar becomes off-canvas drawer
═══════════════════════════════════════════════════════ */
@media (max-width: 820px) {
    /* Shell: single column */
    .app-shell { grid-template-columns: 1fr; }

    /* Sidebar: fixed off-canvas drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100svh;
        width: 272px;
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
        box-shadow: 4px 0 32px rgba(16,33,41,.18);
        z-index: 30;
    }
    .sidebar.open { transform: translateX(0); }

    /* Overlay */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(16,33,41,.5);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s;
    }
    .sidebar-overlay.open { opacity: 1; pointer-events: auto; }

    /* Show hamburger */
    .hamburger-btn { display: inline-flex; }

    /* Topbar */
    .topbar { padding: 0 14px; height: 54px; }
    .topbar h2 { font-size: 15px; }

    /* Content */
    .content { padding: 14px; }

    /* Grids */
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { padding: 28px 24px; }
    .login-brand h1 { font-size: 28px; }
    .login-brand p { display: none; }

    /* Detail grid in modals */
    .detail-grid { grid-template-columns: repeat(2, 1fr); }

    /* POS: switch to tabbed layout */
    .pos-grid { display: block; }
    .pos-grid > section { display: none; }
    .pos-grid > aside.card { display: none; }
    .pos-grid > section.pos-panel-active { display: block; }
    .pos-grid > aside.card.pos-panel-active { display: block; }

    /* Tab bar */
    .pos-tab-bar {
        display: flex;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        overflow: hidden;
        margin-bottom: 12px;
    }
    .pos-tab {
        flex: 1;
        padding: 11px 8px;
        border: none;
        background: none;
        font-size: 14px;
        font-weight: 600;
        color: var(--muted);
        cursor: pointer;
        transition: background .12s, color .12s;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .pos-tab.active { background: var(--accent); color: white; }
    .pos-tab-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--accent);
        color: white;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 800;
        padding: 1px 6px;
        margin-left: 4px;
        min-width: 20px;
    }
    .pos-tab.active .pos-tab-count { background: rgba(255,255,255,.3); color: white; }

    /* Product grid: 2 cols on mobile */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .product-card { min-height: 100px; padding: 10px; }
    .product-card strong { font-size: 12px; }

    /* Search full width */
    .toolbar .input { max-width: 100% !important; }
    .toolbar { gap: 6px; }
}

/* ═══════════════════════════════════════════════════════
   SMALL MOBILE (≤480px)
═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .metric strong { font-size: 18px; }
    .content { padding: 12px; }
    .cart-line { grid-template-columns: 1fr 56px 78px 26px; gap: 4px; }
    .summary-row.total { font-size: 15px; }
    .pos-tab { font-size: 13px; padding: 10px 6px; }
    .topbar h2 { font-size: 14px; }
    .topbar > div:last-child > span { display: none; }
}

/* ═══════════════════════════════════════════════════════
   VERY SMALL (≤360px)
═══════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .pos-tab { font-size: 12px; padding: 9px 4px; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* ── Toast (injected via layout) ───────────────────────── */
/* (styles are inline in layout for standalone pages too)   */

/* ── Products table mobile: wrap action column ─────────── */
.product-action-cell { white-space: nowrap; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* ── Filter toolbar: always wraps neatly ───────────────── */
.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.filter-bar .input { flex: 1; min-width: 160px; }
.filter-bar input[type="date"] { flex: 0 0 140px; }

/* ── Bulk table: better mobile scroll hint ──────────────── */
.bulk-table-wrap {
    position: relative;
}
.bulk-table-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,.8));
    pointer-events: none;
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Dashboard sections: better spacing on mobile ───────── */
.section-gap { margin-top: 14px; }

/* ── Notification badge pulse ───────────────────────────── */
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}
.badge-pulse { animation: pulse-badge 1.8s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════
   TABLET PORTRAIT (≤900px) extra fixes
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .pos-grid { grid-template-columns: 1fr 290px; }
    .grid-4   { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════
   MOBILE (≤820px) additions
══════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
    /* Reports filter bar: stack date inputs */
    .filter-bar input[type="date"] { flex: 1 1 130px; min-width: 120px; }

    /* Metrics: 2 columns always, smaller numbers */
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .metric strong { font-size: 19px; }

    /* Card padding tighter on mobile */
    .card { padding: 14px; }

    /* Table font size reduction for dense tables */
    td { font-size: 12px; padding: 8px 8px; }
    th { font-size: 10px; padding: 7px 8px; }

    /* Modal: full-width on mobile */
    .modal { padding: 8px; align-items: flex-end; }
    .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 90svh;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    /* Bulk table: show scroll hint */
    .bulk-table-wrap::after { display: block; }

    /* Chart bars: smaller labels */
    .bar-label { font-size: 8px; }
    .bar-val   { font-size: 8px; }

    /* Toolbar: stack on mobile */
    .toolbar { gap: 6px; }
    .toolbar .button { font-size: 13px; padding: 9px 11px; }

    /* Products table: hide less important cols on mobile */
    .col-hide-mobile { display: none; }

    /* Delete button in table */
    .product-action-cell .button { padding: 5px 8px; font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════
   SMALL MOBILE (≤480px) additions
══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Login: single column */
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { padding: 20px 18px; }
    .login-card  { padding: 20px 18px; }

    /* Topbar right: hide "Owner/Kasir" label to save space */
    .topbar-role-label { display: none; }

    /* Metric cards: 2 cols */
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .metric strong { font-size: 16px; }
    .metric small  { font-size: 11px; }

    /* Cart: tighter column layout */
    .cart-line { grid-template-columns: 1fr 50px 72px 24px; gap: 4px; font-size: 12px; }

    /* Detail grid: single column */
    .detail-grid { grid-template-columns: 1fr; }

    /* Bulk table inputs: smaller */
    .bulk-table .input { font-size: 12px; padding: 5px 6px; min-width: 70px; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE DASHBOARD + PRODUCTS IMPROVEMENTS
══════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
    /* Dashboard: invoice numbers truncate cleanly */
    td { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    td.no-truncate { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }

    /* Stok Perlu Perhatian: text doesn't overflow card */
    .toolbar > div { min-width: 0; overflow: hidden; }
    .toolbar > div .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }

    /* Filter bar: search takes full width, buttons shrink */
    .filter-bar { flex-wrap: wrap; }
    .filter-bar .input { flex: 1 1 100%; }
    .filter-bar .button { flex: 1; }

    /* Toolbar on products page: full-width search */
    .toolbar.toolbar-search { flex-direction: column; align-items: stretch; }
    .toolbar.toolbar-search form { width: 100%; display: flex; gap: 8px; }
    .toolbar.toolbar-search form .input { flex: 1; }

    /* Products table: action buttons stack vertically */
    .product-action-cell { flex-direction: column; align-items: flex-start; }

    /* Restock form: single column on mobile */
    .grid-2[data-restock] { grid-template-columns: 1fr; }

    /* Card h3: slightly smaller on mobile */
    .card h3 { font-size: 14px; margin-bottom: 10px; }

    /* Metric label: shorter */
    .metric small { font-size: 11px; }
}

@media (max-width: 480px) {
    /* Tables: let cells wrap naturally, no forced truncate on small screens */
    td { white-space: normal; max-width: none; }

    /* Invoice numbers: truncate at sensible width */
    .invoice-cell { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

    /* Low stock SKU line: hide on very small screens */
    .sku-line { display: none; }

    /* Stok Perlu Perhatian badge: float right */
    .stock-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
    .stock-row:last-child { border-bottom: none; }
    .stock-row-info { min-width: 0; flex: 1; }
    .stock-row-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .stock-row-info small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
}
