:root {
  --navy: #10233f;
  --navy-2: #173154;
  --sidebar: #0e2240;
  --orange: #f58220;
  --orange-2: #e06d0c;
  --blue: #2463eb;
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #122033;
  --muted: #6b7c93;
  --line: #e6edf5;
  --success: #168653;
  --warning: #d97706;
  --danger: #dc3545;
  --shadow: 0 8px 24px rgba(16, 35, 63, 0.06);
  --radius: 16px;
  font-family: Poppins, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 16px; }
.brand img { width: 38px; height: 38px; }
.brand strong { display: block; font-size: 18px; letter-spacing: -0.03em; line-height: 1.1; }
.brand span { color: var(--orange); }
.brand small { color: #9eb0c7; font-size: 10px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d5deea;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
}
.nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-link.active, .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active svg { color: var(--orange); }
.sidebar .spacer { flex: 1; }
.sidebar .btn.ghost { background: transparent; color: #d5deea; border-color: rgba(255,255,255,.16); }
.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top-search { flex: 1; max-width: 460px; position: relative; }
.top-search input {
  width: 100%;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid transparent;
  padding: 11px 14px 11px 40px;
}
.top-search svg { position: absolute; left: 14px; top: 12px; width: 16px; height: 16px; color: var(--muted); }
.top-meta { display: flex; align-items: center; gap: 14px; }
.branch-switch select {
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-weight: 600;
  color: var(--navy);
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip strong { display: block; font-size: 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 999px;
  background: linear-gradient(180deg, #ffb15a, var(--orange));
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.content { padding: 22px 28px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1, .content > h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.grid-4, .grid-3, .grid-2 { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 1.3fr .9fr .8fr; }
.grid-2 { grid-template-columns: 1.35fr .85fr; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; }
.kpi .muted { font-size: 13px; }
.metric { font-size: clamp(18px, 1.5vw, 28px); font-weight: 700; letter-spacing: -0.04em; margin-top: 6px; overflow-wrap: anywhere; }
.metric small, .muted { color: var(--muted); font-size: 12px; font-weight: 500; }
.delta { display: inline-flex; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--success); }
.delta.down { color: var(--danger); }
.tag { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: #eef3f8; color: var(--navy); }
.tag.ok { background: #e7f6ee; color: var(--success); }
.tag.warn { background: #fff4e5; color: var(--warning); }
.tag.bad { background: #fdecee; color: var(--danger); }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.orange { background: var(--orange); color: #fff; }
.btn.orange:hover { background: var(--orange-2); }
.btn.blue, .btn.navy { background: var(--blue); color: #fff; }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--navy); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.full { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span, .field-label { font-size: 13px; font-weight: 600; color: #31445f; }
input, select, textarea { border: 1px solid #dbe3ee; border-radius: 12px; padding: 11px 12px; background: #fff; color: var(--ink); width: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; background: #fff; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #31445f; }
.checkline input { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 8px; background: #f8fafc; }
td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.notice, .banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(16, 35, 63, .08);
}
.notice strong, .banner strong {
  display: block;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--navy);
}
.notice p, .banner p { margin: 3px 0 0; font-size: 14px; color: #31445f; line-height: 1.4; }
.notice-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8eef8;
  color: var(--navy);
}
.notice-mark svg { width: 22px; height: 22px; }
.notice-success { border-left-color: var(--success); }
.notice-success .notice-mark { background: #e7f6ee; color: #0f5a38; }
.notice-error, .banner.error { border-left-color: var(--danger); }
.notice-error .notice-mark { background: #fdecee; color: #9d1c32; }
.notice-warning { border-left-color: var(--warning); }
.notice-warning .notice-mark { background: #fff7ed; color: #9a5410; }
.notice-info { border-left-color: var(--blue); }
.banner { border-left-color: var(--success); }
.banner::before, .banner.error::before {
  content: "";
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #e7f6ee center / 20px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f5a38' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M8 12.2 10.8 15 16 9.5'/%3E%3C/svg%3E");
}
.banner.error { background: #fff; color: var(--ink); }
.banner.error::before {
  background-color: #fdecee;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239d1c32' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E");
}
.notice-toast {
  position: fixed;
  top: 68px;
  left: 50%;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.notice-toast .notice { pointer-events: auto; margin: 0; animation: notice-in .28s ease; position: relative; padding-right: 36px; }
.notice-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}
@keyframes notice-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
#ask-overlay { z-index: 70; }
.ask-sheet { width: min(440px, 100%); padding: 22px 22px 18px; }
.ask-sheet .notice-mark { width: 46px; height: 46px; margin-bottom: 12px; }
.ask-sheet .notice-mark svg { width: 26px; height: 26px; }
.ask-sheet h2 { margin: 4px 0 6px; letter-spacing: -0.03em; }
.ask-sheet .muted { margin: 0 0 14px; }
.ask-info .notice-mark { background: #e8eef8; color: var(--navy); }
.ask-warning .notice-mark { background: #fff7ed; color: #9a5410; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ask-actions .btn { min-width: 112px; border-radius: 999px; }
.qty-field { position: relative; }
.qty-field input { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; padding: 14px 72px 14px 14px; color: var(--navy); }
.qty-field em { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 700; color: var(--muted); }
.chart-card { min-height: 280px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pills { display: flex; gap: 6px; }
.pills span { background: #f4f7fb; border-radius: 999px; padding: 4px 8px; font-size: 11px; color: var(--muted); font-weight: 600; }
.line-chart { width: 100%; height: 210px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend i { width: 9px; height: 9px; border-radius: 99px; display: inline-block; margin-right: 6px; }
.legend div { display: flex; justify-content: space-between; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin: 10px 0; font-size: 13px; }
.bar-track { height: 8px; background: #eef3f8; border-radius: 99px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bars { display: flex; align-items: end; gap: 10px; height: 160px; }
.bars div { flex: 1; background: linear-gradient(180deg, #60a5fa, var(--blue)); border-radius: 8px 8px 3px 3px; min-height: 6px; position: relative; }
.bars span { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }

.login-body {
  min-height: 100vh;
  background: #10233f center 42% / cover no-repeat fixed;
  position: relative;
  overflow: auto;
}
.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 16, 32, .55) 0%, rgba(8, 16, 32, .18) 42%, rgba(8, 16, 32, .08) 100%),
    linear-gradient(180deg, rgba(8, 16, 32, .18), transparent 28%, rgba(8, 16, 32, .28));
}
.login-frame {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(280px, 1fr);
  align-items: center;
  gap: 64px;
  padding: max(48px, env(safe-area-inset-top)) max(7vw, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(7vw, env(safe-area-inset-left));
}
.welcome-card {
  width: 100%;
  background: rgba(255, 255, 255, .97);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-top: 4px solid var(--orange);
  padding: 32px 32px 24px;
  box-shadow: 0 28px 70px rgba(8, 16, 32, .32);
}
.welcome-card .brand { padding: 0 0 18px; color: var(--navy); }
.welcome-card .brand small { color: #6b7c93; letter-spacing: .01em; }
.welcome-card h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -0.04em; color: var(--navy); }
.welcome-card .lead { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.welcome-card .field span { letter-spacing: .01em; }
.welcome-card input { height: 48px; border-radius: 10px; background: #f7f9fc; font-size: 16px; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 16px; padding: 4px; background: #eef3f8; border-radius: 14px; }
.auth-switch button { height: 48px; border: 0; border-radius: 11px; background: transparent; color: #5c6b80; font-weight: 700; letter-spacing: .04em; }
.auth-switch button.on { background: #fff; color: var(--navy); box-shadow: 0 4px 12px rgba(16, 35, 63, .08); }
.welcome-card[data-mode="email"] .pin-only,
.welcome-card[data-mode="email"] .pin-panel,
.welcome-card[data-mode="pin"] .email-only,
.welcome-card[data-mode="pin"] .email-panel { display: none; }
.staff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 280px; overflow: auto; }
.staff-tile { display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 14px; background: #f7f9fc; color: var(--navy); text-align: left; touch-action: manipulation; }
.staff-tile .avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 700; flex: 0 0 42px; }
.staff-tile:nth-child(3n+2) .avatar { background: var(--orange); }
.staff-tile:nth-child(3n) .avatar { background: var(--blue); }
.staff-tile strong { display: block; font-size: 14px; line-height: 1.2; }
.staff-tile small { color: var(--muted); font-size: 12px; }
.staff-tile:hover, .staff-tile:active { border-color: var(--orange); background: #fff; }
.pin-hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.pin-who { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; color: var(--navy); }
.pin-who button { border: 0; background: transparent; color: var(--blue); font-weight: 700; min-height: 44px; padding: 0 4px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 4px 0 16px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c5d0de; display: block; }
.pin-dots i.on { background: var(--navy); border-color: var(--navy); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; touch-action: manipulation; user-select: none; }
.pin-pad button { height: 68px; border: 1px solid #e2e8f0; border-radius: 16px; background: #f7f9fc; color: var(--navy); font-size: 28px; font-weight: 700; }
.pin-pad button:active { background: #e7eef8; border-color: #c5d4e8; }
.pin-pad .pad-text { font-size: 15px; letter-spacing: .02em; }
.welcome-card input:focus { outline: 2px solid rgba(36, 99, 235, .25); border-color: var(--blue); background: #fff; }
.welcome-card .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 18px; font-size: 13px; }
.welcome-card .row a { color: var(--blue); font-weight: 600; white-space: nowrap; }
.welcome-card .btn { height: 50px; font-size: 16px; letter-spacing: .04em; border-radius: 10px; }
.secure {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 16px 0 0;
  color: #8b9bb0;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-copy { color: #fff; justify-self: end; align-self: start; margin-top: 8vh; max-width: 460px; text-align: right; text-shadow: 0 10px 28px rgba(0,0,0,.35); }
.login-copy .eyebrow { display: block; margin-bottom: 14px; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.88); }
.login-copy em { display: block; font-size: 42px; font-style: italic; font-weight: 500; line-height: 1.05; }
.login-copy strong { display: block; margin-top: 4px; font-size: 48px; letter-spacing: -0.04em; line-height: 1; }
.demo-box { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: #8b9bb0; font-size: 12px; }
.demo-box summary { cursor: pointer; }

.pos { height: 100vh; display: grid; grid-template-columns: 228px 1fr 360px; background: var(--bg); overflow: hidden; }
.pos-cashier { grid-template-columns: minmax(420px, 1.15fr) minmax(340px, 0.85fr); grid-template-rows: minmax(52px, auto) minmax(0, 1fr); background: #e6ebf1; }
.till-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  min-height: calc(52px + env(safe-area-inset-top));
  background: var(--sidebar);
  color: #fff;
}
.till-bar .brand { padding: 0; }
.till-meta { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.till-link { color: #d5deea; font-weight: 600; }
.till-bar .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.2); }
.ticket {
  margin: 10px 6px 10px 12px;
  background: #fff;
  border: 1px solid #c9d3df;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}
.ticket-meta {
  display: grid;
  grid-template-columns: 0.6fr 1.3fr 1fr 0.5fr 1.1fr;
  gap: 8px;
  padding: 8px 12px;
  background: #f7f9fc;
  border-bottom: 1px solid #d5deea;
}
.ticket-meta span, .ticket-customer span, .item-info span { display: block; color: #7b8ba0; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.ticket-meta strong { font-size: 13px; color: var(--navy); }
.ticket-customer, .item-info { display: flex; align-items: baseline; gap: 14px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.ticket-customer strong, .item-info strong { color: var(--navy); font-size: 14px; }
.ticket-head, .ticket-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1.7fr) 0.45fr 0.9fr 0.8fr 1fr;
  gap: 6px;
  padding: 6px 12px;
  font-variant-numeric: tabular-nums;
}
.ticket-head { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #7b8ba0; border-bottom: 2px solid var(--navy); }
.ticket-head span:nth-child(n+3), .ticket-row span:nth-child(n+3) { text-align: right; }
.ticket-lines { flex: 1; overflow: auto; min-height: 80px; }
.ticket-row { font-size: 13px; border-bottom: 1px solid #eef2f6; cursor: pointer; }
.ticket-row.on { background: #e7eef8; box-shadow: inset 3px 0 0 var(--orange); }
.ticket-empty { margin: 16px 12px; color: var(--muted); }
.ticket-scan { position: relative; padding: 8px 12px; border-top: 1px solid var(--line); background: #f7f9fc; }
.ticket-scan input { width: 100%; border: 1px solid #c9d3df; border-radius: 3px; padding: 10px 12px; background: #fff; }
.ticket .scan-results {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 8px); z-index: 4;
  background: #fff; border: 1px solid #c9d3df; max-height: 220px; box-shadow: var(--shadow);
}
.ticket .scan-hit { border-radius: 0; box-shadow: none; border-left: 0; border-right: 0; }
.keypad { margin: 10px 12px 10px 6px; display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }
.dept-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dept-row button {
  border: 0; border-radius: 3px; min-height: 42px; padding: 8px 4px;
  background: var(--dept, #d5deea); color: #fff; font-weight: 700; font-size: 12px; cursor: pointer;
}
.dept-row button.on { outline: 3px solid var(--navy); outline-offset: -3px; }
.key-grid {
  flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px; align-content: start;
}
.item-key {
  min-height: 68px; border: 1px solid rgba(16, 35, 63, .08); border-radius: 3px;
  font-weight: 700; font-size: 13px; line-height: 1.25; color: #1c2838; cursor: pointer; padding: 8px;
}
.fn-pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fn-pad button, .fn-pad a {
  border: 1px solid #c9d3df; background: #f7f9fc; border-radius: 3px; min-height: 44px;
  font-weight: 700; font-size: 12px; color: var(--navy); cursor: pointer;
  display: grid; place-items: center; text-align: center;
}
.fn-pad button:disabled { color: #a0aec0; cursor: default; }
.fn-pad #clear-button { grid-column: span 2; }
.fn-pad .pay { grid-column: 1 / -1; background: var(--orange); color: #fff; border-color: var(--orange); min-height: 52px; font-size: 18px; letter-spacing: .04em; }
.scan-hint { margin: 4px 2px 0; color: var(--muted); }
.scan-results { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.scan-hit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.scan-hit:hover { border-color: #f3c48a; }
.scan-hit strong { display: block; color: var(--navy); }
.scan-hit small { color: var(--muted); font-size: 12px; }
.scan-hit em { font-style: normal; font-weight: 700; color: var(--navy); white-space: nowrap; }
.pos-cashier .pos-search input { font-size: 18px; padding: 16px 18px; }
.pos .sidebar { height: 100vh; }
.pos-main { display: flex; flex-direction: column; min-width: 0; padding: 16px 16px 12px; gap: 12px; }
.pos-search { display: flex; gap: 10px; }
.pos-search input { flex: 1; border-radius: 14px; padding: 13px 16px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.cats { display: flex; gap: 8px; overflow: auto; }
.cats button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; color: #31445f; font-weight: 600; }
.cats button.on { background: var(--orange); color: white; border-color: var(--orange); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; overflow: auto; padding-bottom: 8px; }
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px;
  text-align: left; cursor: pointer; min-height: 176px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow);
}
.tile:hover { border-color: #f3c48a; }
.pack { height: 96px; border-radius: 12px; background: #f7f4ef center/contain no-repeat; }
.pack-flour { background: linear-gradient(#f4efe4, #efe4cf); position: relative; }
.pack-flour::after, .pack-oil::after, .pack-milk::after, .pack-soda::after, .pack-bread::after, .pack-rice::after, .pack-sugar::after, .pack-soap::after, .pack-shampoo::after, .pack-paste::after, .pack-detergent::after, .pack-tomato::after, .pack-banana::after, .pack-box::after {
  content: ""; position: absolute; inset: 16px 28px; border-radius: 8px;
}
.pack { position: relative; overflow: hidden; }
.pack-flour::after { background: linear-gradient(#fff, #f6f1e4); border: 3px solid #e7d7b0; }
.pack-oil::after { inset: 10px 46px; background: linear-gradient(#ffe08a, #f0a202); border-radius: 8px 8px 16px 16px; }
.pack-milk::after { background: #fff; border: 3px solid #d7e4f5; border-radius: 6px; }
.pack-soda::after { inset: 8px 52px 10px; background: linear-gradient(#e11d2e, #7f1d1d); border-radius: 8px 8px 12px 12px; }
.pack-bread::after { inset: 28px 18px 18px; background: #f6d48a; border-radius: 40px 40px 12px 12px; }
.pack-rice::after { background: #fff; border: 3px solid #d9e2ec; }
.pack-sugar::after { background: #fff; border: 3px solid #f3d2d2; }
.pack-soap::after { inset: 28px 22px; background: linear-gradient(#7dd3c0, #0f766e); border-radius: 8px; }
.pack-shampoo::after { inset: 8px 50px; background: linear-gradient(#93c5fd, #1d4ed8); border-radius: 16px 16px 8px 8px; }
.pack-paste::after { inset: 22px 34px; background: linear-gradient(#fff, #dbeafe); border-radius: 20px; }
.pack-detergent::after { background: linear-gradient(#bfdbfe, #3b82f6); }
.pack-tomato::after { inset: 22px 28px; background: radial-gradient(circle at 40% 40%, #ff8a80, #dc2626); border-radius: 50%; }
.pack-banana::after { inset: 18px 20px; background: linear-gradient(#fde68a, #f59e0b); border-radius: 40px 40px 16px 40px; }
.pack-box::after { background: linear-gradient(#fff, #e8eef6); border: 3px solid #d5deea; }
.tile strong { display: block; font-size: 13px; }
.tile em { font-style: normal; color: var(--navy); font-weight: 700; font-size: 13px; }
.sale-panel { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sale-head, .sale-foot { padding: 16px 16px 8px; }
.sale-head { display: flex; justify-content: space-between; align-items: center; }
.linkish { background: none; border: 0; color: var(--blue); font-weight: 600; cursor: pointer; }
.lines { flex: 1; overflow: auto; padding: 0 16px; }
.line { display: grid; grid-template-columns: 46px 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line.plain { grid-template-columns: 1fr auto; }
.line .mini { width: 46px; height: 46px; border-radius: 10px; }
.qty { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.qty button { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.totals { background: #f8fafc; border-radius: 14px; padding: 12px; }
.totals div { display: flex; justify-content: space-between; margin: 5px 0; font-size: 14px; }
.totals .due { font-size: 22px; font-weight: 700; margin-top: 8px; }
.ticket .totals { margin: 0; border-radius: 0; background: #f8fafc; padding: 8px 12px 0; }
.ticket .totals .due { margin: 8px -12px 0; padding: 12px 14px; background: var(--navy); color: #fff; border-radius: 0; font-size: 26px; }
.quick { display: flex; gap: 8px; margin-top: 10px; }
.quick button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 6px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--navy); }
.overlay { position: fixed; inset: 0; background: rgba(16,35,63,.46); display: none; place-items: center; z-index: 30; padding: 20px; }
.overlay.show { display: grid; }
.sheet { width: min(520px, 100%); background: white; border-radius: 22px; padding: 20px; max-height: 90vh; overflow: auto; }
.sheet.pay-face { width: min(760px, 96vw); padding: 22px 22px 18px; }
.pay-due {
  background: var(--navy);
  color: #fff;
  border-radius: 18px;
  text-align: center;
  padding: 22px 16px 18px;
  margin: 0 0 16px;
}
.pay-due span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #f3c48a;
}
.pay-due strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(56px, 9vw, 92px);
  line-height: .95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.lipa-card { background: #fff; overflow: hidden; border-top: 0; }
.lipa-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(180deg, #3cbf55 0%, #2ea84a 55%, #24963f 100%);
  color: #fff;
  padding: 12px 16px 11px;
}
.lipa-head strong { font-size: 26px; font-weight: 700; letter-spacing: .01em; }
.lipa-phone { width: 28px; height: 44px; flex: 0 0 28px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.08)); }
.lipa-card > p {
  margin: 14px 12px 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #142033;
}
.lipa-digits { display: flex; justify-content: center; gap: 8px; padding: 0 14px 16px; }
.lipa-digits span {
  width: 46px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2.5px solid #2ea84a;
  border-radius: 4px;
  background: #fff;
  color: #128a32;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px rgba(46, 168, 74, .15);
}
.pay-face .lipa-card { border-radius: 16px; margin: -4px 0 16px; box-shadow: 0 10px 24px rgba(18, 90, 40, .12); }
.pay-face .lipa-head { padding: 16px 18px; }
.pay-face .lipa-head strong { font-size: 32px; }
.pay-face .lipa-phone { width: 34px; height: 52px; }
.pay-face .lipa-card > p { font-size: 18px; margin-top: 18px; }
.pay-face .lipa-digits { gap: 10px; padding-bottom: 20px; }
.pay-face .lipa-digits span { width: 58px; height: 72px; font-size: 38px; border-width: 3px; }
.receipt .lipa-card { margin: 14px 22px 0; border: 1px solid #d7eadc; border-radius: 12px; }
@media print {
  .lipa-head, .lipa-digits span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.tender-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.tender-grid button, .mode-switch button, .quick-cash button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 16px 8px; font-weight: 700; cursor: pointer; color: var(--navy); }
.tender-grid button:hover, .mode-switch button.on, .quick-cash button:hover { border-color: var(--orange); background: #fff7ef; }
.mode-switch, .quick-cash { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-switch button, .quick-cash button { flex: 1; padding: 10px 8px; }
.change-box { display: flex; justify-content: space-between; align-items: center; background: #e7f6ee; color: #0f5a38; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-weight: 700; }
.change-box.short { background: #fdecee; color: #9d1c32; }
.sale-done { text-align: center; }
.sale-done h2 { margin: 4px 0 0; letter-spacing: -0.03em; }
.sale-done .due { font-size: 28px; font-weight: 700; margin: 8px 0 14px; }
.sale-done .btn { margin-top: 8px; }
.fiscal { border-radius: 12px; padding: 10px; background: #fff7ed; color: #9a5410; font-size: 13px; }
.fiscal.official { background: #e7f6ee; color: #0f5a38; }
.receipt-page { background: #eef2f7; }
.receipt-toolbar { display: flex; gap: 8px; justify-content: center; padding: 20px 16px 0; }
.receipt-notices { width: min(420px, calc(100% - 32px)); margin: 16px auto 0; }
.receipt-notices .notice { margin-bottom: 0; }
.receipt-stage { display: grid; place-items: start center; padding: 24px 16px 48px; }
.receipt {
  width: min(420px, 100%);
  margin: 0;
  background: #fff;
  color: var(--ink);
  border-radius: 4px 4px 18px 18px;
  box-shadow: 0 24px 60px rgba(16, 35, 63, 0.14);
  overflow: hidden;
  padding: 0;
}
.receipt-letterhead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 16px;
  border-top: 4px solid var(--orange);
  border-bottom: 1px solid var(--line);
}
.receipt-letterhead img { width: 42px; height: 42px; }
.receipt-letterhead strong { display: block; font-size: 20px; letter-spacing: -0.03em; color: var(--navy); }
.receipt-letterhead span { color: var(--orange); }
.receipt-letterhead small { color: var(--muted); font-size: 11px; letter-spacing: 0.02em; }
.receipt-store { text-align: center; padding: 18px 22px 8px; }
.receipt-store h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; color: var(--navy); }
.receipt-store p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.receipt-kicker {
  margin: 14px 0 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
}
.receipt-number {
  margin: 4px 0 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--navy);
}
.receipt-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 16px 22px;
  padding: 12px 0;
  border-top: 1px dashed #d5deea;
  border-bottom: 1px dashed #d5deea;
}
.receipt-meta div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.receipt-meta dt { color: var(--muted); font-weight: 500; }
.receipt-meta dd { margin: 0; font-weight: 600; text-align: right; }
.receipt-lines { width: calc(100% - 44px); margin: 0 22px 8px; border-collapse: collapse; }
.receipt-lines th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--navy);
}
.receipt-lines th:nth-child(2), .receipt-lines td:nth-child(2) { text-align: center; width: 48px; }
.receipt-lines th:last-child, .receipt-lines td:last-child { text-align: right; }
.receipt-lines td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; font-variant-numeric: tabular-nums; }
.receipt-lines small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.receipt-totals, .receipt-tenders { margin: 8px 22px; font-size: 13px; font-variant-numeric: tabular-nums; }
.receipt-totals div, .receipt-tenders div { display: flex; justify-content: space-between; margin: 5px 0; }
.receipt-totals .grand {
  margin-top: 10px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 700;
}
.receipt-tenders { padding-top: 4px; }
.receipt-tenders .change { font-weight: 700; color: #0f5a38; }
.receipt .fiscal { margin: 12px 22px; }
.receipt-policy { margin: 12px 22px 0; text-align: center; color: var(--muted); font-size: 12px; }
.receipt-powered {
  margin-top: 16px;
  padding: 14px 22px 16px;
  background: #f7f9fc;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--navy);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.device-card { margin-top: 16px; }

@media print {
  .no-print { display: none !important; }
  html, body.receipt-page { width: 80mm; margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .receipt-stage { display: block; padding: 0; margin: 0; }
  .receipt {
    width: 76mm;
    max-width: 76mm;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }
  .receipt-letterhead, .receipt-store, .receipt-powered { padding-left: 2mm; padding-right: 2mm; }
  .receipt-lines { width: auto; margin: 0 2mm 2mm; }
  .receipt-totals, .receipt-tenders, .receipt-policy, .receipt .fiscal { margin-left: 2mm; margin-right: 2mm; }
  .receipt-totals .grand, .receipt-letterhead, .receipt-powered {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
@media (max-width: 1280px) {
  .grid-4, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; height: calc(72px + env(safe-area-inset-bottom)); z-index: 20;
    flex-direction: row; overflow: auto; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 4px;
  }
  .sidebar .brand, .sidebar .spacer, .sidebar form { display: none; }
  .nav-link { flex-direction: column; gap: 2px; font-size: 10px; padding: 8px; min-width: 68px; }
  .workspace { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .welcome-card { padding: 24px 18px 18px; }
  .pin-pad button { height: 60px; font-size: 26px; }
  .staff-grid { max-height: none; }
  .grid-4, .grid-3, .grid-2, .stat-grid, .donut-wrap { grid-template-columns: 1fr; }
  .login-frame { grid-template-columns: 1fr; padding: 28px 16px 40px; gap: 28px; }
  .login-copy { display: none; }
  .pos, .pos-cashier { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; overflow: visible; }
  .ticket, .keypad { margin: 8px; min-height: 420px; }
  .key-grid { min-height: 220px; }
  .till-bar { position: sticky; top: 0; z-index: 6; }
  .pos .sidebar { position: sticky; top: 0; height: auto; }
  .sale-panel { min-height: 460px; }
  .topbar { flex-wrap: wrap; }
}
