/* =====================================================================
   MotoParts POS — Motorcycle Parts & Accessories Shop
   Tablet-first responsive stylesheet + thermal receipt print styles.
   No external fonts/CDNs — system font stack only (works offline on LAN).
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
    --bg:            #0f1722;
    --bg-soft:       #16202e;
    --panel:         #1c2836;
    --panel-2:       #22303f;
    --border:        #2d3d4f;
    --text:          #e8eef5;
    --text-dim:      #9fb0c3;
    --muted:         #7d8fa3;

    --brand:         #f59e0b;   /* amber — motorcycle shop energy */
    --brand-dark:    #d97706;
    --accent:        #2563eb;   /* blue */
    --accent-dark:   #1d4ed8;

    --green:         #16a34a;
    --green-soft:    #14532d;
    --red:           #dc2626;
    --red-soft:      #5b1d1d;
    --blue-soft:     #1e3a5f;
    --gray-soft:     #374151;

    --radius:        14px;
    --radius-sm:     9px;
    --shadow:        0 8px 24px rgba(0, 0, 0, .35);
    --tap:           48px;      /* minimum touch target */
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.45;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--accent); text-decoration: none; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255, 255, 255, .06);
    padding: .1em .4em;
    border-radius: 5px;
    font-size: .9em;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* =====================================================================
   TOP BAR + NAVIGATION (tablet)
   ===================================================================== */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem 1rem;
    background: linear-gradient(180deg, var(--bg-soft), var(--panel));
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: wrap;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
}
.brand-icon { font-size: 1.5rem; }
.brand-name strong { color: var(--brand); }

