:root {
  color-scheme: light;
  --ink: #1a1610;
  --ink-soft: #3b3329;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --line: #e8e2d8;
  --muted: #6b6050;
  --interactive: #18720e;
  --interactive-dark: #12580b;
  --accent: #1b7f10;
  --accent-dark: #145f0c;
  --selected: #e3f3e0;
  --accent-wash: #f1faef;
  --surface-secondary: #f8f8f8;
  --input-border: #cfc5b6;
  --amber-wash: #fff6dd;
  --warning-line: #ffc879;
  --warning-ink: #5e4200;
  --danger: #c70a24;
  --danger-wash: #fee8eb;
  --danger-ink: #8e0b21;
  --success: #047b5d;
  --success-wash: #cdfed4;
  --success-border: #92fcac;
  --danger-border: #f78086;
  --success-ink: #014b40;
  --info: #00679b;
  --info-wash: #eaf4ff;
  --info-border: #a8d8ff;
  --shell: #111315;
  --shell-muted: #aeb5bd;
  --grad: linear-gradient(135deg, #239a14 0%, #15630c 100%);
  --shadow: 0 1px 2px rgb(15 23 42 / 4%), 0 8px 24px -12px rgb(15 23 42 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700 850; font-display: swap; src: url('/fonts/inter-700.woff2') format('woff2'); }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--interactive);
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .48; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { width: 100%; min-width: 0; min-height: 100vh; }
.app-shell.pos-shell { height: 100dvh; min-height: 0; overflow: hidden; }
.skip-link { position: fixed; top: 8px; left: 12px; z-index: 30; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: #fff; transform: translateY(calc(-100% - 12px)); transition: transform .15s ease; }
.skip-link:focus-visible { transform: translateY(0); }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 26px; background: var(--shell); color: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 12%); z-index: 2; }
.brand-mark { display: grid; place-items: center; width: auto; height: 36px; border-radius: 10px; }
.brand-mark img { display: block; width: auto; height: 100%; max-width: 140px; object-fit: contain; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 6px 22px; }
.brand-name { font-weight: 750; letter-spacing: -.03em; font-size: 16px; }
.brand-caption { margin-top: 2px; color: var(--shell-muted); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }

