:root {
  --bg: #f4f6f5;
  --bg-2: #e8eeec;
  --surface: #ffffff;
  --sidebar: #16302c;
  --sidebar-2: #1e403a;
  --ink: #1a1f1e;
  --muted: #5c6664;
  --line: #e2e7e5;
  --primary: #1f6f64;
  --primary-2: #27887a;
  --accent: #1f6f64;
  --danger: #b42318;
  --warn: #b45309;
  --ok: #157a3a;
  --shadow: 0 8px 24px rgba(22, 48, 44, .06);
  --shadow-lg: 0 20px 44px rgba(22, 48, 44, .16);
  --radius: 18px;
  --focus: 0 0 0 3px rgba(31, 111, 100, .28);
  --font: "Avenir Next", "Segoe UI Variable", "Segoe UI", "Nunito Sans", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom);
  --dock-h: calc(68px + var(--safe-b));
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  overscroll-behavior: none;
}
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html:has(body.auth-body), body.auth-body {
  overflow: auto; height: auto; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: #d7ece8; }
[hidden] { display: none !important; }

input, select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #c5d0cd; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(31, 111, 100, .14); }
input.js-money, input.js-qty { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.logo-svg { width: 30px; height: 30px; display: block; fill: #fff; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 14px; overflow: hidden; flex-shrink: 0;
  background: var(--primary); color: #fff; display: grid; place-items: center;
}
.logo-mark img { width: 30px; height: 30px; display: block; }

/* ——— Auth ——— */
.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--sidebar);
}
.auth-wrap {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.auth-hero {
  background: var(--sidebar);
  color: #f4fffc;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 460px;
}
.auth-hero h1 { margin: 14px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.auth-hero p { margin: 0; color: #c5e4dd; line-height: 1.5; }
.auth-feats { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 10px; }
.auth-feats li {
  display: flex; gap: 10px; align-items: center; color: #e7f7f3; font-weight: 650; font-size: 14px;
}
.auth-feats li::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7eb8ae; flex-shrink: 0;
}
.auth-card, .install-card {
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-panel { padding: 36px 32px; }
.install-card { width: min(680px, 100%); }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.brand h1, .brand.compact strong { margin: 0; letter-spacing: -.03em; }
.brand p, .page-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.page-sub:empty { display: none; }
.auth-note { margin: 16px 0 0; }
.stack { display: grid; gap: 12px; }
.stack label, .form-grid label, form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.hint { font-weight: 500; color: var(--muted); font-size: 12px; }

.btn {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 750; background: #eef1f0; color: var(--ink);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.btn:hover { filter: brightness(.97); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-accent { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(31, 111, 100, .22); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: inherit; }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-sm { padding: 8px 11px; min-height: 36px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; transform: none; box-shadow: none; }
.form-error, .alert-danger { color: #7f1d1d; background: #fee2e2; padding: 10px 12px; border-radius: 12px; }
.alert { margin-bottom: 12px; }
.check-list { padding-left: 18px; }
.check-list .ok { color: #166534; }
.check-list .bad { color: #991b1b; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check, label.check, .form-grid label.check, .stack label.check, form label.check {
  display: flex !important; flex-direction: row; gap: 10px; align-items: center;
  font-weight: 650; line-height: 1.35;
}
.check input, label.check input {
  width: 18px; height: 18px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: var(--primary);
}
.muted { color: var(--muted); font-size: 13px; }
.section-title { margin: 18px 0 10px; font-size: 15px; letter-spacing: -.02em; }
details.more { background: #eef3f1; border-radius: 14px; padding: 10px 12px; }
details.more summary { cursor: pointer; font-weight: 700; }

/* ——— App shell ——— */
.app-shell {
  display: grid; grid-template-columns: 272px 1fr;
  height: 100%; height: 100dvh; overflow: hidden;
}
.sidebar {
  position: relative; min-height: 0; overflow: hidden;
  background: var(--sidebar);
  color: #e9f4f1; padding: 18px 14px; display: flex; flex-direction: column; gap: 10px;
}
.sidebar .brand.compact { margin: 2px 6px 10px; color: #fff; position: relative; }
.sidebar .brand.compact small { display: block; color: #b7d4cc; font-size: 12px; font-weight: 500; }
.nav-group {
  margin: 12px 0 4px; padding: 0 12px; font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: #8fb8af; position: relative;
}
.sidebar nav { display: grid; gap: 3px; flex: 1; min-height: 0; overflow: auto; position: relative; }
.sidebar a {
  color: inherit; text-decoration: none; padding: 9px 12px; border-radius: 12px;
  display: flex; gap: 10px; align-items: center; font-weight: 650; font-size: 14px;
  transition: background .15s;
}
.sidebar a .nav-ico { width: 20px; height: 20px; opacity: .85; flex-shrink: 0; }
.sidebar a .nav-ico svg { display: block; width: 20px; height: 20px; }
.sidebar a:hover { background: rgba(255,255,255,.06); }
.sidebar a.active {
  background: var(--sidebar-2);
}
.sidebar-foot { display: grid; gap: 8px; position: relative; flex-shrink: 0; }
.branch-switch { font-size: 12px; color: #b7d8d2; }
.branch-switch select { margin-top: 6px; background: #16463e; color: #fff; border-color: #2d5c53; }
.logout { color: #c9d9d5 !important; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; flex-shrink: 0;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
  z-index: 8;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.topbar-user { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); background: #eef1f0; padding: 6px 10px; border-radius: 999px; }
.user-chip { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--ink); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 800;
}
.icon-btn { display: none; border: 0; background: #eef1f0; border-radius: 12px; width: 44px; height: 44px; }
.modal-x {
  display: inline-grid !important; place-items: center; width: 40px; height: 40px; border: 0;
  background: #eef1f0; border-radius: 12px; font-size: 18px; color: var(--ink);
}
.view { padding: 20px 22px calc(20px + var(--safe-b)); flex: 1; min-height: 0; overflow: auto; }
.view.is-pos { overflow: hidden; display: flex; flex-direction: column; padding: 12px 16px calc(12px + var(--safe-b)); }
.pill { background: #dcfce7; color: #166534; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; }
.pill.warn { background: #ffedd5; color: #9a3412; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.neutral { background: #eef1f0; color: #5c6664; }

.banner {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px;
  background: #fff4e5; color: #9a3412; font-weight: 700; margin-bottom: 10px;
}
.banner.ok { background: #e8f8ee; color: #166534; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat {
  position: relative; overflow: hidden; padding-top: 18px;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: var(--primary);
}
.stat.tone-ok::before { background: var(--ok); }
.stat.tone-warn::before { background: var(--warn); }
.stat.tone-muted::before { background: #9aa8a4; }
.card h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.card .n { font-size: 28px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.dash-hello { margin: 0 0 16px; }
.dash-hello h3 { font-size: 22px; letter-spacing: -.03em; text-transform: none; color: var(--ink); font-weight: 800; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.toolbar.filters {
  align-items: end; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; gap: 14px 16px; margin-bottom: 16px;
}
.toolbar.filters label { margin: 0; min-width: 148px; flex: 1 1 160px; gap: 8px; }
.toolbar.filters .btn { flex: 0 0 auto; }
.empty-page { padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 20px; }
.card .empty-page { padding: 28px 8px; margin: 8px 0 12px; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.toolbar .grow { flex: 1; min-width: 160px; }
.search-field { position: relative; flex: 1; min-width: 180px; }
.search-field input { padding-left: 42px; }
.search-field .search-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .45; pointer-events: none;
}
.table-wrap { overflow: auto; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
table.data th { background: #f3f6f5; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
table.data tr:hover td { background: #f7faf9; }
table.data tr:last-child td { border-bottom: 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--ink); font-size: 16px; }
.empty-art { width: 72px; height: 72px; border-radius: 24px; background: #eef3f1; display: grid; place-items: center; font-size: 32px; margin-bottom: 6px; }
.stock-ok { color: var(--ok); font-weight: 800; }
.stock-low { color: var(--danger); font-weight: 800; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.prod-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  display: grid; gap: 10px; transition: transform .15s, box-shadow .15s;
}
.prod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.prod-card-photo {
  width: 100%; height: 180px; object-fit: contain; object-position: center;
  border-radius: 14px; background: #f3f6f5; display: block;
}
.prod-card-photo.is-placeholder { object-fit: contain; padding: 28px; opacity: .45; }
.prod-card header { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.img-pick {
  display: grid; grid-template-columns: 168px 1fr; gap: 14px; align-items: center;
  background: #eef3f1; border-radius: 16px; padding: 12px;
}
.img-pick-photo, .img-pick .prod-photo {
  width: 168px; height: 168px; border-radius: 14px; object-fit: contain; object-position: center; background: #fff;
}
.img-pick-photo.is-placeholder, .img-pick .prod-photo.is-placeholder { object-fit: contain; padding: 18px; opacity: .5; }
.img-pick input[type=file] { font-size: 13px; font-weight: 600; padding: 0; min-height: 0; border: 0; background: transparent; }
.img-pick .check { display: flex; margin-top: 8px; }
.prod-card b { font-size: 16px; letter-spacing: -.02em; }
.prod-price { font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.prod-meta { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; align-items: center; }
.prod-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: #eef3f1; padding: 2px 7px; border-radius: 6px; }
.stock-bar { height: 6px; background: #e8eeec; border-radius: 99px; overflow: hidden; }
.stock-bar > span { display: block; height: 100%; background: var(--ok); }
.stock-bar.low > span { background: var(--danger); }

.toasts { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); display: grid; gap: 8px; z-index: 60; }
.toast {
  background: #171410; color: #fff; padding: 12px 14px; border-radius: 14px;
  min-width: 220px; max-width: min(92vw, 360px); box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease;
}
.toast.err { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-back {
  position: fixed; inset: 0; background: rgba(11, 44, 39, .58); display: grid; place-items: end center;
  z-index: 50; padding: 0; animation: fade .18s ease;
}
.modal {
  background: var(--surface); width: min(760px, 100%); max-height: 92dvh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 0; box-shadow: var(--shadow-lg);
  animation: sheet .22s ease;
}
.modal::before {
  content: ""; display: block; width: 40px; height: 4px; background: #d5ddd9; border-radius: 99px; margin: 10px auto 0;
}
.modal-lg { width: min(920px, 100%); }
.modal-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: start;
  padding: 12px 18px 10px; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.modal-body { padding: 4px 18px 22px; }
.modal-body .btn.full, .modal .btn-primary.full { width: 100%; }
.nav-overlay { position: fixed; inset: 0; background: rgba(11,44,39,.45); z-index: 20; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet { from { transform: translateY(24px); } to { transform: none; } }

.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 90px; gap: 8px; align-items: center; font-size: 13px; margin: 10px 0; }
.bar { height: 10px; background: #e8eeec; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }

/* ——— POS ——— */
.pos {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px;
  flex: 1; min-height: 0; height: 100%; align-items: stretch;
}
.pos-left, .pos-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow: hidden; }
.search-row { display: flex; gap: 8px; flex-shrink: 0; }
.search-row .search-field { flex: 1; }
.search-row input { font-size: 16px; padding: 12px 14px; min-height: 46px; border-radius: 14px; }
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, 148px);
  justify-content: start;
  align-content: start;
  align-items: start;
  gap: 10px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 2px;
}
.products .empty { grid-column: 1 / -1; width: 100%; }
.prod {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 0 8px;
  text-align: left; width: 148px; height: auto; align-self: start;
  display: grid; align-content: start; gap: 0;
  overflow: hidden; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.prod:hover { transform: translateY(-2px); border-color: #c9ddd8; box-shadow: var(--shadow); }
.prod .prod-photo {
  width: 100%; height: 128px; object-fit: contain; object-position: center; background: #f3f6f5; display: block;
}
.prod .prod-photo.is-placeholder { object-fit: contain; padding: 22px; opacity: .4; }
.prod .prod-info { display: grid; gap: 2px; padding: 8px 10px 0; }
.prod b {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 13px; letter-spacing: -.02em; line-height: 1.25; min-height: 2.5em;
}
.prod .price { font-size: 15px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.prod small { color: var(--muted); display: block; }
.tickets { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.ticket-tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; min-height: 34px; font-weight: 700; }
.ticket-tab.on { background: var(--ink); color: #fff; border-color: transparent; }
.ticket-tab.add { background: #eef1f0; }
.cust-chip {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.pos-customer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left; flex-shrink: 0;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 10px 12px; min-height: 44px; font-weight: 700;
}
.pos-customer span { color: var(--muted); font-weight: 650; font-size: 13px; }
.pos-customer strong { font-size: 14px; }
.pos-hints { flex-shrink: 0; margin: 0; }
.lines {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  overflow: auto; flex: 1; min-height: 0;
}
.lines .empty { padding: 18px 12px; }
.line { display: grid; grid-template-columns: 1fr auto auto 32px; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.qty-step { display: flex; align-items: center; background: #eef3f1; border-radius: 12px; overflow: hidden; }
.qty-step button { width: 32px; height: 36px; border: 0; background: transparent; font-size: 18px; font-weight: 800; }
.qty-step input { width: 58px; border: 0; background: transparent; text-align: center; padding: 6px 0; min-height: 36px; }
.totals {
  background: var(--sidebar);
  color: #fff; border-radius: 16px; padding: 10px 12px; display: grid; gap: 6px; flex-shrink: 0;
}
.totals .row { display: flex; justify-content: space-between; align-items: center; color: #c5e4dd; font-size: 13px; }
.totals .big { font-size: 26px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.totals input { width: 72px; color: #111; padding: 4px 8px; min-height: 32px; }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; flex-shrink: 0; }
.pay-grid { display: grid; gap: 10px; }
.pay-hero {
  background: var(--sidebar); color: #fff; border-radius: 18px; padding: 16px; margin-bottom: 8px; text-align: center;
}
.pay-hero small { color: #b7d4cc; display: block; margin-bottom: 4px; }
.pay-total { font-size: 34px; font-weight: 800; letter-spacing: -.04em; margin: 0; }
.kbd { font-size: 11px; background: #eef1f0; border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.cust-list { display: grid; gap: 6px; margin: 10px 0; max-height: 220px; overflow: auto; }
.cust-list .btn { justify-content: flex-start; text-align: left; }
.bulk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bulk-chips .btn { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.sede-box { background: #eef3f1; border-radius: 16px; padding: 14px; display: grid; gap: 8px; margin-bottom: 8px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.chip { background: #eef3f1; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.report-btn {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; font-weight: 750; min-height: 56px;
}
.report-btn.on { border-color: var(--primary); background: #e8f4f1; color: var(--primary); }

.dock { display: none; }
.cash-hero .n { font-size: 32px; }

@media (min-width: 860px) {
  .modal-back { place-items: center; padding: 24px; }
  .modal { border-radius: 24px; animation: pop .2s ease; }
  .modal::before { display: none; }
  @keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .pos-right { min-height: 0; max-height: 46%; }
  .lines { min-height: 64px; max-height: 140px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; padding: 28px 24px; }
  .pos-hints { display: none; }
}

@media (max-width: 860px) {
  .app-shell { display: flex; flex-direction: column; grid-template-columns: none; }
  .main { flex: 1; min-height: 0; height: auto; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-105%);
    z-index: 30; transition: transform .22s ease; padding-bottom: calc(16px + var(--safe-b));
    height: 100%; height: 100dvh;
  }
  .sidebar.open { transform: none; }
  .icon-btn { display: inline-grid; place-items: center; }
  .charts, .form-grid { grid-template-columns: 1fr; }
  .toolbar.filters { flex-direction: column; align-items: stretch; gap: 14px; }
  .toolbar.filters label, .toolbar.filters .grow { width: 100%; min-width: 0; flex: 1 1 auto; }
  .toolbar.filters .btn { width: 100%; }
  .img-pick { grid-template-columns: 1fr; }
  .img-pick-photo, .img-pick .prod-photo { width: 100%; height: 220px; }
  .prod-card-photo { height: 200px; }
  .topbar { padding: 10px 12px; }
  .topbar h2 { font-size: 18px; }
  .clock { font-size: 11px; padding: 5px 8px; }
  .user-chip span:last-child { display: none; }
  .view { padding: 14px 12px calc(14px + var(--safe-b)); }
  .view.is-pos { padding: 8px 10px calc(10px + var(--safe-b)); }
  table.data { min-width: 0; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { padding: 10px 12px; border-bottom: 8px solid var(--bg); }
  table.data td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 0; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; }
  .line { grid-template-columns: 1fr auto 36px; }
  .line .line-total { grid-column: 2; }
  .totals { padding: 8px 10px; }
  .totals .big { font-size: 22px; }
  .pos-actions { grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
  .pos-actions .btn { padding: 10px 8px; font-size: 13px; min-height: 42px; }
  .dock {
    display: none;
  }
}

.delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.chart-svg { width: 100%; height: 180px; display: block; color: var(--primary); }
.hour-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 8px; }
.hour-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.hour-col span { width: 100%; max-width: 22px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.hour-col small { font-size: 10px; color: var(--muted); }

@media print {
  .sidebar, .topbar, .toolbar, .no-print, .nav-overlay, .dock { display: none !important; }
  .app-shell { display: block; }
  .view { padding: 0; }
}