.topbar-nav {
    display: flex;
    gap: .4rem;
    flex: 1 1 auto;
    justify-content: center;
    flex-wrap: wrap;
}
.nav-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 74px;
    min-height: var(--tap);
    padding: .35rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-weight: 600;
    font-size: .8rem;
    transition: background .15s, color .15s, transform .05s;
    user-select: none;
}
.nav-btn .nav-icon { font-size: 1.3rem; line-height: 1; }
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn:active { transform: scale(.96); }
.nav-btn.active {
    background: var(--brand);
    color: #1a1305;
}
.nav-btn.active .nav-icon { filter: grayscale(1) brightness(.2); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-left: auto;
}
.user-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}
.user-name { font-weight: 700; font-size: .9rem; }
.user-role { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* =====================================================================
   PAGE LAYOUT
   ===================================================================== */
.page-wrap {
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.page-header h1 { font-size: 1.5rem; margin: 0; }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
    padding: .6rem 1rem;
    min-height: var(--tap);
    cursor: pointer;
    user-select: none;
    transition: filter .15s, transform .05s, background .15s, opacity .15s;
    white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--panel-2); border-color: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-ghost     { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn-cash      { background: var(--green); color: #fff; }
.btn-gcash     { background: #0a7de0; color: #fff; }   /* GCash blue */

.btn-sm { min-height: 38px; padding: .35rem .7rem; font-size: .85rem; }
.btn-lg { min-height: 54px; padding: .7rem 1.3rem; font-size: 1.02rem; }
.btn-xl { min-height: 62px; padding: .8rem 1.5rem; font-size: 1.12rem; font-weight: 700; }
.btn-block { width: 100%; }

/* =====================================================================
   FORMS / FIELDS
   ===================================================================== */
.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .9rem;
}
.field > span {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-dim);
}
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field select,
.filter-input,
.filter-select {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    padding: .7rem .8rem;
    min-height: var(--tap);
    width: 100%;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus,
.filter-input:focus,
.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}
.check-field {
    flex-direction: row;
    align-items: center;
    gap: .6rem;
}
.check-field input[type="checkbox"] {
    width: 22px; height: 22px; accent-color: var(--accent);
}
.check-field > span { font-size: .95rem; color: var(--text); font-weight: 500; }

.input-huge {
    font-size: 1.5rem !important;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1rem;
}
.form-grid .span-2 { grid-column: span 2; }

.form-error {
    background: var(--red-soft);
    border: 1px solid var(--red);
    color: #ffb4b4;
    border-radius: var(--radius-sm);
    padding: .7rem .9rem;
    margin-bottom: .9rem;
    font-size: .9rem;
}

/* Filter bar (inventory / models / reports) */
.filter-bar {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .7rem;
}
.filter-bar .filter-input { flex: 1 1 220px; }
.filter-bar .filter-select { flex: 0 1 200px; }
.filter-check {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
    color: var(--text-dim);
    white-space: nowrap;
}
.filter-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.filter-date {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
    color: var(--text-dim);
}
.filter-date input { width: auto; }

/* =====================================================================
   TABLES
   ===================================================================== */
.table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem;
    overflow-x: auto;
    box-shadow: var(--shadow);
}
.card-title { font-size: 1.1rem; margin: 0 0 .7rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    min-width: 560px;
}
.data-table th, .data-table td {
    text-align: left;
    padding: .65rem .6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table thead th {
    color: var(--text-dim);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.data-table .num { text-align: right; }
.data-table .actions { white-space: nowrap; }
.data-table .actions .btn { margin-right: .3rem; margin-bottom: .2rem; }

.row-low td { background: rgba(220, 38, 38, .07); }
.row-inactive td { opacity: .5; }
.empty-cell { text-align: center; color: var(--muted); padding: 2rem 1rem !important; }

/* Pills + badges */
.pill {
    display: inline-block;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.pill-green { background: var(--green-soft); color: #7ef0a8; }
.pill-red   { background: var(--red-soft);   color: #ff9d9d; }
.pill-blue  { background: var(--blue-soft);  color: #9cc4ff; }
.pill-gray  { background: var(--gray-soft);  color: #c3ccd6; }

.stock-badge {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    padding: .2rem .5rem;
    border-radius: 7px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.stock-badge.ok  { background: var(--green-soft); color: #7ef0a8; }
.stock-badge.low { background: var(--red-soft);   color: #ff9d9d; }

/* =====================================================================
   POS LAYOUT
   ===================================================================== */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 1rem;
    align-items: start;
}
.pos-left, .pos-right { min-width: 0; }

.pos-searchbar {
    display: flex;
    gap: .6rem;
    margin-bottom: .9rem;
    flex-wrap: wrap;
}
.search-box {
    position: relative;
    flex: 1 1 300px;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: .8rem;
    font-size: 1.1rem;
    pointer-events: none;
}
.search-box input {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1.1rem;
    padding: .9rem .9rem .9rem 2.6rem;
    min-height: 58px;
    outline: none;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(245, 158, 11, .22); }
.model-filter {
    flex: 0 1 240px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .95rem;
    padding: 0 .8rem;
    min-height: 58px;
    outline: none;
}

/* Search results dropdown */
.search-results {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .9rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    max-height: 340px;
    overflow-y: auto;
}
.result-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: .7rem .9rem;
    cursor: pointer;
    min-height: var(--tap);
}
.result-row:last-child { border-bottom: none; }
.result-row:hover { background: var(--panel-2); }
.result-row .r-name { flex: 1 1 auto; font-weight: 600; }
.result-row .r-name small { display: block; color: var(--muted); font-weight: 400; }
.result-row .r-price { font-weight: 700; color: var(--brand); white-space: nowrap; }
.result-row .r-stock { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.result-row .r-stock.out { color: #ff9d9d; }
.result-empty { padding: 1rem; text-align: center; color: var(--muted); }

/* Quick items grid */
.quick-title { font-size: 1rem; color: var(--text-dim); margin: .4rem 0 .6rem; }
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .6rem;
}
.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: .8rem;
    min-height: 96px;
    cursor: pointer;
    text-align: left;
    transition: transform .05s, border-color .15s, background .15s;
}
.quick-btn:hover { border-color: var(--brand); background: var(--panel-2); }
.quick-btn:active { transform: scale(.97); }
.quick-btn:disabled { opacity: .45; cursor: not-allowed; }
.quick-name { font-weight: 600; font-size: .88rem; line-height: 1.25; }
.quick-price { color: var(--brand); font-weight: 700; font-size: 1rem; margin-top: auto; }
.quick-stock { font-size: .72rem; color: var(--muted); }
.quick-stock.out { color: #ff9d9d; font-weight: 700; }

/* Cart panel */
.cart-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    position: sticky;
    top: 76px;
    box-shadow: var(--shadow);
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cart-header h2 { font-size: 1.15rem; margin: 0; }

.cart-items {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 320px;
    overflow-y: auto;
    min-height: 90px;
}
.cart-empty {
    text-align: center;
    color: var(--muted);
    padding: 1.6rem .5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}
.cart-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .3rem .6rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .55rem .7rem;
}
.cart-line .cl-name { font-weight: 600; font-size: .9rem; grid-column: 1; }
.cart-line .cl-price { color: var(--muted); font-size: .8rem; grid-column: 1; }
.cart-line .cl-total { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; color: var(--brand); white-space: nowrap; }
.cart-line .cl-controls {
    grid-column: 1 / span 2;
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .2rem;
}
.qty-btn {
    width: 40px; height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.qty-btn:active { transform: scale(.94); }
.qty-val {
    min-width: 42px;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}
.cl-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: #ff9d9d;
    font-size: 1.1rem;
    cursor: pointer;
    padding: .3rem .5rem;
}

.cart-totals {
    border-top: 1px solid var(--border);
    padding-top: .6rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .95rem;
    color: var(--text-dim);
}
.total-row.grand {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    border-top: 1px dashed var(--border);
    padding-top: .45rem;
    margin-top: .2rem;
}
.total-row.grand span:last-child { color: var(--brand); }
.discount-row input {
    width: 130px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: .45rem .6rem;
    font-size: 1rem;
    text-align: right;
    min-height: 42px;
}

.pay-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
}

/* =====================================================================
   MODALS
   ===================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 10, 16, .7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
    overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
}
.modal-wide { max-width: 720px; }
.modal h2 { font-size: 1.25rem; margin-bottom: .8rem; }
.modal-subtitle { color: var(--text-dim); margin-top: -.4rem; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.1rem;
    flex-wrap: wrap;
}

/* Payment modal */
.payment-modal { max-width: 440px; text-align: center; }
.payment-total-display {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--brand);
    margin: .3rem 0 1rem;
    font-variant-numeric: tabular-nums;
}
.change-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-top: .8rem;
    font-size: 1rem;
    color: var(--text-dim);
}
.change-display strong { font-size: 1.6rem; color: var(--green); font-variant-numeric: tabular-nums; }
.change-display strong.neg { color: var(--red); }

.gcash-qr-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .9rem;
}
.gcash-qr { width: 220px; height: 220px; margin: 0 auto .4rem; }
.gcash-qr-box .muted { color: #555; margin: 0; }

/* Fitment picker */
.fitment-title { font-size: 1rem; margin: 1rem 0 .5rem; }
.fitment-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    max-height: 200px;
    overflow-y: auto;
    padding: .2rem;
}
.fit-chip {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    padding: .4rem .8rem;
    font-size: .82rem;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    transition: all .12s;
}
.fit-chip small { font-size: .68rem; opacity: .8; }
.fit-chip:hover { border-color: var(--accent); }
.fit-chip.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* =====================================================================
   REPORTS
   ===================================================================== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .7rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    box-shadow: var(--shadow);
}
.stat-card.cash  { border-left: 4px solid var(--green); }
.stat-card.gcash { border-left: 4px solid #0a7de0; }
.stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 1rem;
    align-items: start;
}

/* Sale detail line list (modal) */
.sale-detail-meta { margin-bottom: .8rem; color: var(--text-dim); font-size: .9rem; }
.sale-detail-meta div { display: flex; justify-content: space-between; padding: .15rem 0; }
.sale-lines { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: .6rem; }
.sale-lines th, .sale-lines td { padding: .4rem .3rem; border-bottom: 1px solid var(--border); text-align: left; }
.sale-lines .num { text-align: right; }

/* =====================================================================
   USERS / ROLE PERMISSIONS
   ===================================================================== */
.role-perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .9rem;
}
.role-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.role-card h3 { margin: 0; font-size: 1.05rem; }
.perm-check {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .45rem .5rem;
    border-radius: 8px;
    cursor: pointer;
}
.perm-check:hover { background: rgba(255, 255, 255, .04); }
.perm-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.perm-check input:disabled { accent-color: var(--muted); cursor: not-allowed; }
.perm-check > span { font-size: .85rem; line-height: 1.25; }
.btn-save-perms { margin-top: auto; }

/* =====================================================================
   LOGIN
   ===================================================================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: radial-gradient(1200px 600px at 50% -10%, #1b2a3d, var(--bg));
}
.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 2rem 1.8rem;
    width: 100%;
    max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 1.4rem; }
.login-logo { font-size: 3rem; display: block; margin-bottom: .3rem; }
.login-brand h1 { font-size: 1.6rem; margin: 0; }
.login-brand h1 strong { color: var(--brand); }
.login-brand p { color: var(--muted); margin: .2rem 0 0; font-size: .9rem; }
.login-hint {
    text-align: center;
    color: var(--muted);
    font-size: .76rem;
    margin: 1.2rem 0 0;
    line-height: 1.5;
}

/* =====================================================================
   EMPTY STATE (403 etc.)
   ===================================================================== */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 480px;
    margin: 0 auto;
}
.empty-icon { font-size: 4rem; margin-bottom: .5rem; }
.empty-state h2 { font-size: 1.5rem; }
.empty-state p { color: var(--text-dim); margin-bottom: 1.4rem; }

/* =====================================================================
   TOASTS
   ===================================================================== */
#toast-container {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 200;
    width: min(92vw, 420px);
    pointer-events: none;
}
.toast {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: .8rem 1rem;
    box-shadow: var(--shadow);
    font-size: .92rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s, transform .2s;
    pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--accent); }

