﻿:root {
    --brand-primary: #0F7A80;
    --brand-primary-dark: #0A4F54;
    --brand-primary-hover: #116D73;
    --brand-primary-soft: #E8F6F6;
    --brand-primary-border: #CFE7E8;
    --brand-bg: #F8FAFA;
    --brand-surface: #FFFFFF;
    --brand-text: #2D2D2D;
    --brand-muted: #6B7280;
    --brand-success: #22C55E;
    --brand-warning: #F59E0B;
    --brand-danger: #DC2626;
    --green: var(--brand-primary);
    --green-dark: var(--brand-primary-dark);
    --green-soft: var(--brand-primary-soft);
    --bg: var(--brand-bg);
    --text: var(--brand-text);
    --muted: var(--brand-muted);
    --border: #E5EEEE;
    --white: #FFFFFF;
    --danger: var(--brand-danger);
    --warning: var(--brand-warning);
    --shadow: 0 2px 4px rgba(0,0,0,.03), 0 10px 24px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

body { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; font-weight: 400; }
h1, h2, h3, h4, .page-title, .section-title, .brand-title, .brand span, .brand-mobile strong, .login-card h1 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 700;
}

.app-shell { display: flex; min-width: 0; max-width: 100%; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; max-width: 100%; overflow-x: hidden; padding: 28px; padding-bottom: 88px; }
.sidebar { width: 280px; min-width: 280px; flex: 0 0 280px; background: #FFFFFF; border-right: 1px solid var(--border); padding: 26px 20px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; box-shadow: 1px 0 0 rgba(226, 238, 232, .55); }
.brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 10px 8px 28px; margin-bottom: 4px; text-align: center; border-bottom: 1px solid rgba(207, 231, 232, .8); }
.brand img { width: clamp(132px, 68%, 172px); max-height: 74px; object-fit: contain; }
.brand span { color: var(--text); font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: 0; }
.brand-mobile { display: none; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 700; }
.brand-mobile img { width: 78px; max-width: 34vw; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a, .logout { min-height: 48px; padding: 12px 14px; border-radius: 14px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 12px; border: 1px solid transparent; transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.sidebar nav a svg, .logout svg { width: 21px; height: 21px; flex: 0 0 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--green-soft); color: var(--green-dark); border-color: var(--brand-primary-border); box-shadow: 0 10px 24px rgba(15, 122, 128, .08); transform: translateX(2px); }
.logout { margin-top: auto; color: var(--danger); }
.logout:hover { background: #FEE4E2; color: var(--danger); border-color: #FECDCA; }
.mobile-nav { display: none; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: 0; }
.breadcrumb { display: flex; gap: 8px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.breadcrumb a { color: var(--green-dark); }
.user-menu { position: relative; }
.user-pill { min-width: 210px; min-height: 56px; padding: 7px 10px 7px 7px; border: 1px solid var(--border); border-radius: 18px; display: inline-flex; align-items: center; gap: 10px; background: #FFFFFF; box-shadow: var(--shadow); cursor: pointer; color: var(--text); text-align: left; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.user-pill:hover, .user-menu.is-open .user-pill { border-color: var(--brand-primary-border); box-shadow: 0 2px 4px rgba(0,0,0,.03), 0 12px 28px rgba(15, 122, 128, .08); }
.user-pill:active { transform: scale(.985); }
.user-avatar { width: 40px; height: 40px; min-width: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--green-soft); color: var(--green-dark); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.user-pill-copy { min-width: 0; display: grid; gap: 2px; flex: 1; }
.user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.15; font-weight: 700; }
.user-pill small { color: var(--muted); font-size: 11.5px; line-height: 1.15; font-weight: 600; }
.user-icon { display: none; }
.user-caret { width: 24px; height: 24px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted); background: var(--brand-bg); font-size: 11px; line-height: 1; transition: transform .18s ease, color .18s ease, background .18s ease; }
.user-menu.is-open .user-caret { transform: rotate(180deg); color: var(--green-dark); background: var(--green-soft); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 18px; padding: 8px; box-shadow: 0 2px 4px rgba(0,0,0,.03), 0 16px 34px rgba(0,0,0,.08); z-index: 60; display: none; }
.user-menu.is-open .user-dropdown { display: grid; gap: 4px; }
.user-dropdown a { padding: 11px 12px; border-radius: 12px; color: var(--text); font-size: 13px; font-weight: 700; }
.user-dropdown a:hover { background: var(--green-soft); color: var(--green-dark); }
.user-dropdown .danger-link { color: var(--danger); }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: #FFFFFF; border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,.025), 0 8px 20px rgba(0,0,0,.035); }
.stat { min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dashboard-metrics { display: grid; grid-template-columns: minmax(280px, .92fr) minmax(0, 2fr); gap: 18px; align-items: stretch; }
.dashboard-secondary-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-hero { min-height: 218px; padding: 26px; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--brand-primary-hover), var(--green)); color: var(--white); border-color: rgba(255,255,255,.18); box-shadow: 0 2px 4px rgba(0,0,0,.03), 0 14px 30px rgba(15, 122, 128, .13); }
.stat-hero::after { content: ""; position: absolute; width: 180px; height: 180px; right: -58px; bottom: -70px; border-radius: 50%; background: rgba(255,255,255,.12); }
.stat-hero span { color: rgba(255,255,255,.82); font-size: 14px; font-weight: 600; }
.stat-hero strong { color: var(--white); font-size: clamp(50px, 5.2vw, 72px); line-height: .98; letter-spacing: 0; position: relative; z-index: 1; }
.stat-hero small { width: max-content; max-width: 100%; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: rgba(255,255,255,.92); font-size: 13px; font-weight: 500; position: relative; z-index: 1; }
.stat-compact { min-height: 102px; padding: 16px; gap: 12px; }
.stat-compact span { font-size: 12.5px; font-weight: 500; }
.stat-compact strong { overflow-wrap: anywhere; font-size: clamp(19px, 1.9vw, 24px); line-height: 1.12; }
.stat-compact small { color: var(--muted); font-size: 12px; font-weight: 600; }
.loss-card { background: #FFF7ED; border-color: #FED7AA; color: #C2410C; }
.loss-card span, .loss-card small { color: #C2410C; opacity: .82; }
.loss-card strong, .loss-text { color: #C2410C; }
.loss-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.loss-badge { background: #FFF7ED; border: 1px solid #FED7AA; color: #C2410C; }
.loss-action { background: #C2410C; color: #FFFFFF; }
.loss-action:hover { background: #9A3412; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 12px; }
.section-title h2 { margin: 0; font-size: 20px; font-weight: 700; }

.cash-expected-hero {
    display: grid;
    grid-template-columns: minmax(250px, .8fr) minmax(0, 1.7fr);
    gap: 24px;
    padding: 26px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 22px;
    background: linear-gradient(135deg, var(--brand-primary-dark), var(--green));
    color: #FFFFFF;
    box-shadow: 0 18px 40px rgba(15, 122, 128, .18);
}
.cash-expected-main { display: grid; align-content: center; gap: 7px; }
.cash-expected-main span { color: rgba(255,255,255,.82); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cash-expected-main strong { font-size: clamp(42px, 4.8vw, 66px); line-height: 1; font-variant-numeric: tabular-nums; }
.cash-expected-main small { color: rgba(255,255,255,.8); font-weight: 500; }
.cash-expected-formula {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr) auto) minmax(120px, 1fr);
    align-items: center;
    gap: 10px;
}
.cash-expected-formula > div { min-width: 0; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.12); }
.cash-expected-formula span, .cash-expected-formula strong { display: block; }
.cash-expected-formula span { min-height: 32px; color: rgba(255,255,255,.75); font-size: 11.5px; font-weight: 600; }
.cash-expected-formula strong { margin-top: 5px; color: #FFFFFF; font-size: 17px; font-variant-numeric: tabular-nums; }
.cash-expected-formula > b { color: rgba(255,255,255,.72); font-size: 20px; text-align: center; }
.cash-closing-card { padding: 18px 20px; }
.cash-closing-card .section-title { margin-bottom: 12px; }
.cash-closing-card .section-title p, .cash-sales-title p, .cash-payment-section .section-title p { margin: 4px 0 0; }
.cash-closing-expected { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cash-closing-expected strong { color: var(--green-dark); font-size: 18px; }
.cash-closing-form { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(260px, 1.5fr) auto; align-items: end; gap: 12px; }
.cash-counted-input { min-height: 52px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cash-closing-form .btn { min-height: 52px; }
.cash-sales-title { margin-top: 18px; }
.cash-operations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cash-compact-panel { min-height: 112px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; box-shadow: none; }
.cash-compact-panel > div:first-child { display: grid; gap: 3px; }
.cash-compact-panel span { color: var(--muted); font-size: 12px; font-weight: 600; }
.cash-compact-panel > div:first-child strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.cash-compact-panel small { color: var(--muted); font-size: 11.5px; }
.cash-inline-breakdown { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.cash-inline-breakdown span { padding: 7px 9px; border-radius: 10px; background: var(--brand-primary-soft); }
.cash-inline-breakdown strong { display: block; margin-top: 2px; color: var(--text); font-size: 13px; }
.cash-payment-section { padding: 17px 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--brand-bg); }
.cash-payment-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cash-payment-grid > div { min-width: 0; padding: 12px; border-radius: 14px; background: #FFFFFF; border: 1px solid var(--border); }
.cash-payment-grid span, .cash-payment-grid strong { display: block; }
.cash-payment-grid span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.cash-payment-grid strong { margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.cash-payment-grid .total { background: var(--green-soft); border-color: var(--brand-primary-border); }
.cash-payment-grid .total strong { color: var(--green-dark); }

.table-wrap { overflow-x: auto; max-width: 100%; min-width: 0; border-radius: 18px; border: 1px solid var(--border); background: #FFFFFF; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 15px 16px; border-bottom: 1px solid rgba(226, 238, 232, .9); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); background: var(--brand-bg); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: var(--brand-bg); }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 190px; }
td.actions form { margin: 0; }
td.actions .btn { min-height: 34px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 700; }

.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 7px; font-weight: 600; color: var(--text); }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; background: var(--white); color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,122,128,.12); }
textarea { min-height: 104px; resize: vertical; }

.pdv-page .cart-panel.is-employee-payment [data-employee-box] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.permissions-section {
    grid-column: 1 / -1;
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--brand-bg);
}

.permissions-heading {
    display: grid;
    gap: 4px;
}

.permissions-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.permissions-heading p {
    display: none;
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.permissions-section.is-admin [data-admin-permission-message] {
    display: block;
}

.permissions-section.is-admin [data-attendant-permissions] {
    display: none;
}

.permission-groups {
    display: grid;
    gap: 14px;
}

.permission-group {
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--white);
}

.permission-group legend {
    padding: 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.permission-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(226, 238, 232, .9);
    border-radius: 13px;
    background: var(--brand-bg);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.permission-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    accent-color: var(--green);
}

.permission-switch {
    position: relative;
}

.permission-switch .permission-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.permission-switch-ui {
    width: 42px;
    height: 24px;
    min-width: 42px;
    border-radius: 999px;
    background: var(--brand-primary-border);
    position: relative;
    transition: background .18s ease, box-shadow .18s ease;
}

.permission-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 2px 5px rgba(45, 45, 45, .18);
    transition: transform .18s ease;
}

.permission-checkbox:checked + .permission-switch-ui {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 122, 128, .12);
}

.permission-checkbox:checked + .permission-switch-ui::after {
    transform: translateX(18px);
}

.btn { border: 0; border-radius: 12px; padding: 12px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; cursor: pointer; min-height: 44px; letter-spacing: 0; }
.btn.primary { background: var(--green); color: var(--white); }
.btn.secondary { background: var(--green-soft); color: var(--green-dark); }
.btn.danger { background: #FEE4E2; color: var(--danger); }
.btn.ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--border); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alert { border-radius: 14px; padding: 13px 16px; margin-bottom: 16px; background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--brand-primary-border); }
.alert.danger { background: #FEE4E2; color: var(--danger); border-color: #FECDCA; }
.alert.warning { background: #FFF4E5; color: var(--warning); border-color: #FFE0B2; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; background: var(--green-soft); color: var(--green-dark); }
.badge.warning { background: #FFF4E5; color: var(--warning); }
.badge.danger { background: #FEE4E2; color: var(--danger); }
.badge.favorite { background: #FEF3C7; color: #92400E; margin-left: 8px; }
.muted-text { color: var(--muted); font-size: 13px; font-weight: 600; }
.import-summary { margin: 18px 0; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.pagination { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.pagination a { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--white); }
.pagination a.active { background: var(--green); color: var(--white); }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, var(--brand-primary-soft), var(--brand-bg) 48%); }
.login-card { width: min(430px, 100%); background: var(--white); border: 1px solid var(--border); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.login-logo { width: 110px; display: block; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 8px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }

.pdv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pdv-product-sections { display: grid; gap: 22px; }
.pdv-product-section { display: grid; gap: 12px; }
.pdv-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.pdv-section-heading h2 { margin: 0; color: var(--text); font-size: 18px; font-weight: 800; }
.pdv-section-heading span { color: var(--muted); font-size: 13px; font-weight: 600; }
.product-card { text-align: left; border: 1px solid var(--border); background: var(--white); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; min-height: 142px; display: grid; gap: 8px; }
.product-card.is-favorite { border-color: #FDE68A; background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 58%); }
.product-card strong { font-size: 15px; font-weight: 700; }
.product-card small { color: var(--muted); }
.product-card[disabled] { opacity: .55; cursor: not-allowed; }
.pdv-product-sections.is-list-view .product-grid { grid-template-columns: 1fr; }
.pdv-product-sections.is-list-view .product-card { min-height: 78px; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 10px; }
.pdv-product-sections.is-list-view .product-card > small:first-child,
.pdv-product-sections.is-list-view .product-card-footer small { display: none; }
.pdv-product-sections.is-list-view .product-card strong { grid-column: 1; }
.pdv-product-sections.is-list-view .product-favorite-badge { grid-column: 1; }
.pdv-product-sections.is-list-view .product-price { grid-column: 2; white-space: nowrap; }
.pdv-product-sections.is-list-view .product-card-footer { grid-column: 3; margin-top: 0; }
.cart-panel { position: sticky; top: 20px; align-self: start; }
.cart-items { display: grid; gap: 10px; max-height: 330px; overflow: auto; margin: 12px 0; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.cart-row s { color: var(--muted); }
.cart-row .btn.ghost { min-height: 30px; margin-top: 6px; padding: 6px 9px; border-radius: 9px; font-size: 12px; }
.qty-controls { display: flex; align-items: center; gap: 7px; }
.qty-controls button { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border); background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.cart-total { display: flex; justify-content: space-between; font-size: 21px; font-weight: 800; margin: 14px 0; font-variant-numeric: tabular-nums; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(45,45,45,.45); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal-backdrop[hidden] { display: none !important; }
.modal { width: min(520px, 100%); max-height: 92vh; overflow: auto; background: var(--white); border-radius: 20px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.receipt { color: #111; }
.receipt-logo { width: 96px; margin: 0 auto 8px; display: block; }
.receipt h2, .receipt p { text-align: center; margin: 4px 0; }
.receipt table { min-width: 0; box-shadow: none; border: 0; }
.receipt th, .receipt td { padding: 8px 4px; }

@media (max-width: 960px) {
    .sidebar { display: none; }
    .main-content { padding: 18px; padding-bottom: 92px; }
    .brand-mobile { display: flex; }
    .topbar { align-items: stretch; flex-direction: column; }
    .user-pill { width: fit-content; box-shadow: none; }
    .mobile-nav { position: fixed; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 4px; background: var(--white); border: 1px solid var(--border); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); z-index: 40; }
    .mobile-nav a { text-align: center; font-size: 12px; padding: 10px 4px; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-weight: 700; }
    .dashboard-metrics, .dashboard-secondary-metrics, .loss-summary-grid { grid-template-columns: 1fr; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid.two { grid-template-columns: 1fr; }
    .cash-expected-hero { grid-template-columns: 1fr; }
    .cash-expected-formula { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cash-expected-formula > b { display: none; }
    .cash-closing-form, .cash-operations-grid { grid-template-columns: 1fr; }
    .cash-payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cash-payment-grid .total { grid-column: 1 / -1; }
}

@media print {
    html, body { width: 80mm; min-width: 0; min-height: 0; height: auto; margin: 0; padding: 0; overflow: visible; background: #fff; }
    .app-shell, .mobile-nav, .toast, .receipt-actions { display: none !important; }
    .modal-backdrop { position: absolute !important; inset: 0 auto auto 0 !important; width: 80mm !important; min-height: 0 !important; background: #fff !important; padding: 0 !important; margin: 0 !important; display: block !important; overflow: visible !important; }
    .modal { position: static !important; box-shadow: none !important; width: 80mm !important; max-width: 80mm !important; max-height: none !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; overflow: visible !important; }
    .receipt { width: 80mm; margin: 0; padding: 3mm 4mm; font-size: 12px; line-height: 1.3; color: #000; text-align: center; background: #fff; }
    .receipt table { width: 100%; min-width: 0; }
    .receipt-logo { width: 38mm; max-width: 38mm; }
    @page { size: 80mm auto; margin: 0; }
}

/* Mobile and touch refinements */
:root { --mobile-nav-height: 60px; --cart-mobile-height: 78px; }

.mobile-nav svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-card { padding: 16px; }
.product-favorite-badge { width: fit-content; border-radius: 999px; padding: 4px 9px; background: #FEF3C7; color: #92400E; font-size: 11px; font-weight: 800; }
.product-price { font-size: 18px; font-weight: 800; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.add-product-pill {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--green);
    color: var(--white);
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15,122,128,.22);
}
.product-card.added {
    transform: translateY(-2px) scale(1.015);
    border-color: var(--green);
    box-shadow: 0 18px 36px rgba(15,122,128,.18);
}

.cart-toggle {
    width: 100%;
    border: 0;
    background: var(--green);
    color: var(--white);
    border-radius: 14px;
    padding: 13px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    min-height: 58px;
    text-align: left;
}
.cart-toggle strong { display: block; font-size: 16px; font-weight: 800; }
.cart-toggle small { color: rgba(255,255,255,.82); }
.cart-toggle-total { font-size: 18px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-body {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 10px;
    transition: max-height .28s ease, opacity .2s ease, transform .28s ease, margin-top .28s ease;
    max-height: 680px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 12px;
}
.cart-panel.is-collapsed .cart-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(8px);
    margin-top: 0;
}
.cart-panel.is-collapsed {
    padding-bottom: 14px;
}
.empty {
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #F9FCFA);
}
.empty.compact {
    padding: 18px;
    font-size: 14px;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    z-index: 80;
    transform: translate(-50%, 16px);
    opacity: 0;
    background: var(--text);
    color: var(--white);
    border-radius: 999px;
    padding: 12px 18px;
    box-shadow: 0 16px 38px rgba(45,45,45,.22);
    font-weight: 700;
    max-width: min(92vw, 420px);
    text-align: center;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.receipt-number { font-weight: 700; }
.receipt-total {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #777;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}
.receipt-footer {
    margin-top: 12px !important;
    font-weight: 700;
}
.chart-card canvas,
.chart-card svg,
.chart-card img {
    width: 100%;
    max-width: 100%;
    height: auto;
}

.price,
.money,
.total,
.product-price,
.cart-total,
.cart-toggle-total,
.stat strong,
td:last-child {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
    .pdv-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 24px;
        align-items: start;
    }

    .pdv-products {
        min-width: 0;
    }

    .cart-panel {
        position: sticky;
        top: 24px;
        width: 100%;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }

    .product-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 16px;
    }

    .cart-panel.is-collapsed .cart-body {
        max-height: 680px;
        opacity: 1;
        overflow: visible;
        transform: none;
        margin-top: 12px;
    }

    .cart-panel.is-collapsed {
        padding-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .pdv-page .pdv-layout {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0 !important;
        width: auto !important;
    }

    .pdv-page .cart-panel {
        grid-column: auto !important;
        grid-row: auto !important;
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        bottom: calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom)) !important;
        top: auto !important;
        width: auto !important;
        max-height: 35vh !important;
        overflow: hidden !important;
    }

    .login-page {
        min-height: 100svh;
        align-items: center;
        padding: 18px;
    }
    .login-card {
        width: min(420px, 100%);
        padding: 26px 22px;
        border-radius: 22px;
    }
    .login-logo {
        width: min(140px, 46vw);
        margin: 0 auto 18px;
    }
    .login-card h1,
    .login-card p {
        text-align: center;
    }

    .main-content { padding-bottom: calc(var(--mobile-nav-height) + 28px + env(safe-area-inset-bottom)); }
    .mobile-nav {
        left: 10px;
        right: 10px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        height: var(--mobile-nav-height);
        grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
        gap: 2px;
        padding: 6px;
        border-radius: 16px;
    }
    .mobile-nav a {
        min-height: 48px;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 2px;
        padding: 4px 2px;
        font-size: 10.5px;
        line-height: 1;
    }
    .mobile-nav a span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 720px; }

    .pdv-page .topbar {
        margin-bottom: 12px;
    }
    .pdv-page .main-content {
        min-height: 100svh;
        padding: 12px;
        padding-bottom: calc(var(--mobile-nav-height) + var(--cart-mobile-height) + 30px + env(safe-area-inset-bottom));
    }
    .pdv-page .pdv-layout {
        display: block;
    }
    .pdv-products {
        min-height: calc(100svh - var(--mobile-nav-height) - var(--cart-mobile-height) - 132px);
    }
    .pdv-page .search-card {
        padding: 12px;
        border-radius: 16px;
    }
    .pdv-page .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding-bottom: 0;
    }
    .pdv-page .product-card {
        min-height: 110px;
        padding: 12px;
        border-radius: 16px;
        gap: 5px;
        transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    }
    .pdv-page .product-card strong {
        font-size: 14px;
        line-height: 1.2;
    }
    .pdv-page .product-card small {
        font-size: 11px;
    }
    .pdv-page .product-price {
        font-size: 16px;
    }
    .pdv-page .add-product-pill {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        font-size: 20px;
    }
    .pdv-page .cart-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom));
        top: auto;
        z-index: 35;
        max-height: 35vh;
        padding: 10px;
        border-radius: 18px;
        overflow: hidden;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
    }
    .pdv-page .cart-panel.is-collapsed {
        max-height: 78px;
    }
    .pdv-page .cart-body {
        min-height: 0;
        overflow: hidden;
    }
    .pdv-page .cart-items {
        max-height: none;
        min-height: 0;
        overflow-y: auto;
        margin: 0;
        -webkit-overflow-scrolling: touch;
    }
    .pdv-page .cart-total {
        font-size: 19px;
        margin: 4px 0;
    }
    .pdv-page .cart-panel .form-grid {
        gap: 8px;
    }
    .pdv-page .cart-panel input,
    .pdv-page .cart-panel select {
        padding: 10px 11px;
    }
    .pdv-page .cart-panel .btn {
        min-height: 42px;
    }
    .pdv-page .toast {
        bottom: calc(var(--mobile-nav-height) + var(--cart-mobile-height) + 30px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 768px) {
    :root {
        --mobile-nav-height: 58px;
        --cart-mobile-height: 64px;
    }

    .main-content {
        padding: 16px;
        padding-bottom: calc(var(--mobile-nav-height) + 24px + env(safe-area-inset-bottom));
    }

    .topbar {
        gap: 8px;
        margin-bottom: 12px;
    }

    .brand-mobile {
        gap: 10px;
        margin-bottom: 4px;
    }

    .brand-mobile img {
        width: clamp(50px, 16vw, 60px);
        max-width: 60px;
    }

    .brand-mobile strong {
        font-size: 14px;
        line-height: 1.15;
        font-weight: 800;
    }

    .breadcrumb {
        font-size: 12px;
        gap: 6px;
    }

    .topbar h1 {
        margin-top: 2px;
        font-size: 22px;
        line-height: 1.05;
    }

    .user-menu {
        width: min(100%, 260px);
    }

    .user-pill {
        width: 100%;
        max-height: 48px;
        min-height: 44px;
        min-width: 0;
        padding: 8px 12px;
        display: flex;
        align-items: center;
        gap: 7px;
        box-shadow: none;
        border-radius: 14px;
    }

    .user-icon,
    .user-caret {
        display: inline-flex;
        line-height: 1;
        flex: 0 0 auto;
    }

    .user-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12.5px;
        font-weight: 700;
    }

    .user-pill small {
        display: none;
    }

    .user-dropdown {
        left: 0;
        right: auto;
        top: calc(100% + 6px);
        width: min(240px, 92vw);
        border-radius: 14px;
        padding: 6px;
    }

    .user-dropdown a {
        padding: 10px 11px;
        font-size: 13px;
    }

    .card {
        border-radius: 16px;
    }

    .pdv-page .main-content {
        padding: 16px;
        padding-bottom: calc(var(--mobile-nav-height) + var(--cart-mobile-height) + 24px + env(safe-area-inset-bottom));
    }

    .pdv-page .search-card {
        padding: 10px;
        border-radius: 14px;
    }

    .pdv-page .search-card label {
        gap: 6px;
        font-size: 12.5px;
    }

    .pdv-page .search-card input {
        min-height: 44px;
        max-height: 48px;
        padding: 9px 12px;
        border-radius: 11px;
    }

    .pdv-page .product-grid {
        gap: 8px;
    }

    .pdv-page .product-card {
        min-height: 112px;
        max-height: 140px;
        padding: 10px;
        gap: 6px;
        overflow: hidden;
        box-shadow: 0 8px 22px rgba(45, 45, 45, .07);
        transition: transform .14s ease, border-color .14s ease;
    }

    .pdv-page .product-card > small:first-child {
        width: fit-content;
        max-width: 100%;
        padding: 3px 7px;
        border-radius: 999px;
        background: var(--green-soft);
        color: var(--green-dark);
        font-size: 9.5px;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pdv-page .product-card strong {
        font-size: 12.5px;
        line-height: 1.15;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .pdv-page .product-price {
        font-size: 14.5px;
        line-height: 1;
    }

    .pdv-page .product-card-footer small {
        font-size: 10px;
    }

    .pdv-page .add-product-pill {
        width: 26px;
        height: 26px;
        min-width: 26px;
        border-radius: 9px;
        font-size: 18px;
        box-shadow: 0 6px 14px rgba(15, 122, 128, .2);
    }

    .pdv-page .cart-panel {
        left: 16px;
        right: 16px;
        bottom: calc(var(--mobile-nav-height) + 12px + env(safe-area-inset-bottom));
        max-height: 28vh;
        padding: 8px;
        border-radius: 16px;
    }

    .pdv-page .cart-panel.is-collapsed {
        max-height: 62px;
    }

    .pdv-page .cart-toggle {
        min-height: 46px;
        padding: 9px 12px;
        border-radius: 12px;
    }

    .pdv-page .cart-toggle strong {
        display: none;
    }

    .pdv-page .cart-toggle small {
        font-size: 12px;
        font-weight: 700;
        color: rgba(255, 255, 255, .9);
    }

    .pdv-page .cart-toggle-total {
        font-size: 16px;
    }

    .pdv-page .cart-body {
        gap: 7px;
        margin-top: 8px;
    }

    .pdv-page .cart-row {
        gap: 6px;
        padding-bottom: 7px;
    }

    .pdv-page .cart-row strong {
        font-size: 11.5px;
    }

    .pdv-page .qty-controls button {
        width: 28px;
        height: 28px;
    }

    .pdv-page .cart-total {
        font-size: 16px;
    }

    .pdv-page .cart-panel label {
        gap: 4px;
        font-size: 11.5px;
    }

    .pdv-page .cart-panel input,
    .pdv-page .cart-panel select {
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 10px;
    }

    .pdv-page .cart-panel .btn {
        min-height: 40px;
        padding: 9px 12px;
    }

    .mobile-nav {
        left: 8px;
        right: 8px;
        bottom: calc(6px + env(safe-area-inset-bottom));
        height: min(64px, var(--mobile-nav-height));
        padding: 5px;
        border-radius: 15px;
    }

    .mobile-nav svg {
        width: 18px;
        height: 18px;
        stroke-width: 1.8;
    }

    .mobile-nav a {
        min-height: 46px;
        gap: 1px;
        padding: 3px 2px;
        font-size: 9.5px;
        border-radius: 11px;
    }

    .pdv-page .toast {
        bottom: calc(var(--mobile-nav-height) + var(--cart-mobile-height) + 20px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 380px) {
    .pdv-page .product-grid { gap: 8px; }
    .pdv-page .product-card { padding: 10px; }
    .mobile-nav a { font-size: 9.5px; }
}

@media (max-width: 768px) {
    .pdv-page .topbar {
        gap: 6px;
        margin-bottom: 10px;
    }

    .pdv-page .brand-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0;
        margin-bottom: 6px;
    }

    .pdv-page .brand-mobile img {
        width: 145px;
        max-width: 45vw;
        min-width: 130px;
    }

    .pdv-page .brand-title {
        margin-top: 6px;
        font-size: 21px;
        font-weight: 700;
        line-height: 1.12;
        color: var(--brand-text);
    }

    .pdv-page .breadcrumb {
        margin-top: 2px;
        margin-bottom: 0;
        font-size: 12px;
    }

    .pdv-page .topbar h1 {
        margin-top: 2px;
        font-size: 21px;
    }

    .pdv-page .cart-panel {
        max-height: min(42vh, calc(100vh - 180px));
        overflow-y: auto;
        padding-bottom: 88px;
        overscroll-behavior: contain;
    }

    .pdv-page .cart-panel.is-payroll {
        max-height: min(58vh, calc(100vh - 180px));
    }

    .pdv-page .cart-panel.is-collapsed {
        max-height: 62px;
        overflow: hidden;
        padding-bottom: 8px;
    }

    .pdv-page .cart-panel.is-payroll.is-collapsed {
        max-height: min(58vh, calc(100vh - 180px));
        overflow-y: auto;
        padding-bottom: 88px;
    }

    .pdv-page .cart-body {
        overflow: visible;
        min-height: 0;
    }

    .pdv-page .cart-items {
        max-height: 72px;
        overflow-y: auto;
    }

    .pdv-page .cart-panel.is-payroll .cart-items {
        max-height: 96px;
    }

    .pdv-page .cart-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding-top: 12px;
        z-index: 5;
    }

    .pdv-page .cart-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .pdv-page .cart-panel select,
    .pdv-page .cart-panel button {
        min-height: 48px;
    }

    .pdv-page [data-employee-box] {
        width: 100%;
    }

    .pdv-page .cart-panel.is-employee-payment [data-employee-box] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .pdv-page [data-employee-box] select {
        width: 100%;
        min-height: 44px;
        max-height: 48px;
    }
}

@media (min-width: 769px) {
    .pdv-page .pdv-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 380px !important;
        gap: 24px !important;
        align-items: start !important;
    }

    .pdv-page .pdv-products {
        min-width: 0;
    }

    .pdv-page .product-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 16px;
        padding-bottom: 0;
    }

    .pdv-page .cart-panel {
        position: sticky !important;
        top: 24px !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        max-height: calc(100vh - 48px) !important;
        overflow-y: auto !important;
        align-self: start !important;
        display: block !important;
        grid-template-rows: none !important;
    }

    .pdv-page .cart-panel.is-collapsed .cart-body {
        max-height: 680px;
        opacity: 1;
        overflow: visible;
        transform: none;
        margin-top: 12px;
    }
}

/* PDV responsive experience */
.pdv-view-toggle,
.pdv-cart-bar,
.pdv-sheet-backdrop,
.cart-sheet-header {
    display: none;
}

@media (min-width: 1024px) {
    .pdv-page .pdv-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 360px !important;
        gap: 24px !important;
        align-items: start !important;
    }

    .pdv-page .pdv-products {
        min-width: 0 !important;
    }

    .pdv-page .product-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
        gap: 16px !important;
        padding-bottom: 0 !important;
    }

    .pdv-page .cart-panel {
        position: sticky !important;
        top: 24px !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: auto !important;
        max-height: calc(100vh - 48px) !important;
        overflow-y: auto !important;
        align-self: start !important;
        transform: none !important;
        display: block !important;
    }

    .pdv-page .cart-panel.is-collapsed .cart-body {
        max-height: 680px !important;
        opacity: 1 !important;
        overflow: visible !important;
        transform: none !important;
        margin-top: 12px !important;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .pdv-page .pdv-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 340px !important;
        gap: 18px !important;
        align-items: start !important;
    }

    .pdv-page .cart-panel {
        position: sticky !important;
        top: 18px !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: auto !important;
        max-height: calc(100vh - 36px) !important;
        overflow-y: auto !important;
        transform: none !important;
    }

    .pdv-page .cart-panel.is-collapsed .cart-body {
        max-height: 680px !important;
        opacity: 1 !important;
        overflow: visible !important;
        transform: none !important;
        margin-top: 12px !important;
    }
}

@media (max-width: 768px) {
    body.cart-sheet-open {
        overflow: hidden;
    }

    .pdv-page .topbar {
        position: relative;
        gap: 6px !important;
        margin-bottom: 10px !important;
        max-height: 110px;
        overflow: visible;
    }

    .pdv-page .brand-mobile {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 4px !important;
        margin: 0 auto 4px !important;
        text-align: center;
    }

    .pdv-page .brand-mobile img {
        width: 118px !important;
        max-width: 42vw !important;
        min-width: 0 !important;
    }

    .pdv-page .brand-title {
        margin: 0 !important;
        font-size: 18px !important;
        line-height: 1.1 !important;
    }

    .pdv-page .breadcrumb,
    .pdv-page .topbar h1 {
        display: none !important;
    }

    .pdv-page .user-menu {
        position: absolute;
        right: 0;
        top: 0;
        width: 44px;
    }

    .pdv-page .user-pill {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        justify-content: center;
        border-radius: 14px !important;
    }

    .pdv-page .user-name,
    .pdv-page .user-caret,
    .pdv-page .user-pill small {
        display: none !important;
    }

    .pdv-page .main-content {
        padding: 12px !important;
        padding-bottom: calc(var(--mobile-nav-height) + 102px + env(safe-area-inset-bottom)) !important;
    }

    .pdv-page .pdv-layout {
        display: block !important;
        width: auto !important;
        gap: 0 !important;
        grid-template-columns: none !important;
    }

    .pdv-page .pdv-products {
        min-height: 0 !important;
    }

    .pdv-page .search-card {
        padding: 10px !important;
        border-radius: 14px !important;
    }

    .pdv-view-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .pdv-view-toggle button {
        min-height: 42px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--white);
        color: var(--green-dark);
        font-weight: 800;
        cursor: pointer;
    }

    .pdv-view-toggle button.active {
        background: var(--green);
        border-color: var(--green);
        color: var(--white);
        box-shadow: 0 10px 22px rgba(15, 122, 128, .18);
    }

    .pdv-page .product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        padding-bottom: 0 !important;
    }

    .pdv-page .product-grid.is-list-view {
        grid-template-columns: 1fr !important;
    }

    .pdv-page .product-card {
        min-height: 112px !important;
        max-height: none !important;
        padding: 12px !important;
        border-radius: 16px !important;
        gap: 6px !important;
    }

    .pdv-page .product-grid.is-list-view .product-card {
        min-height: 74px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        column-gap: 10px;
    }

    .pdv-page .product-grid.is-list-view .product-card > small:first-child,
    .pdv-page .product-grid.is-list-view .product-card-footer small {
        display: none;
    }

    .pdv-page .product-grid.is-list-view .product-card strong {
        grid-column: 1;
        font-size: 14px !important;
    }

    .pdv-page .product-grid.is-list-view .product-price {
        grid-column: 2;
        white-space: nowrap;
    }

    .pdv-page .product-grid.is-list-view .product-card-footer {
        grid-column: 3;
        margin: 0;
    }

    .pdv-sheet-backdrop {
        position: fixed;
        inset: 0;
        z-index: 65;
        display: block;
        background: rgba(45, 45, 45, .36);
        backdrop-filter: blur(2px);
    }

    .pdv-sheet-backdrop[hidden] {
        display: none !important;
    }

    .pdv-page .cart-panel {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        z-index: 70 !important;
        width: auto !important;
        max-width: none !important;
        height: min(82vh, calc(100dvh - 72px)) !important;
        max-height: none !important;
        padding: 14px !important;
        border-radius: 24px 24px 0 0 !important;
        overflow: hidden !important;
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        transform: translateY(105%);
        transition: transform .28s ease;
        box-shadow: 0 -18px 45px rgba(45, 45, 45, .22);
    }

    .pdv-page .cart-panel.is-sheet-open {
        transform: translateY(0);
    }

    .cart-sheet-header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 12px;
        padding-bottom: 10px;
    }

    .cart-sheet-grip {
        grid-column: 1 / -1;
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: var(--brand-primary-border);
        justify-self: center;
    }

    .cart-sheet-header strong {
        display: block;
        font-size: 18px;
        font-weight: 800;
    }

    .cart-sheet-header small {
        color: var(--muted);
        font-weight: 700;
    }

    .cart-sheet-close {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 12px;
        background: var(--green-soft);
        color: var(--green-dark);
        font-size: 24px;
        cursor: pointer;
    }

    .pdv-page .cart-toggle {
        display: none !important;
    }

    .pdv-page .cart-body {
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        opacity: 1 !important;
        transform: none !important;
        margin-top: 0 !important;
        gap: 10px !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .pdv-page .cart-items {
        max-height: none !important;
        min-height: 0 !important;
        overflow-y: visible !important;
        margin: 0 !important;
    }

    .pdv-page .cart-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: linear-gradient(180deg, rgba(255,255,255,0), #fff 18%);
        padding-top: 12px;
    }

    .pdv-page .cart-actions .btn {
        width: 100%;
        min-height: 50px;
        border-radius: 14px;
    }

    .pdv-cart-bar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(var(--mobile-nav-height) + 18px + env(safe-area-inset-bottom));
        z-index: 55;
        display: block;
    }

    .pdv-cart-bar-button {
        width: 100%;
        min-height: 64px;
        border: 0;
        border-radius: 20px;
        padding: 10px 14px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 10px;
        background: var(--green);
        color: var(--white);
        box-shadow: 0 16px 34px rgba(15, 122, 128, .28);
        font-weight: 800;
        cursor: pointer;
        transition: transform .18s ease, box-shadow .18s ease;
    }

    .pdv-cart-bar-button.is-updated {
        transform: translateY(-2px) scale(1.015);
        box-shadow: 0 20px 42px rgba(15, 122, 128, .34);
    }

    .pdv-cart-bar-button strong {
        font-size: 18px;
        white-space: nowrap;
    }

    .pdv-page .receipt-actions a[target="_blank"] {
        display: none !important;
    }

    .pdv-page .receipt-actions {
        position: sticky;
        bottom: 0;
        display: grid;
        grid-template-columns: 1fr;
        background: linear-gradient(180deg, rgba(255,255,255,0), #fff 22%);
        padding-top: 14px;
        padding-bottom: 4px;
    }

    .pdv-page .receipt-actions .btn.ghost {
        width: 100%;
        min-height: 48px;
        border-radius: 14px;
        background: var(--green-soft);
    }

    .pdv-page .modal {
        max-height: calc(100dvh - 28px);
        padding: 16px;
    }
}

/* Global mobile shell */
.mobile-menu-trigger,
.mobile-drawer,
.mobile-drawer-backdrop {
    display: none;
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.mobile-drawer-open {
        overflow: hidden;
    }

    .app-shell,
    .main-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .sidebar,
    .mobile-nav {
        display: none !important;
    }

    .main-content {
        padding: 10px 12px 18px !important;
    }

    .topbar,
    .pdv-page .topbar {
        min-height: 64px !important;
        max-height: 80px !important;
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 10px !important;
        margin: 0 0 12px !important;
        padding: 6px 0 !important;
        overflow: visible !important;
    }

    .mobile-menu-trigger {
        width: 44px;
        height: 44px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--white);
        color: var(--green-dark);
        display: inline-grid;
        place-items: center;
        box-shadow: 0 8px 20px rgba(45, 45, 45, .08);
        cursor: pointer;
    }

    .mobile-menu-trigger span {
        font-size: 22px;
        line-height: 1;
    }

    .mobile-menu-trigger strong {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .topbar > div:first-of-type {
        min-width: 0;
    }

    .brand-mobile,
    .pdv-page .brand-mobile,
    .breadcrumb {
        display: none !important;
    }

    .topbar h1,
    .pdv-page .topbar h1 {
        display: block !important;
        margin: 0 !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 18px !important;
        line-height: 1.15 !important;
        font-weight: 800 !important;
    }

    .topbar .user-menu,
    .pdv-page .topbar .user-menu {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        width: auto !important;
        min-width: 0;
    }

    .topbar .user-pill,
    .pdv-page .topbar .user-pill {
        width: auto !important;
        min-width: 44px !important;
        max-width: 118px;
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 14px !important;
        box-shadow: 0 8px 20px rgba(45, 45, 45, .08) !important;
    }

    .topbar .user-icon,
    .pdv-page .topbar .user-icon {
        display: inline-flex !important;
        flex: 0 0 auto;
    }

    .topbar .user-name,
    .pdv-page .topbar .user-name {
        display: block !important;
        min-width: 0;
        max-width: 64px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
        font-weight: 800;
    }

    .topbar .user-caret,
    .topbar .user-pill small,
    .pdv-page .topbar .user-caret,
    .pdv-page .topbar .user-pill small {
        display: none !important;
    }

    .topbar .user-dropdown {
        right: 0;
        left: auto;
        width: min(240px, calc(100vw - 24px));
    }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 900;
        display: block;
        background: rgba(45, 45, 45, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
    }

    .mobile-drawer-backdrop[hidden] {
        display: none !important;
    }

    body.mobile-drawer-open .mobile-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-drawer {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 910;
        width: min(320px, 82vw);
        max-width: 82vw;
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 18px 16px;
        background: var(--white);
        border-right: 1px solid var(--border);
        box-shadow: 18px 0 42px rgba(45, 45, 45, .18);
        transform: translateX(-105%);
        transition: transform .24s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-drawer.is-open {
        transform: translateX(0);
    }

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }

    .mobile-drawer-header strong {
        display: block;
        font-size: 20px;
        font-weight: 800;
    }

    .mobile-drawer-header small {
        display: block;
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--muted);
        font-weight: 700;
    }

    .mobile-drawer-header button {
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 12px;
        background: var(--green-soft);
        color: var(--green-dark);
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-drawer nav {
        display: grid;
        gap: 8px;
    }

    .mobile-drawer nav a {
        min-height: 48px;
        padding: 12px 13px;
        display: flex;
        align-items: center;
        gap: 12px;
        border-radius: 14px;
        color: var(--text);
        font-weight: 800;
    }

    .mobile-drawer nav a.active {
        background: var(--green-soft);
        color: var(--green-dark);
    }

    .mobile-drawer nav a.danger-link {
        color: var(--danger);
    }

    .mobile-drawer nav svg {
        width: 21px;
        height: 21px;
        flex: 0 0 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    img,
    table,
    .card,
    .table-wrap,
    .section-title,
    .actions,
    form {
        max-width: 100%;
    }
}

/* Desktop consistency review */
@media (min-width: 1024px) {
    .main-content {
        max-width: 100%;
    }

    .sidebar {
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
    }

    .sidebar nav a,
    .logout {
        min-width: 0;
    }

    .sidebar nav a span,
    .logout span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar {
        align-items: flex-start;
    }

    .user-menu {
        flex: 0 0 auto;
    }

    .user-dropdown {
        overflow: hidden;
    }

    .section-title {
        align-items: center;
        flex-wrap: wrap;
    }

    .section-title .actions {
        flex: 1 1 360px;
    }

    .section-title .actions input[type="search"] {
        min-width: min(340px, 100%);
    }

    .section-title > .btn {
        margin-left: auto;
    }

    .actions.card {
        align-items: end;
        gap: 12px;
        padding: 16px;
    }

    .actions.card label {
        min-width: 150px;
    }

    .actions.card .btn {
        align-self: end;
    }

    .card h2 {
        margin: 0 0 14px;
        font-size: 18px;
        font-weight: 800;
        line-height: 1.2;
    }

    .card p {
        margin: 0 0 10px;
    }

    .card p:last-child {
        margin-bottom: 0;
    }

    .grid.cols-4 {
        grid-template-columns: repeat(4, minmax(160px, 1fr));
    }

    .stat {
        min-height: 112px;
        gap: 14px;
    }

    .stat strong {
        line-height: 1.08;
        overflow-wrap: anywhere;
    }

    .table-wrap {
        width: 100%;
    }

    td > form.actions {
        align-items: center;
        flex-wrap: nowrap;
        gap: 7px;
        margin: 0;
    }

    td > form.actions .btn {
        min-height: 34px;
        padding: 7px 10px;
        border-radius: 10px;
        font-size: 12.5px;
        font-weight: 700;
        white-space: nowrap;
    }

    td > form.actions .w-auto {
        width: auto;
        min-width: 120px;
    }

    td > form.actions input.w-auto {
        min-width: 180px;
    }

    .card > form.actions.mt-3 {
        margin-top: 10px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--brand-bg);
        gap: 10px;
    }

    .card > form.actions.mt-3 strong {
        flex: 1 1 180px;
        min-width: 150px;
    }

    .card > form.actions.mt-3 input[type="number"] {
        width: 96px;
    }

    .card > form.actions.mt-3 input[name="notes"] {
        flex: 2 1 220px;
    }
}

/* Desktop PDV refinement */
@media (min-width: 1024px) {
    .pdv-page .pdv-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) clamp(360px, 28vw, 420px) !important;
        gap: 24px !important;
        align-items: start !important;
    }

    .pdv-page .pdv-products {
        min-width: 0 !important;
    }

    .pdv-page .search-card {
        padding: 14px 16px !important;
        border-radius: 20px;
        box-shadow: var(--shadow);
    }

    .pdv-page .search-card label {
        gap: 9px;
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 700;
        letter-spacing: .01em;
    }

    .pdv-page .search-card input {
        min-height: 48px;
        padding: 0 15px;
        border-radius: 14px;
        background: var(--brand-bg);
        font-weight: 600;
    }

    .pdv-page .pdv-view-toggle {
        width: max-content;
        max-width: 100%;
        margin-top: 14px;
    }

    .pdv-page .product-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
        gap: 16px !important;
        align-items: stretch;
        padding-bottom: 0 !important;
    }

    .pdv-page .product-card {
        min-height: 176px !important;
        height: 100%;
        padding: 17px;
        border-radius: 20px;
        display: grid;
        grid-template-rows: auto minmax(42px, auto) auto 1fr;
        align-content: start;
        gap: 9px;
        transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
    }

    .pdv-page .product-card:hover:not([disabled]) {
        transform: translateY(-2px);
        border-color: var(--brand-primary-border);
        box-shadow: 0 2px 4px rgba(0,0,0,.03), 0 14px 30px rgba(15, 122, 128, .08);
    }

    .pdv-page .product-card > small:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
        font-weight: 600;
    }

    .pdv-page .product-card strong {
        min-width: 0;
        color: var(--brand-text);
        font-size: 15.5px;
        line-height: 1.26;
        font-weight: 800;
    }

    .pdv-page .product-price {
        font-size: 20px;
        line-height: 1.1;
    }

    .pdv-page .product-card-footer {
        align-self: end;
        min-height: 40px;
    }

    .pdv-page .product-card-footer small {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
        font-weight: 600;
    }

    .pdv-page .add-product-pill {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 14px;
        display: inline-grid;
        place-items: center;
        line-height: 1;
        font-size: 25px;
        transform: none;
    }

    .pdv-page .cart-panel {
        position: sticky !important;
        top: 24px !important;
        width: 100% !important;
        max-width: 420px;
        min-width: 360px;
        max-height: calc(100vh - 48px) !important;
        overflow-y: auto !important;
        align-self: start !important;
        border-radius: 22px;
        padding: 18px;
    }

    .pdv-page .cart-toggle {
        min-height: 64px;
        border-radius: 18px;
        padding: 14px 16px;
    }

    .pdv-page .cart-body {
        margin-top: 14px;
    }

    .pdv-page .cart-panel.is-collapsed .cart-body {
        max-height: 680px !important;
        opacity: 1 !important;
        overflow: visible !important;
        transform: none !important;
        margin-top: 14px !important;
    }

    .pdv-page .cart-items {
        max-height: 340px;
        padding-right: 4px;
    }

    .pdv-page .cart-total {
        margin: 16px 0;
        padding: 14px 0 4px;
        border-top: 1px solid var(--border);
    }
}

/* Sale cancellation */
tr.is-canceled {
    background: #FFFBFA;
}

tr.is-canceled td {
    color: var(--muted);
}

tr.is-canceled:hover {
    background: #FEF3F2;
}

.sale-cancel-modal .modal {
    max-width: 540px;
}

.sale-cancel-modal h2 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
}

.sale-cancel-modal textarea {
    min-height: 120px;
}

.cart-actions .btn.ghost {
    width: 100%;
}
/* Dashboard soft refinement */
.dashboard-metrics .card,
.dashboard-secondary-metrics .card,
.dashboard-metrics + .grid .card {
    border-color: rgba(226, 238, 232, .86);
}

.dashboard-metrics + .grid .card h2 {
    margin-top: 0;
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
}

.dashboard-metrics + .grid .card p {
    color: var(--brand-muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
}

.dashboard-metrics + .grid .card p strong {
    font-weight: 700;
}
/* Pre-production desktop PDV polish */
@media (min-width: 1024px) {
    .pdv-page .search-card label {
        position: relative;
    }

    .pdv-page .search-card label::after {
        content: "";
        position: absolute;
        left: 15px;
        bottom: 14px;
        width: 16px;
        height: 16px;
        border: 2px solid var(--muted);
        border-radius: 50%;
        opacity: .72;
        pointer-events: none;
    }

    .pdv-page .search-card label::before {
        content: "";
        position: absolute;
        left: 29px;
        bottom: 12px;
        width: 8px;
        height: 2px;
        border-radius: 999px;
        background: var(--muted);
        opacity: .72;
        transform: rotate(45deg);
        pointer-events: none;
    }

    .pdv-page .search-card input {
        padding-left: 44px !important;
    }

    .pdv-page .product-card[disabled] {
        opacity: 1;
        background: var(--brand-bg);
        border-style: dashed;
        color: var(--muted);
        box-shadow: none;
    }

    .pdv-page .product-card[disabled] .product-price {
        color: var(--muted);
    }

    .pdv-page .product-card[disabled] .add-product-pill {
        width: auto;
        min-width: 88px;
        padding: 0 10px;
        background: var(--brand-primary-soft);
        color: var(--muted);
        box-shadow: none;
        font-size: 11.5px;
        font-weight: 800;
        letter-spacing: .01em;
    }

    .pdv-page .cart-toggle {
        background: linear-gradient(135deg, var(--green), var(--green-dark));
    }

    .pdv-page .cart-toggle strong {
        font-size: 15px;
        font-weight: 700;
    }

    .pdv-page .cart-toggle small {
        font-size: 12px;
        font-weight: 500;
        opacity: .78;
    }

    .pdv-page .cart-toggle-total {
        font-size: 22px;
        font-weight: 800;
    }

    .pdv-page .cart-actions {
        display: grid;
        gap: 8px;
    }

    .pdv-page .cart-actions .btn.primary {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .pdv-page .cart-actions .btn.ghost,
    .cart-actions .btn.ghost {
        width: fit-content;
        min-height: 34px;
        justify-self: center;
        padding: 6px 10px;
        border-color: transparent;
        background: transparent;
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 700;
    }

    .pdv-page .cart-actions .btn.ghost::before {
        content: "Limpar";
        display: none;
    }

    .pdv-page .cart-actions .btn.ghost:hover {
        background: var(--brand-bg);
        color: var(--danger);
        border-color: var(--border);
    }
}