.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); width: 100%; min-width: 0; min-height: 100vh; transition: grid-template-columns .18s ease; }
.workspace.nav-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
.pos-shell .workspace { height: 100dvh; min-height: 0; overflow: hidden; }
.pos-shell .sidebar { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar { position: relative; min-height: 0; padding: 22px 12px 22px; border-right: 1px solid #25292e; background: linear-gradient(180deg, #111315 0%, #191b1f 100%); color: #e7eaee; }
.app-column { display: grid; grid-template-rows: 68px minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.app-column > .main-area { min-height: 0; }
.nav-collapse-toggle { position: static; display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(15 23 42 / 8%); transition: background .18s ease, transform .18s ease, border-color .18s ease; }
.nav-collapse-toggle:hover { border-color: #647483; background: rgb(255 255 255 / 13%); }
.nav-collapse-toggle:active { transform: scale(.94); }
.nav-collapse-toggle:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-dark); }
.nav-toggle-arrow { display: grid; place-items: center; transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.nav-toggle-arrow svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.nav-list { display: grid; gap: 6px; }
.nav-button { display: flex; align-items: center; gap: 12px; min-height: 44px; width: 100%; padding: 0 13px; border: 0; border-radius: 9px; background: transparent; color: #b9c0c8; text-align: left; font-size: 14px; font-weight: 650; }
.nav-button:hover { background: #2d3742; color: #fff; }
.nav-button.active { color: #fff; background: rgb(255 255 255 / 9%); }
.nav-section { margin: 17px 11px 4px; color: #91a0ad; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-section:first-child { margin-top: 2px; }
.nav-group { display: grid; gap: 3px; }
.nav-icon { display: grid; place-items: center; width: 18px; flex: 0 0 18px; }
.nav-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-chevron { display: grid; place-items: center; margin-left: auto; width: 14px; height: 14px; opacity: .65; transition: transform .16s ease; transform: rotate(-90deg); }
.nav-chevron svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-group-button.open .nav-chevron { transform: rotate(0deg); }
.nav-group-button.active { color: var(--ink); background: var(--accent-wash); }
.nav-children { display: grid; gap: 3px; margin: 3px 0 7px 22px; padding-left: 9px; border-left: 1px solid var(--line); }
.nav-child { min-height: 38px; padding: 0 10px; gap: 9px; font-size: 13px; color: var(--ink-soft); }
.nav-child.active { color: var(--ink); background: var(--selected); }
.nav-child-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dot { flex: 0 0 auto; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .45; }
.nav-child.active .nav-dot { opacity: .9; }
.sidebar.collapsed .sidebar-brand { justify-content: center; gap: 0; padding: 0 8px; }
.sidebar.collapsed .sidebar-brand > div:nth-child(2) { display: none; }
.sidebar.collapsed .nav-section, .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-child, .sidebar.collapsed .nav-chevron { display: none; }
.sidebar.collapsed .nav-list { gap: 8px; }
.sidebar.collapsed .nav-button { justify-content: center; width: 48px; min-height: 48px; margin: 0 auto; padding: 0; }
.sidebar.collapsed .nav-group { display: block; }
.sidebar.collapsed .nav-group-button { background: transparent; }
.sidebar.collapsed .nav-button.active { background: #c47d45; color: #fff; }
.sidebar.collapsed .nav-icon { width: 20px; flex-basis: 20px; }
.sidebar:not(.collapsed) .nav-button.active { box-shadow: inset 3px 0 #c47d45; }
.sidebar:not(.collapsed) .nav-group-button.active { background: rgb(196 125 69 / 16%); }
.sidebar:not(.collapsed) .nav-child.active { background: rgb(255 255 255 / 8%); color: #fff; }
.section-tabs { display: none; }
.main-area { width: 100%; min-width: 0; padding: 26px 30px 36px; }
.pos-shell .main-area { min-height: 0; }
.pos-main { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.pos-main .page-heading { flex: 0 0 auto; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 21px; }
.page-heading h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; line-height: 1.12; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 46px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 750; transition: background .15s ease, transform .15s ease; }
.button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: var(--surface-secondary); }
.button.danger { background: var(--danger); }
.button.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.button.small-button { min-height: 40px; padding: 0 12px; font-size: 13px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 17px; }

.field { display: grid; gap: 7px; min-width: 0; }
.field label { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.field input, .field select, .field textarea, .search-input { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--input-border); border-radius: 9px; background: #fff; color: var(--ink); font-size: 15px; }
.field input[type="checkbox"] { appearance: none; width: 22px; height: 22px; min-height: 22px; padding: 0; margin: 3px 0 0; border: 1px solid var(--input-border); border-radius: 6px; display: grid; place-content: center; cursor: pointer; }
.field input[type="checkbox"]::before { content: ''; width: 11px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0); transition: transform .12s ease; }
.field input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.field input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
.loyalty-settings { max-width: 760px; }
.loyalty-toggle { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 12px 14px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 12px; }
.loyalty-toggle label { font-weight: 700; color: var(--ink); }
.ticket-head .customer-picker { flex: 1 1 auto; min-width: 250px; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; }
.ticket-head .customer-picker[hidden] { display: none; }
.customer-toggle { flex: 0 0 auto; white-space: nowrap; }
.customer-check-label { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--ink); font-size: 13px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.customer-check { appearance: none; width: 18px; height: 18px; margin: 0; border: 1px solid var(--input-border); border-radius: 4px; background: #fff; display: grid; place-content: center; cursor: pointer; }
.customer-check::before { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0); }
.customer-check:checked { background: var(--accent); border-color: var(--accent); }
.customer-check:checked::before { transform: rotate(-45deg) scale(1); }
.customer-mode-label { color: var(--muted); }
.customer-check:not(:checked) + .customer-mode-label { color: var(--success-ink, #16724b); }
.ticket-number { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); color: var(--ink); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket-head .customer-picker-head { flex: 0 0 auto; }
.ticket-head .customer-picker-head label { display: none; }
.ticket-head .customer-picker-head .button { min-height: 38px; }
.ticket-head .customer-search-wrap { flex: 1 1 180px; min-width: 130px; }
.ticket-head .customer-search { min-height: 38px; }
.ticket-head .selected-customer { padding: 6px 8px; }
.customer-picker { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.customer-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-picker-head label { color: var(--ink); font-size: 13px; font-weight: 750; }
.customer-search-wrap { position: relative; }
.customer-search { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--input-border); border-radius: 9px; background: #fff; color: var(--ink); font-size: 15px; }
.selected-customer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; }
.selected-customer .button { min-height: 30px; padding: 0 9px; }
.redeem-preview { color: var(--muted); font-size: 12px; margin-top: -2px; }
.redeem-preview.error { color: var(--danger-ink); }
@media (max-width: 980px) {
  .ticket-head .customer-picker { min-width: 180px; }
  .ticket-head .customer-picker-head label { display: none; }
}
@media (max-width: 760px) {
  .ticket-head-row { flex-wrap: wrap; }
  .ticket-head .customer-picker { order: 3; flex-basis: 100%; }
  .ticket-head .customer-picker-head label { display: inline; }
}

/* Abasto iOS-inspired operations layer */
:root {
  --ios-canvas: #f2f2f7;
  --ios-surface: rgb(255 255 255 / 92%);
  --ios-surface-solid: #fff;
  --ios-separator: rgb(60 60 67 / 18%);
  --ios-secondary: #6b6b73;
  --ios-blue: #18720e;
  --ios-blue-soft: #fff0f2;
  --ios-green: #18875f;
  --ios-green-soft: #e6f7ee;
  --ios-shadow: 0 16px 35px rgb(35 31 28 / 7%), 0 2px 8px rgb(35 31 28 / 5%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, ui-sans-serif, system-ui, sans-serif;
}

body { background: var(--ios-canvas); }
.main-area { background: var(--ios-canvas); }
.page-heading { align-items: center; margin-bottom: 18px; }
.page-heading h1 { font-size: clamp(27px, 3vw, 34px); letter-spacing: -.045em; }
.page-heading p { color: var(--ios-secondary); max-width: 720px; }
.panel { border: 1px solid rgb(60 60 67 / 10%); border-radius: 18px; box-shadow: var(--ios-shadow); }
.panel-pad { padding: 22px; }
.panel-title { letter-spacing: -.018em; }
.button { min-height: 44px; border-radius: 12px; box-shadow: 0 1px 1px rgb(0 0 0 / 4%); transition: transform .16s cubic-bezier(.2,.8,.2,1), background .16s ease, box-shadow .16s ease; }
.button:active:not(:disabled) { transform: scale(.97); }
.button.primary, .button.primary-button { background: var(--ios-blue); }
.button.primary:hover:not(:disabled), .button.primary-button:hover:not(:disabled) { background: var(--interactive-dark); box-shadow: 0 5px 14px rgb(198 40 57 / 18%); }
.button.secondary { background: rgb(255 255 255 / 78%); border-color: var(--ios-separator); }
.field input, .field select, .field textarea, .search-input { min-height: 48px; border-radius: 12px; border-color: rgb(60 60 67 / 22%); background: var(--ios-surface-solid); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: var(--ios-blue); box-shadow: 0 0 0 4px rgb(198 40 57 / 13%); outline: 0; }
.segmented-tabs { display: inline-flex; align-items: center; gap: 3px; width: fit-content; max-width: 100%; margin: 0 0 18px; padding: 4px; border: 1px solid rgb(60 60 67 / 12%); border-radius: 13px; background: rgb(118 118 128 / 12%); overflow-x: auto; }
.segmented-tab { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ios-secondary); font-size: 13px; font-weight: 750; white-space: nowrap; box-shadow: none; }
.segmented-tab:hover:not(:disabled) { background: rgb(255 255 255 / 55%); color: var(--ink); transform: none; }
.segmented-tab.active { background: var(--ios-surface-solid); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / 10%); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.summary-grid.compact { margin-top: 0; }
.summary-card { display: grid; gap: 5px; min-height: 100px; padding: 16px 17px; border: 1px solid rgb(60 60 67 / 10%); border-radius: 16px; background: var(--ios-surface); box-shadow: 0 5px 16px rgb(35 31 28 / 4%); }
.summary-card.success { background: var(--ios-green-soft); border-color: rgb(24 135 95 / 20%); }
.summary-card.accent { background: var(--ios-blue-soft); border-color: rgb(198 40 57 / 18%); }
.summary-card.muted { background: rgb(118 118 128 / 10%); }
.summary-label { color: var(--ios-secondary); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.summary-value { font-size: 22px; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.summary-detail { color: var(--ios-secondary); font-size: 12px; line-height: 1.35; }
.section-title-spaced { margin-top: 23px; }
.filter-panel { background: rgb(255 255 255 / 84%); }
.filter-grid { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.filter-grid .field:first-child { grid-column: span 2; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; grid-column: 1 / -1; margin-top: 2px; }
.filter-count { color: var(--ios-blue); font-size: 12px; font-weight: 750; }
.status-pill, .role-pill { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-pill.success { background: var(--ios-green-soft); color: #0d6b4b; }
.status-pill.danger { background: var(--danger-wash); color: var(--danger-ink); }
.status-pill.muted { background: rgb(118 118 128 / 13%); color: var(--ios-secondary); }
.role-pill { background: var(--ios-blue-soft); color: var(--ios-blue); }
.money-cell { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.module-selector { background: rgb(255 255 255 / 78%); }
.module-selector .field { max-width: 520px; }
.open-shift-card { max-width: 760px; }
.open-shift-card .eyebrow { margin-bottom: 7px; color: var(--ios-blue); }
.shift-status-card { background: linear-gradient(135deg, rgb(255 255 255 / 94%), rgb(255 245 245 / 94%)); }
.secondary-panel { background: rgb(255 255 255 / 70%); }
.team-list { display: grid; gap: 8px; }
.team-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--ios-separator); }
.team-row:last-child { border-bottom: 0; }
.team-identity, .team-meta { display: flex; align-items: center; gap: 11px; min-width: 0; }
.team-identity strong, .team-username { display: block; }
.team-identity strong { font-size: 14px; }
.team-username { margin-top: 3px; color: var(--ios-secondary); font-size: 12px; }
.team-meta { flex-wrap: wrap; justify-content: flex-end; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--ios-blue-soft); color: var(--ios-blue); font-size: 13px; font-weight: 850; }
.loyalty-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr); gap: 16px; align-items: start; }
.loyalty-preview { display: grid; gap: 8px; padding: 18px; border: 1px solid rgb(24 114 14 / 18%); border-radius: 18px; background: linear-gradient(145deg, #f3fbf1, #fff); box-shadow: var(--ios-shadow); }
.loyalty-preview strong { font-size: 15px; }
.loyalty-preview p { margin: 0; color: var(--ios-secondary); font-size: 13px; line-height: 1.55; }
.loyalty-settings { max-width: none; }
.loyalty-settings .loyalty-toggle { grid-column: 1 / -1; }
.loyalty-public { margin-top: 16px; }
.loyalty-public-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; align-items: center; margin-top: 14px; }
.loyalty-public-url { display: grid; gap: 8px; align-content: start; }
.loyalty-public-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.loyalty-public-link { font-size: 15px; font-weight: 600; color: var(--accent-dark); word-break: break-all; }
.loyalty-public-url .button { justify-self: start; }
.loyalty-public-qr { display: grid; gap: 8px; justify-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.loyalty-public-qr img { display: block; width: 160px; height: 160px; }
.loyalty-public-qr small { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) { .loyalty-public-row { grid-template-columns: 1fr; } .loyalty-public-qr { justify-self: start; } }


@media (max-width: 900px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid .field:first-child { grid-column: 1 / -1; }
  .loyalty-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main-area { padding: 20px 16px 30px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-heading h1 { font-size: 28px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-grid .field:first-child { grid-column: auto; }
  .filter-actions { justify-content: stretch; }
  .filter-actions .button { flex: 1; }
  .segmented-tabs { display: flex; width: 100%; }
  .segmented-tab { flex: 1 0 auto; }
  .team-row { align-items: flex-start; flex-direction: column; }
  .team-meta { justify-content: flex-start; padding-left: 51px; }
  .panel-pad { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .panel, .summary-card, .filter-panel { background: var(--ios-surface-solid); }
}
.field textarea { resize: vertical; min-height: 78px; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.form-note { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.csv-issues { display: grid; gap: 6px; margin: 0; padding-left: 22px; color: var(--danger); font-size: 13px; }
.purchase-line { padding: 12px 0; border-bottom: 1px solid var(--line); }
.category-list { display: grid; gap: 7px; margin: 10px 0 14px; }
.category-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.category-item-label { display: grid; gap: 3px; min-width: 0; }
.category-item-label strong { overflow-wrap: anywhere; font-size: 14px; }
.category-item-label small { color: var(--muted); font-size: 12px; }
.category-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr); gap: 20px; align-items: start; padding-bottom: 15px; border-bottom: 1px solid var(--ios-separator); }
.category-header .form-grid { margin: 0; }
.category-header .form-actions { align-items: end; }
.category-create .field-help { display: none; }
.category-create .button { min-width: 154px; }
.unknown-code-panel { margin: 16px 0; padding: 12px; border: 1px solid var(--warning-line); border-radius: 10px; background: var(--amber-wash); }
.unknown-code-panel td:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
.advanced-fields { padding: 10px 0; border-top: 1px solid var(--line); }
.advanced-fields summary { color: var(--interactive-dark); cursor: pointer; font-size: 13px; font-weight: 700; }
.advanced-grid { margin-top: 14px; }

/* Keep iOS segmented controls neutral after the global button skin is applied. */
.segmented-tab { background: transparent; color: var(--ios-secondary); box-shadow: none; }
.segmented-tab:hover:not(:disabled) { background: rgb(255 255 255 / 55%); color: var(--ink); box-shadow: none; }
.segmented-tab.active, .segmented-tab.active:hover:not(:disabled) { background: var(--ios-surface-solid); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / 10%); }

@media (max-width: 760px) {
  .category-header { grid-template-columns: 1fr; gap: 12px; }
  .category-create .form-actions { justify-content: stretch; }
  .category-create .form-actions .button { width: 100%; }
}

.pos-grid { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); gap: 18px; align-items: start; }
.pos-main .pos-grid { flex: 1; align-items: stretch; }
.catalog-panel, .ticket-panel { min-width: 0; }
.pos-main .catalog-panel { display: flex; min-height: 0; flex-direction: column; }
.scan-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; margin: 12px 0 10px; }
.scan-actions { display: flex; align-items: center; gap: 8px; }
.scan-input-wrap { position: relative; }
.scan-input { width: 100%; height: 56px; padding: 0 14px 0 44px; border: 1px solid var(--input-border); border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; box-shadow: inset 0 1px 2px rgb(0 0 0 / 3%); }
.scan-icon { position: absolute; left: 15px; top: 16px; color: var(--interactive); }
.scan-hint { margin: 0 2px 14px; color: var(--muted); font-size: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); grid-auto-rows: minmax(160px, auto); align-content: start; gap: 11px; max-height: calc(100vh - 310px); overflow: auto; padding: 1px 2px 2px 1px; }
.pos-main .product-grid { max-height: none; min-height: 0; flex: 1; }
.pos-main .catalog-panel .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pos-main .catalog-panel .product-card { min-height: 148px; padding: 8px; }
.pos-main .catalog-panel .product-card-image { height: 48px; margin-bottom: 3px; }
.pos-main .catalog-panel .product-card-name { min-height: 32px; font-size: 13px; }
.pos-main .catalog-panel .product-card-barcode { font-size: 9px; }
.pos-main .catalog-panel .product-card-bottom { gap: 3px; padding-top: 4px; }
.pos-main .catalog-panel .product-card-price { font-size: 16px; }
.pos-main .catalog-panel .stock-tag { font-size: 9px; }
.product-card { display: flex; min-height: 160px; flex-direction: column; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; transition: border .12s ease, transform .12s ease; }
.product-card:hover { border-color: var(--interactive); transform: translateY(-2px); }
.product-card-image { display: block; width: 100%; height: 60px; margin-bottom: 4px; border-radius: 8px; background: var(--surface-secondary); object-fit: cover; }
.product-card-name { min-height: 34px; font-size: 15px; font-weight: 750; line-height: 1.25; }
.product-card-barcode { margin-top: 3px; color: var(--muted); font-size: 11px; }
.product-card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 7px; }
.product-card-price { color: var(--ink); font-size: 19px; font-weight: 850; font-variant-numeric: tabular-nums; }
.stock-tag { color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.stock-tag.low { color: var(--warning-ink); font-weight: 800; }
.product-card:disabled { cursor: not-allowed; opacity: .58 !important; }
.product-card:disabled:hover { border-color: var(--line); transform: none; }
.product-list-search { width: min(100%, 560px); margin: 12px 0; }
.product-code-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.product-thumbnail { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 8px; background: var(--surface-secondary); object-fit: cover; }
.product-image-preview { display: block; width: min(100%, 320px); max-height: 180px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-secondary); object-fit: contain; }
.product-image-preview[hidden] { display: none; }

@media (max-width: 1120px) and (min-width: 761px) {
  .pos-main .catalog-panel .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .pos-main .catalog-panel .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field input[type="file"] { padding: 6px; }
.suggestion-list { position: absolute; z-index: 5; inset: 54px 0 auto; display: grid; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.suggestion-list[hidden] { display: none; }
.suggestion { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 43px; padding: 7px 9px; border: 0; border-radius: 6px; background: #fff; text-align: left; }
.suggestion:hover { background: var(--surface-secondary); }

.ticket-panel { overflow: hidden; }
.pos-main .ticket-panel { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.ticket-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ticket-head-row { display: flex; align-items: center; justify-content: space-between; }
.ticket-head h2 { margin: 0; font-size: 17px; }
.ticket-number { color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.ticket-body { padding: 12px 20px; }
.pos-main .ticket-body { min-height: 0; max-height: none; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.pos-main .ticket-body > div:not(.cart-empty) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-content: start; }
.pos-main .ticket-body > div:not(.cart-empty) .cart-line { min-width: 0; }
.cart-empty { display: grid; place-items: center; min-height: 155px; color: var(--muted); text-align: center; font-size: 13px; }
.pos-main .cart-empty { grid-column: 1 / -1; }
.cart-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line-info { min-width: 0; }
.cart-line-name { font-size: 14px; font-weight: 750; }
.cart-line-meta { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.cart-line-discount { margin-top: 6px; }
.cart-line-discount summary { min-height: 24px; padding: 2px 0; color: var(--interactive-dark); cursor: pointer; font-size: 11px; font-weight: 700; }
.cart-line-discount .field { margin: 6px 0; }
.qty-control { display: flex; align-items: center; gap: 3px; }
.qty-control button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
.qty-value { min-width: 26px; text-align: center; font-size: 14px; font-weight: 700; }
.cart-line-total { grid-column: 2; grid-row: 1; align-self: start; padding-top: 1px; text-align: right; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-line-controls { display: flex; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.cart-line-controls .cart-line-discount { margin: 0 auto 0 0; }
.cart-line-controls .cart-line-discount summary { display: flex; align-items: center; min-height: 44px; padding: 0 7px; }
.cart-line-controls .cart-line-discount[open] { flex: 1 0 100%; order: 3; }
.cart-line-controls .cart-line-remove { margin-left: auto; }
.cart-line-remove { display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; color: var(--danger); }
.cart-line-remove .nav-icon { width: 18px; height: 18px; }
.cart-line-remove .nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ticket-totals { display: grid; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--line); }
.pos-main .ticket-totals { flex: 0 0 auto; padding: 10px 20px 8px; background: var(--surface); }
.total-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 14px; }
.total-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.total-row.grand { margin-top: 3px; padding: 14px; border-radius: 9px; background: var(--accent-wash); color: var(--ink); font-weight: 800; }
.total-row.grand strong { color: var(--accent-dark); font-size: 28px; letter-spacing: -.03em; }
.pos-main .total-row.grand { margin-top: 0; padding: 8px 0 0; border-radius: 0; border-top: 1px solid var(--line); background: transparent; }
.pos-main .total-row.grand strong { color: var(--accent-dark); font-size: 24px; }
.pos-main .payment-box { position: static; flex: 0 0 auto; }
.payment-box { display: grid; gap: 9px; padding: 11px 16px 14px; border-top: 1px solid var(--line); background: var(--surface-secondary); box-shadow: 0 -5px 14px rgb(26 26 26 / 7%); }
.payment-box .callout.info { padding: 7px 9px; font-size: 11px; line-height: 1.35; }
.pos-main .payment-form { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 8px 10px; align-items: end; }
.pos-main .payment-form .field { grid-column: 1; }
.pos-main .payment-form .external-payments, .pos-main .payment-form .callout { grid-column: 1 / -1; }
.pos-main .payment-form .callout.info { display: none; }
.pos-main .payment-form .checkout-button { grid-column: 2; grid-row: 1 / span 2; min-height: 52px; }
.mobile-cart-bar, .mobile-cart-backdrop, .mobile-cart-back { display: none; }
.pos-category-chips { display: flex; gap: 8px; min-width: 0; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.pos-category-chip { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 700; white-space: nowrap; }
.pos-category-chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.mobile-shift-note { display: none; }
.checkout-note { padding: 9px 10px; border-radius: 7px; background: var(--amber-wash); color: var(--warning-ink); font-size: 11px; line-height: 1.4; }
.checkout-button { width: 100%; min-height: 54px; font-size: 16px; }
.external-payments { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.external-payments span { padding: 5px 8px; border: 1px dashed var(--line); border-radius: 6px; }

.callout { display: flex; align-items: flex-start; gap: 11px; padding: 14px 15px; border: 1px solid var(--warning-line); border-radius: 10px; background: var(--amber-wash); color: var(--warning-ink); font-size: 13px; line-height: 1.55; }
.callout.info { border-color: var(--info-border); background: var(--info-wash); color: var(--info); }
.callout.success { border-color: var(--success-border); background: var(--success-wash); color: var(--success-ink); }
.callout.danger { border-color: var(--danger-border); background: var(--danger-wash); color: var(--danger-ink); }
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.metric { padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-value { margin-top: 9px; font-size: 22px; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.table-wrap { overflow: auto; }
.table-scroll-hint { display: none; }
.inventory-category-row th { background: var(--surface-secondary); color: var(--ink); font-size: 12px; letter-spacing: 0; text-transform: none; }
.inventory-count-group { margin-top: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 13px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--surface-secondary); }
.status-tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--success-wash); color: var(--success-ink); font-size: 12px; font-weight: 750; }
.empty-state { padding: 32px 14px; color: var(--muted); text-align: center; font-size: 13px; }
.cash-session-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cash-session-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.cash-session-meta { color: var(--muted); font-size: 11px; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 65% 55% at 20% 0%, rgba(255,214,102,.28), transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 10%, rgba(24,114,14,.14), transparent 55%),
    radial-gradient(ellipse 45% 40% at 70% 100%, rgba(24,114,14,.08), transparent 55%),
    linear-gradient(180deg, #fbfdf8 0%, #f3f8f1 100%);
}
.auth-screen::before, .auth-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-screen::before {
  width: 420px; height: 420px;
  top: -140px; right: -80px;
  background: radial-gradient(circle, rgba(255,214,102,.35) 0%, rgba(255,214,102,0) 70%);
}
.auth-screen::after {
  width: 320px; height: 320px;
  bottom: -100px; left: -60px;
  background: radial-gradient(circle, rgba(24,114,14,.12) 0%, rgba(24,114,14,0) 70%);
}
.auth-shell {
  width: min(100%, 1040px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.auth-hero { padding: 20px 0; }
.auth-logo { display: block; width: auto; height: 76px; max-width: 230px; object-fit: contain; margin: 0 0 28px; }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 16px; padding: 8px 14px;
  font-size: 12px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase;
  color: #16610d; background: rgba(255,255,255,.75); border: 1px solid rgba(24,114,14,.12);
  border-radius: 999px; box-shadow: 0 2px 8px rgba(24,54,20,.04);
}
.auth-eyebrow::before { content: "✦"; font-size: 11px; color: #e0a800; }
.auth-title { margin: 0; font-size: clamp(38px, 5vw, 60px); line-height: .98; letter-spacing: -.045em; font-weight: 760; color: var(--ink); max-width: 11ch; }
.auth-lead { margin: 22px 0 0; max-width: 36ch; font-size: 17px; line-height: 1.65; color: #4f614b; }
.auth-card {
  width: 100%;
  padding: 36px 32px;
  border: 1px solid rgba(24,114,14,.10);
  border-radius: 28px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 24px 70px -28px rgba(24,54,20,.22), 0 4px 12px rgba(24,54,20,.04);
}
.auth-card-title { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.035em; font-weight: 720; color: var(--ink); }
.auth-card-lead { margin: 8px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.auth-form { display: grid; gap: 16px; }
.auth-form .field label { font-size: 14px; font-weight: 600; color: var(--ink); }
.auth-form .field input, .auth-form .field select { min-height: 50px; border-radius: 14px; border-color: #d7e0d4; background: #fff; }
.auth-form .field input:focus, .auth-form .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(24,114,14,.12); }
.auth-submit { margin-top: 8px; min-height: 52px; border-radius: 14px; font-size: 16px; font-weight: 720; letter-spacing: -.01em; background: linear-gradient(135deg, #2aa816 0%, #18720e 55%, #145f0c 100%); box-shadow: 0 14px 30px -12px rgba(24,114,14,.55); }
.auth-submit:hover:not(:disabled) { filter: brightness(1.03); transform: translateY(-1px); }
.auth-form .callout { margin: 0; font-size: 13px; }
.app-footer-note { padding: 0 18px 14px; color: var(--muted); font-size: 10px; text-align: center; }
.toast-region { position: fixed; right: 20px; bottom: 18px; z-index: 20; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); color: var(--ink); font-size: 12px; }
.toast.error { border-color: var(--danger-border); background: var(--danger-wash); color: var(--danger-ink); }
.modal-backdrop { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 18px; background: rgb(26 26 26 / 50%); }
.modal { width: min(100%, 490px); max-height: 90vh; overflow: auto; padding: 22px; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgb(0 0 0 / 25%); }
.modal h2 { margin: 0 0 8px; font-size: 19px; }
.modal p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-form { display: grid; gap: 13px; margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }
.scanner-open { overflow: hidden; }
.scanner-modal { width: min(100%, 520px); }
.scanner-stage { position: relative; width: 100%; height: min(54vh, 370px); min-height: 230px; overflow: hidden; border-radius: 12px; background: #1a1a1a; }
.scanner-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scanner-reticle { position: absolute; inset: 28% 12%; border: 2px solid rgb(255 255 255 / 90%); border-radius: 12px; box-shadow: 0 0 0 999px rgb(26 26 26 / 24%); pointer-events: none; }
.camera-status { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { padding: 14px 9px; }
  .sidebar-brand { justify-content: space-between; gap: 0; padding: 0 5px; }
  .sidebar-brand > div:nth-child(2) { display: none; }
  .sidebar-brand .brand-mark { width: auto; height: 36px; }
  .sidebar-brand .nav-collapse-toggle { width: 28px; height: 28px; min-height: 28px; }
  .nav-list { gap: 4px; }
  .nav-section, .nav-children, .nav-chevron, .nav-label, .nav-dot { display: none; }
  .nav-group { display: contents; }
  .nav-button { justify-content: center; min-height: 43px; padding: 6px; font-size: 10px; line-height: 1.2; white-space: normal; }
  .nav-icon { width: auto; }
  .nav-icon svg { width: 19px; height: 19px; }
  .nav-group-button.active { color: var(--ink); background: var(--selected); }
  .section-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 16px; overflow-x: auto; scrollbar-width: none; }
  .section-tabs::-webkit-scrollbar { display: none; }
  .hide-compact { display: none; }
  .table-scroll-hint { display: block; margin: -4px 0 12px; }
  .table-wrap table { min-width: 760px; }
  .pos-grid { grid-template-columns: minmax(0,1fr) minmax(390px,.95fr); }
}
@media (max-width: 760px) {
  .app-shell { position: fixed; inset: 0; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; }
  .app-shell.pos-shell { height: 100dvh; min-height: 0; overflow: hidden; }
  @supports (overflow: clip) { .app-shell, .app-shell.pos-shell { overflow: clip; } }
  .topbar { min-width: 0; padding: 0 12px; gap: 8px; }
  .app-column { grid-template-rows: 60px minmax(0,1fr); }
  .topbar-spacer { min-width: 0; }
  .brand-name { font-size: 14px; }
  .brand-caption { font-size: 11px; letter-spacing: .04em; }
  .button.small-button { min-height: 44px; }
  .workspace { width: 100%; height: 100dvh; min-width: 0; min-height: 0; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto; overflow: visible; }
  .pos-shell .workspace { height: 100%; overflow: visible; }
  .app-footer-note { display: none; }
  .mobile-shift-note { display: flex; margin: 10px 0; }
  .app-column { grid-row: 1; }
  .sidebar { grid-row: 2; min-width: 0; min-height: 0; position: relative; bottom: auto; align-self: stretch; z-index: 4; display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-right: 0; background: #fff; }
  .sidebar-brand { display: none; }
  .nav-collapse-toggle { display: none; }
  .sidebar.collapsed .nav-section, .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-child, .sidebar.collapsed .nav-chevron { display: initial; }
  .sidebar.collapsed .nav-child { display: flex; }
  .sidebar.collapsed .nav-list { gap: 2px; }
  .sidebar.collapsed .nav-button { justify-content: center; width: auto; min-height: 54px; margin: 0; padding: 5px 3px; }
  .nav-list { display: flex; width: 100%; min-width: 0; max-width: 100%; justify-content: flex-start; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-button { display: grid; flex: 0 0 70px; justify-items: center; gap: 3px; min-height: 54px; padding: 5px 3px; border-radius: 8px; font-size: 11px; }
  .nav-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-icon svg { width: 17px; height: 17px; }
  .section-tabs { margin-top: -8px; }
  .main-area { min-width: 0; min-height: 0; max-height: 100%; order: 1; padding: 17px 12px calc(92px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior-y: contain; scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  .table-scroll-hint { display: none; }
  .table-wrap table.responsive-table { display: block; width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .responsive-table tbody { display: grid; gap: 10px; }
  .responsive-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); min-width: 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .responsive-table td { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 9px 10px; border: 0; overflow-wrap: anywhere; font-size: 13px; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .responsive-table td:first-child { grid-column: 1 / -1; color: var(--ink); font-weight: 750; }
  .responsive-table td[data-label="Acciones"] { display: flex; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; gap: 6px; }
  .responsive-table td[data-label="Acciones"]::before { flex-basis: 100%; }
  .responsive-table td button, .table-wrap .button.small-button { min-height: 44px; }
  .table-wrap .button.small-button { min-height: 44px; }
  .pos-main { display: block; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; }
  .page-heading { align-items: start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .pos-grid { width: 100%; grid-template-columns: minmax(0,1fr); }
  .pos-main .pos-grid { display: grid; }
  .scan-actions { gap: 6px; }
  .scan-actions .focus-scan-button { display: none; }
  .app-shell.pos-shell > .ticket-panel { display: none; }
  .catalog-panel { order: 1; }
  .pos-category-chips { margin: 0 -2px; padding-bottom: 12px; }
  .pos-category-chip { min-height: 44px; }
  .product-grid { max-height: none; overflow: visible; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-card-image { height: 72px; }
  .cart-line { grid-template-columns: minmax(0,1fr) auto; gap: 3px 8px; padding: 9px 0; }
  .cart-line-name { font-size: 14px; line-height: 1.2; }
  .cart-line-meta { margin-top: 2px; font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
  .cart-line-total { font-size: 14px; }
  .cart-line-controls { min-height: 44px; }
  .cart-line-remove { width: 44px; height: 44px; min-height: 44px; }
  .mobile-cart-bar:not([hidden]) { position: fixed; right: 12px; bottom: calc(67px + env(safe-area-inset-bottom) + 8px); left: 12px; z-index: 8; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); text-align: left; }
  .cart-bar-items, .cart-bar-action { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
  .cart-bar-items .nav-icon { color: #fff; }
  .cart-bar-items strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  .cart-bar-total { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .cart-bar-action { color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
  .cart-bar-chevron { display: grid; place-items: center; width: 18px; height: 18px; transition: transform .16s ease; }
  .cart-bar-chevron svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .cart-expanded .cart-bar-chevron { transform: rotate(180deg); }
  .cart-expanded .mobile-cart-bar { display: none !important; }
  .mobile-cart-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 9; display: block; border: 0; background: rgb(26 26 26 / 26%); }
  .app-shell.pos-shell > .ticket-panel { display: none; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel { position: fixed; inset: env(safe-area-inset-top) 0 0; z-index: 10; display: flex; width: 100%; max-height: none; min-height: 0; flex-direction: column; overflow: hidden; border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 34px rgb(0 0 0 / 14%); padding-bottom: env(safe-area-inset-bottom); }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .ticket-head { flex: 0 0 auto; padding: 12px 16px; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .ticket-head-row { flex-wrap: wrap; gap: 8px; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .mobile-cart-back { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-left: auto; padding: 0 12px; font-size: 12px; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .ticket-body { min-height: 100px; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .ticket-body > div:not(.cart-empty) { display: block; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .ticket-totals { flex: 0 0 auto; padding: 10px 16px; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-box { position: relative; flex: 0 0 auto; max-height: 38dvh; overflow-y: auto; overscroll-behavior: contain; padding: 10px 16px max(14px,env(safe-area-inset-bottom)); box-shadow: none; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form { display: grid; grid-template-columns: 1fr; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form .field,
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form .external-payments,
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form .callout,
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form .checkout-button { grid-column: 1; grid-row: auto; }
  .app-shell.pos-shell.cart-expanded > .ticket-panel .payment-form .callout.info { display: block; }
  .app-shell.cart-expanded .sidebar { visibility: hidden; }
  .pos-shell.cart-expanded .main-area { overflow: hidden; }
  .metric-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; gap: 28px; max-width: 520px; }
  .auth-hero { padding: 0; text-align: center; }
  .auth-logo { margin: 0 auto 20px; height: 60px; }
  .auth-title { max-width: none; font-size: clamp(32px, 8vw, 44px); }
  .auth-lead { margin-left: auto; margin-right: auto; }
  .auth-card { padding: 28px 22px; }
  .scanner-backdrop { padding: max(14px,env(safe-area-inset-top)) 12px max(14px,env(safe-area-inset-bottom)); }
  .scanner-modal { max-height: calc(100dvh - 28px); padding: 18px; }
  .scanner-stage { height: min(52vh, 360px); min-height: 210px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* Sistema visual Abasto inspirado en SysTienda: oscuro estructural, oro funcional y movimiento corto. */
.workspace { grid-template-columns: 268px minmax(0, 1fr); }
.workspace.nav-collapsed { grid-template-columns: 78px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 0; border-right-color: rgb(255 255 255 / 7%); background: linear-gradient(180deg, #0d0a05 0%, #16120a 100%); }
.sidebar-brand { height: 68px; min-height: 68px; padding: 0 20px; gap: 12px; }
.sidebar-brand .brand-mark { display: flex; align-items: center; width: auto; height: 40px; max-width: 140px; flex-shrink: 0; overflow: visible; }
.sidebar-brand .brand-name { color: #fff; font-size: 18px; }
.sidebar-brand .brand-caption { color: #9aa3ad; font-size: 11px; }
.sidebar-brand .sidebar-store-name { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; text-transform: none; margin-top: 0; line-height: 1.2; }
.sidebar .nav-list { flex: 1; min-height: 0; align-content: start; overflow-y: auto; padding: 2px 12px 16px; scrollbar-width: thin; scrollbar-color: #3b4149 transparent; }
.nav-section { color: #818a95; padding: 1.1rem .75rem .45rem; margin: 0; }
.nav-section:first-child { padding-top: .45rem; }
.nav-button { min-height: 42px; padding: 0 .8rem; border-radius: 11px; color: #c5cbd1; font-size: 14px; font-weight: 500; transition: background .15s ease, color .15s ease, transform .15s ease; }
.nav-button:hover { background: rgb(255 255 255 / 6%); color: #e2e8f0; transform: translateX(1px); }
.sidebar:not(.collapsed) .nav-button.active, .sidebar:not(.collapsed) .nav-group-button.active { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgb(0 0 0 / 70%); }
.sidebar:not(.collapsed) .nav-child.active { background: rgb(255 255 255 / 7%); color: #fff; box-shadow: none; }
.nav-children { border-left-color: rgb(255 255 255 / 8%); }
.nav-child { color: #c5cbd1; }
.sidebar.collapsed .sidebar-brand { padding: 0; }
.sidebar.collapsed .nav-list { padding-right: 12px; padding-left: 12px; }
.sidebar.collapsed .nav-button { width: 50px; min-height: 46px; border-radius: 11px; }
.sidebar.collapsed .nav-button.active { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgb(0 0 0 / 70%); }

.topbar { background: color-mix(in srgb, var(--paper) 84%, transparent); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: none; backdrop-filter: blur(14px); }
.nav-collapse-toggle { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: 0 1px 2px rgb(15 23 42 / 4%); flex-shrink: 0; }
.nav-collapse-toggle:hover { border-color: var(--accent); background: var(--surface); color: var(--accent-dark); }
.button { border-radius: 11px; background: var(--grad); box-shadow: 0 8px 18px -10px rgb(196 154 44 / 80%); transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.button:hover:not(:disabled) { background: var(--grad); box-shadow: 0 12px 24px -10px rgb(196 154 44 / 95%); transform: translateY(-1px); }
.button:active:not(:disabled) { transform: scale(.98); }
.button.secondary { box-shadow: none; }
.button.ghost { box-shadow: none; }
.field input, .field select, .field textarea, .search-input, .scan-input { border-radius: 11px; border-color: var(--line); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus, .scan-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgb(196 154 44 / 12%); outline: none; }
.panel { border-radius: 16px; box-shadow: var(--shadow); }
.product-card { border: 1.5px solid transparent; border-radius: 14px; background: var(--surface-secondary); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease; animation: abasto-card-in .26s ease-out both; }
.product-card:hover { border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card:active { transform: scale(.985); }
.product-card:nth-child(2) { animation-delay: 20ms; }
.product-card:nth-child(3) { animation-delay: 40ms; }
.product-card:nth-child(4) { animation-delay: 60ms; }
.product-card:nth-child(5) { animation-delay: 80ms; }
.product-card:nth-child(6) { animation-delay: 100ms; }
.product-card:nth-child(7) { animation-delay: 120ms; }
.product-card:nth-child(8) { animation-delay: 140ms; }
.product-card-image { border-radius: 11px; }
.pos-category-chip { transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease; }
.pos-category-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.pos-category-chip.active { border-color: transparent; background: var(--grad); box-shadow: 0 8px 18px -8px rgb(196 154 44 / 90%); }
.pos-category-chip:not(.active) { background: var(--surface); color: var(--ink-soft); box-shadow: none; }
.cart-line { border-bottom-style: dashed; animation: abasto-line-in .22s ease-out both; }
.cart-line:nth-child(2) { animation-delay: 25ms; }
.cart-line:nth-child(3) { animation-delay: 50ms; }
.cart-line:nth-child(4) { animation-delay: 75ms; }
.qty-control button:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-dark); }
.pos-main .ticket-totals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(128px, .55fr); align-items: center; gap: 14px; padding: 7px 20px; }
.ticket-summary { display: grid; gap: 3px; min-width: 0; }
.ticket-summary .total-row { min-height: 19px; font-size: 12px; }
.ticket-summary .total-row strong { font-size: 12px; }
.pos-main .ticket-totals .total-row.grand { display: grid; align-content: center; justify-items: end; gap: 3px; min-height: 56px; margin: 0; padding: 0 0 0 14px; border-top: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; text-align: right; }
.pos-main .ticket-totals .total-row.grand span { font-size: 11px; letter-spacing: .08em; }
.pos-main .ticket-totals .total-row.grand strong { font-size: 24px; line-height: 1; }
.checkout-button { border: 0; border-radius: 14px; background: linear-gradient(135deg, #239a14, #15630c); box-shadow: 0 14px 26px -12px rgb(27 127 16 / 42%); font-size: 16px; }
.checkout-button:hover:not(:disabled) { background: linear-gradient(135deg, #eb4758, #a91c2d); box-shadow: 0 16px 28px -12px rgb(181 31 49 / 86%); transform: translateY(-1px); }
.checkout-button:active:not(:disabled) { transform: scale(.985); }
.total-row.grand { background: var(--accent-wash); }
.total-row.grand strong, .pos-main .total-row.grand strong { color: var(--accent-dark); }
.toast, .modal, .suggestion-list { border-radius: 14px; box-shadow: var(--shadow); }

@keyframes abasto-pulse { 70% { box-shadow: 0 0 0 8px rgb(16 185 129 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(16 185 129 / 0%); } }
@keyframes abasto-card-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes abasto-line-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar-brand { padding: 0; }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { background: color-mix(in srgb, var(--surface) 94%, var(--paper)); border-top-color: var(--line); box-shadow: 0 -8px 24px rgb(15 23 42 / 6%); }
  .sidebar .nav-list { padding: 4px 2px; overflow-x: auto; overflow-y: hidden; gap: 4px; }
  .sidebar .nav-button { color: var(--muted); background: transparent; box-shadow: none; }
  .sidebar .nav-button:hover { background: var(--surface-secondary); color: var(--ink); transform: none; }
  .sidebar .nav-button.active, .sidebar .nav-group-button.active, .sidebar:not(.collapsed) .nav-button.active, .sidebar:not(.collapsed) .nav-group-button.active { color: var(--accent-dark); background: var(--accent-wash); box-shadow: none; }
  .sidebar .nav-icon { color: inherit; }
  .sidebar .nav-label { color: inherit; font-weight: 650; }
  .topbar { background: var(--paper); }
  .nav-collapse-toggle { display: none; }
  .button { box-shadow: none; }
  .pos-main .ticket-totals { grid-template-columns: minmax(0, 1fr) minmax(112px, .55fr); gap: 10px; padding-right: 16px; padding-left: 16px; }
  .pos-main .ticket-totals .total-row.grand { padding-left: 10px; }
  .pos-main .ticket-totals .total-row.grand strong { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* La navegación y el estado de la sesión comparten una barra lateral de altura completa. */
.app-column { display: block; min-width: 0; min-height: 0; }
.pos-shell .workspace { height: 100dvh; min-height: 0; }
.pos-shell .sidebar { height: 100dvh; overflow: hidden; }
.pos-shell .app-column { display: grid; height: 100dvh; grid-template-rows: minmax(0, 1fr) auto; }
.pos-shell .main-area { padding: 16px 20px 10px; }
.pos-main { min-height: 0; }
.pos-main .pos-grid { width: 100%; min-height: 0; align-items: stretch; }
.pos-main .catalog-panel > .panel-title,
.pos-main .catalog-panel > .scan-row,
.pos-main .catalog-panel > .scan-hint,
.pos-main .catalog-panel > .pos-category-chips,
.pos-main .catalog-panel > .callout { flex: 0 0 auto; }
.pos-main .catalog-panel > .product-grid { min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.pos-main .ticket-body { min-height: 0; }
.pos-main .payment-form .callout.info { display: block; }
.sidebar-brand { flex: 0 0 60px; height: 60px; min-height: 60px; padding: 0 14px; gap: 10px; }
.sidebar-brand > div:nth-child(2) { min-width: 0; }
.sidebar-brand .brand-caption { overflow: hidden; letter-spacing: .06em; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand > .nav-collapse-toggle { flex: 0 0 40px; height: 40px; min-height: 40px; margin-left: auto; }
.sidebar:not(.collapsed) .nav-toggle-arrow { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-brand { justify-content: center; gap: 0; padding: 0 8px; }
.sidebar.collapsed .sidebar-brand .brand-mark { display: none; }
.sidebar.collapsed .sidebar-brand .nav-collapse-toggle { width: 40px; height: 40px; min-height: 40px; flex-basis: 40px; border-radius: 10px; }
.sidebar.collapsed .nav-collapse-toggle:hover .nav-toggle-arrow,
.sidebar.collapsed .nav-collapse-toggle:focus-visible .nav-toggle-arrow { transform: translateX(3px); }
.sidebar:not(.collapsed) .nav-collapse-toggle:hover .nav-toggle-arrow,
.sidebar:not(.collapsed) .nav-collapse-toggle:focus-visible .nav-toggle-arrow { transform: translateX(-3px) rotate(180deg); }
.sidebar .nav-list { flex: 1 1 auto; gap: 4px; }
.sidebar .nav-section { padding: .65rem .75rem .2rem; }
.sidebar .nav-button { min-height: 38px; }
.sidebar-account { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 8px 16px 12px; border-top: 1px solid rgb(255 255 255 / 8%); }
.sidebar-user-role { min-width: 0; color: #c5cbd1; font-size: 12px; font-weight: 600; }
.sidebar-account .sidebar-logout { display: inline-flex; flex: 0 0 auto; width: auto; min-height: 34px; justify-content: center; gap: 7px; padding: 0 9px; border-color: rgb(255 255 255 / 12%); background: transparent; color: #f3f4f6; box-shadow: none; }
.sidebar-account .sidebar-logout:hover { border-color: rgb(255 255 255 / 24%); background: rgb(255 255 255 / 7%); color: #fff; }
.sidebar-account .sidebar-logout .nav-icon { width: 16px; flex: 0 0 16px; }
.sidebar.collapsed .sidebar-account { flex-direction: column; justify-content: center; gap: 8px; padding: 10px 4px 8px; }
.sidebar.collapsed .sidebar-user-role { width: 62px; font-size: 8px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.sidebar.collapsed .sidebar-account .sidebar-logout { width: 40px; min-height: 40px; padding: 0; }
.sidebar.collapsed .sidebar-account .logout-label { display: none; }
.app-shell[data-quiet-refresh="true"] .product-card,
.app-shell[data-quiet-refresh="true"] .cart-line,
.pos-grid.quiet-refresh .product-card,
.pos-grid.quiet-refresh .cart-line,
.ticket-panel.quiet-refresh .cart-line { animation: none !important; }

@media (min-width: 761px) {
  .app-shell:not(.pos-shell) .sidebar { position: sticky; top: 0; height: 100dvh; align-self: start; overflow: hidden; }
}

@media (max-width: 1020px) and (min-width: 761px) {
  .sidebar-brand { justify-content: space-between; gap: 0; padding: 0 5px; }
  .sidebar-brand .brand-mark { width: auto; height: 36px; }
  .sidebar-brand .nav-collapse-toggle { flex-basis: 28px; width: 28px; height: 28px; min-height: 28px; }
  .sidebar-account { flex-direction: column; justify-content: center; gap: 8px; padding: 10px 4px 8px; }
  .sidebar-user-role { width: 62px; font-size: 8px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
  .sidebar-account .sidebar-logout { width: 40px; min-height: 40px; padding: 0; }
  .sidebar-account .logout-label { display: none; }
}

@media (max-width: 760px) {
  .pos-shell .workspace { height: 100%; }
  .pos-shell .sidebar { height: auto; overflow: hidden; padding-bottom: calc(2px + env(safe-area-inset-bottom)); }
  .pos-shell .app-column { height: 100%; grid-template-rows: minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; gap: 4px; }
  .sidebar .nav-list { flex: 1 1 auto; width: auto; min-width: 0; }
  .sidebar-account { flex: 0 0 auto; flex-direction: row; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 0 2px 0 0; border: 0; }
  .sidebar-user-role { display: none; }
  .sidebar-account .sidebar-logout { width: 42px; min-height: 42px; justify-content: center; padding: 0; border-color: var(--line); background: var(--surface); color: var(--ink-soft); box-shadow: none; }
  .sidebar-account .sidebar-logout:hover { border-color: var(--line-strong); background: var(--surface-secondary); color: var(--ink); }
  .sidebar-account .logout-label { display: none; }
}

/* Mobile polish: keep the full system comfortable on phones. */
@media (max-width: 760px) {
  .app-shell, .app-shell.pos-shell { height: 100dvh; }
  .workspace, .pos-shell .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: 100dvh; }
  .app-column { grid-template-rows: 56px minmax(0, 1fr); min-height: 0; }
  .topbar { height: 56px; padding: 0 12px; gap: 10px; backdrop-filter: none; }
  .topbar .brand-name { font-size: 15px; }
  .topbar .brand-caption { display: none; }
  .sidebar, .pos-shell .sidebar { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: color-mix(in srgb, var(--surface) 94%, var(--paper)); box-shadow: 0 -8px 24px rgb(15 23 42 / 4%); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .sidebar .nav-list { display: flex; flex: 1 1 auto; align-items: stretch; gap: 4px; padding: 0; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity; }
  .sidebar .nav-list::-webkit-scrollbar { display: none; }
  .sidebar .nav-button { flex: 0 0 72px; width: 72px; min-width: 72px; min-height: 56px; padding: 8px 6px; border-radius: 14px; gap: 4px; color: var(--muted); scroll-snap-align: start; transition: color .15s ease, background .15s ease, transform .15s ease; }
  .sidebar .nav-button:active { transform: scale(.96); }
  .sidebar .nav-button.active { color: var(--accent-dark, var(--accent)); background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .sidebar .nav-icon { width: 22px; height: 22px; flex: 0 0 22px; }
  .sidebar .nav-icon svg { width: 22px; height: 22px; }
  .sidebar .nav-label { display: block; font-size: 10px; line-height: 1.1; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
  .sidebar-account { padding: 0 0 0 2px; margin-left: 2px; border-left: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
  .sidebar-account .sidebar-logout { width: 44px; min-height: 56px; border-radius: 14px; color: var(--muted); }
  .main-area { padding: 14px 12px calc(78px + env(safe-area-inset-bottom)); }
  .pos-shell .main-area { padding: 12px 12px calc(78px + env(safe-area-inset-bottom)); }
  .page-heading { gap: 10px; margin: 0 0 14px; }
  .page-heading h1 { font-size: clamp(24px, 7vw, 32px); line-height: 1.08; letter-spacing: -.03em; }
  .page-heading p { font-size: 14px; line-height: 1.45; }
  .panel { border-radius: 14px; }
  .panel-pad { padding: 14px; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { min-height: 0; padding: 14px; }
  .segmented-tabs { width: 100%; max-width: 100%; }
  .segmented-tab { flex: 1 1 0; min-width: 0; padding: 0 10px; font-size: 12px; }
  .filter-grid, .form-grid, .pos-grid, .metric-grid { grid-template-columns: 1fr; }
  .filter-grid .span-2, .form-grid .span-2 { grid-column: auto; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { width: 100%; max-width: 100%; max-height: calc(100dvh - 20px); padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 14px 14px; }
  .modal h3 { font-size: 24px; line-height: 1.15; }
  .scan-row { flex-direction: column; align-items: stretch; }
  .scan-input-wrap { min-width: 0; width: 100%; }
  .scan-actions { width: 100%; justify-content: stretch; }
  .scan-actions .button { flex: 1 1 0; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { padding: 10px; border-radius: 12px; }
  .product-card-name { font-size: 13px; line-height: 1.25; }
  .product-card-meta, .product-card-stock { font-size: 11px; }
  .product-card-price { font-size: 16px; }
  .table-wrap { border-radius: 12px; }
  .responsive-table tbody tr { border-radius: 12px; padding: 6px; }
  .responsive-table td { padding: 8px 8px; }
  .auth-screen { padding: 24px 14px; }
  .auth-shell { gap: 24px; }
  .auth-logo { height: 52px; margin-bottom: 16px; }
  .auth-title { font-size: clamp(30px, 9vw, 40px); }
  .auth-lead { font-size: 15px; }
  .auth-card { padding: 24px 18px; border-radius: 20px; }
  .auth-card-title { font-size: 24px; }
  .field input, .field select, .field textarea, .search-input, .scan-input { font-size: 16px; }
  .button { min-height: 44px; }
  .field input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; margin: 0; position: relative; }
  .field input[type="checkbox"]::after { content: ''; position: absolute; inset: -10px; }
  .mobile-cart-bar:not([hidden]) { bottom: calc(88px + env(safe-area-inset-bottom)); }
  body:has(.mobile-cart-bar:not([hidden])) .main-area { padding-bottom: calc(168px + env(safe-area-inset-bottom)); }
}
/* Final cascade guard: segmented controls must stay neutral after the global button skin. */
.button.segmented-tab { background: transparent; color: var(--ios-secondary); box-shadow: none; }
.button.segmented-tab:hover:not(:disabled) { background: rgb(255 255 255 / 55%); color: var(--ink); box-shadow: none; }
.button.segmented-tab.active, .button.segmented-tab.active:hover:not(:disabled) { background: var(--ios-surface-solid); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / 10%); }

/* Reports */
.report-filters { padding: 14px 16px; }
.report-filter-row { display: grid; grid-template-columns: minmax(0,180px) minmax(0,180px) auto; gap: 12px; align-items: end; }
.report-filter-row .field-wrap { margin: 0; }
.report-filter-actions { display: flex; align-items: end; padding-bottom: 2px; }
.report-filter-actions .button { min-height: 44px; }
.report-kpis { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin: 14px 0 18px; }
.report-kpi { background: var(--surface, #fff); border: 1px solid rgba(0,0,0,.08); border-radius: 16px; padding: 16px 16px 14px; min-width: 0; }
.report-kpi.accent { background: #f3faf5; border-color: rgba(31,128,72,.18); }
.report-kpi-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #66706a; margin-bottom: 8px; }
.report-kpi-value { font-size: 28px; line-height: 1.1; font-weight: 800; color: #1a1f1c; word-break: break-word; }
.report-kpi-note { margin-top: 8px; font-size: 12px; color: #6b756f; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; align-items: start; }
.report-section { min-width: 0; }
.report-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.report-section-head .panel-title { margin: 0; }
.report-count { flex: 0 0 auto; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: #eef3ef; color: #4f5a55; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.report-empty { padding: 18px 14px; border: 1px dashed rgba(0,0,0,.12); border-radius: 12px; color: #6b756f; font-size: 14px; background: #fafcfb; }
.report-table th { font-size: 12px; color: #5f6964; white-space: nowrap; }
.report-table td { vertical-align: top; }
@media (max-width: 1100px) { .report-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 900px) { .report-grid { grid-template-columns: 1fr; } .report-filter-row { grid-template-columns: 1fr 1fr; } .report-filter-actions { grid-column: 1 / -1; } }
@media (max-width: 640px) { .report-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .report-kpi-value { font-size: 24px; } .report-filter-row { grid-template-columns: 1fr; } }