/* =====================================================================
   RECEIPT (screen + print)
   ===================================================================== */
.receipt-modal { max-width: 380px; background: var(--panel); }
.receipt {
    background: #fff;
    color: #111;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    padding: 14px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}
.receipt .rc-center { text-align: center; }
.receipt .rc-title { font-size: 15px; font-weight: 700; }
.receipt .rc-hr { border-top: 1px dashed #999; margin: 6px 0; }
.receipt table { width: 100%; border-collapse: collapse; font-size: 12px; }
.receipt td { padding: 1px 0; vertical-align: top; }
.receipt .rc-r { text-align: right; }
.receipt .rc-total { font-size: 14px; font-weight: 700; }

/* =====================================================================
   RESPONSIVE BREAKPOINTS
   ===================================================================== */
@media (max-width: 1024px) {
    .pos-layout { grid-template-columns: 1fr 360px; }
    .reports-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .pos-layout { grid-template-columns: 1fr; }
    .cart-panel { position: static; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .topbar-nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
    .nav-btn { min-width: 66px; }
}
@media (max-width: 560px) {
    .page-wrap { padding: .7rem; }
    .pay-buttons { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .topbar-user .user-chip { display: none; }
}

/* =====================================================================
   SETTINGS — company branding + GCash QR
   ===================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: start;
}

.settings-actions {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    align-items: flex-start;
}

/* Image picker (logo + QR) */
.img-picker { display: flex; flex-direction: column; gap: .9rem; }

.img-preview {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    padding: .8rem;
}
.img-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
    background: #fff;          /* readable backdrop for transparent logos/QRs */
    border-radius: 6px;
    padding: 6px;
}
.logo-preview img { max-height: 140px; }
.img-preview.is-empty { border-style: dashed; }
.img-placeholder { font-size: 3rem; line-height: 1; }

.img-picker-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* File-picker button (label styled as a button wrapping a hidden input) */
.file-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Brand logo inside the top bar */
.brand-logo-img {
    height: 34px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* Login page logo image */
.login-logo-img {
    max-width: 120px;
    max-height: 90px;
    object-fit: contain;
    display: block;
    margin: 0 auto .5rem;
    border-radius: 10px;
}

/* Receipt branding */
.receipt .rc-logo {
    max-width: 120px;
    max-height: 70px;
    object-fit: contain;
    margin: 0 auto 4px;
    display: block;
}
.receipt .rc-sub { font-size: 11px; color: #333; }

/* =====================================================================
   PRINT — only the receipt is printed
   ===================================================================== */
@media print {
    body { background: #fff; }
    body * { visibility: hidden; }
    #receiptModal, #receiptModal * { visibility: visible; }
    #receiptModal {
        position: absolute;
        inset: 0;
        background: #fff;
        padding: 0;
        display: block;
    }
    #receiptModal .modal { box-shadow: none; border: none; max-width: none; }
    .no-print { display: none !important; }
    .receipt { color: #000; }
    @page { margin: 6mm; }
}
