/* ---------- Fira Sans (self-hosted so it always renders, even offline) ---------- */
@font-face {
  font-family: "Fira Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/FiraSans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Fira Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/FiraSans-500.woff2") format("woff2");
}
@font-face {
  font-family: "Fira Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/FiraSans-600.woff2") format("woff2");
}
@font-face {
  font-family: "Fira Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/FiraSans-700.woff2") format("woff2");
}

/* ---------- Noto Sans Khmer ----------
   Fira Sans has no Khmer glyphs, so a Khmer name on a receipt has nothing to
   render with. Self-hosted for the same reason as the rest: a till that works
   offline has to be able to draw one. */
@font-face {
  font-family: "Noto Sans Khmer";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/NotoSansKhmer-400.ttf") format("truetype");
}

/* ---------- Design tokens (Gecko POS light theme, default) ---------- */
:root,
[data-theme="light"] {
  --font-head: "Fira Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Fira Sans", ui-sans-serif, system-ui, sans-serif;

  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --text: #0c0a09;
  --text-muted: #78716c;
  --text-faint: #a8a29e;

  --primary: #78350f;
  --primary-hover: #92400e;
  --primary-light: #fef3c7;
  --on-primary: #ffffff;
  --accent: #d97706;
  --accent-light: #fbbf24;
  --secondary: #1c1917;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --ring: #78350f;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 10px 30px rgba(28, 25, 23, 0.1);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --space: 8px;

  --ok-bg: rgba(34, 197, 94, 0.14);
  --warn-bg: rgba(217, 119, 6, 0.12);
  --danger-bg: rgba(239, 68, 68, 0.1);

  --sidebar: #1c1917;
  --sidebar-muted: #a8a29e;
  --sidebar-active-bg: rgba(217, 119, 6, 0.22);
  --sidebar-active: #fbbf24;
  color-scheme: light;
}

/* ---------- Dark theme (kept behind the theme toggle) ---------- */
[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elev: #101a2e;
  --surface: #141f36;
  --surface-2: #1b2942;
  --border: #26344f;
  --border-strong: #33456a;

  --text: #e8eefb;
  --text-muted: #93a2ba;
  --text-faint: #64748b;

  --primary: #10b981;
  --primary-hover: #0ea472;
  --primary-light: #064e3b;
  --on-primary: #052e21;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --secondary: #0b1220;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --ring: #10b981;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);

  --ok-bg: rgba(16, 185, 129, 0.14);
  --warn-bg: rgba(245, 158, 11, 0.16);
  --danger-bg: rgba(239, 68, 68, 0.16);

  --sidebar: #0b1220;
  --sidebar-muted: #93a2ba;
  --sidebar-active-bg: rgba(16, 185, 129, 0.2);
  --sidebar-active: #6ee7b7;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  font-weight: 700;
}
h2 {
  font-size: 1.5rem;
}
h3 {
  font-size: 1.05rem;
  color: var(--text);
}
a {
  color: var(--primary);
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- App shell: sidebar + main ---------- */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 16rem;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #e7e5e4;
  z-index: 30;
  transition: width 0.18s ease;
}
.app.collapsed .sidebar {
  width: 4.5rem;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.side-brand-text strong {
  font-family: var(--font-head);
  font-size: 0.95rem;
  color: #fafaf9;
}
.side-brand-text small {
  font-size: 0.7rem;
  color: var(--sidebar-muted);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  flex-shrink: 0;
}
.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.6rem;
  overflow-y: auto;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: none;
  border-left: 4px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.side-item:hover {
  color: #fafaf9;
  background: rgba(255, 255, 255, 0.06);
}
.side-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  border-left-color: var(--accent);
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.app.collapsed .side-label,
.app.collapsed .side-brand-text,
.app.collapsed .side-user-text,
.app.collapsed .side-actions {
  display: none;
}
.app.collapsed .side-item {
  justify-content: center;
  border-left-width: 0;
}
.app.collapsed .side-brand {
  justify-content: center;
  padding-inline: 0;
}
.side-foot {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.side-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.side-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.side-user-text strong {
  font-size: 0.85rem;
  color: #fafaf9;
}
.side-user-text small {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  text-transform: capitalize;
}
.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.3);
  color: var(--sidebar-active);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.avatar .dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--sidebar);
}
.avatar .dot.ok {
  background: var(--success);
}
.avatar .dot.warn {
  background: var(--warning);
}
.pending-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sidebar-active);
  background: rgba(217, 119, 6, 0.18);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}
.side-actions {
  display: flex;
  gap: 0.4rem;
}
.side-actions .icon-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-muted);
}
.side-actions .icon-btn:hover {
  color: #fafaf9;
  border-color: rgba(255, 255, 255, 0.25);
}
.side-foot .btn-ghost {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-muted);
}
.side-foot .btn-ghost:hover {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
}
.side-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.side-signout svg {
  width: 16px;
  height: 16px;
}
.app.collapsed .side-foot {
  align-items: center;
}
.app.collapsed .side-user {
  justify-content: center;
}
.app.collapsed .side-signout {
  padding: 0.5rem;
}
/* Floating collapse/expand toggle, always visible (Gecko-style). */
.side-toggle {
  position: fixed;
  top: 1.5rem;
  left: 16rem;
  transform: translateX(-50%);
  z-index: 40;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--sidebar);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: left 0.18s ease, background 0.15s ease;
}
.side-toggle:hover {
  background: var(--primary-hover);
}
.side-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}
.app.collapsed .side-toggle {
  left: 4.5rem;
}
.app.collapsed .side-toggle svg {
  transform: rotate(180deg);
}
.main {
  flex: 1;
  min-width: 0;
  margin-left: 16rem;
  transition: margin-left 0.18s ease;
}
.app.collapsed .main {
  margin-left: 4.5rem;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Buttons ---------- */
button {
  font-family: var(--font-body);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}
.btn:hover {
  border-color: var(--primary);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:disabled:hover {
  border-color: var(--border-strong);
}
.btn-primary:disabled:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---------- Inputs ---------- */
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder {
  color: var(--text-faint);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}
label {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------- Layout ---------- */
.screen {
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.muted {
  color: var(--text-muted);
}
.money {
  display: inline-block;
  line-height: 1.15;
}
.money-khr {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--accent);
}
/* The riel of a one-line total: `$10.25 (42000 ៛)`. `MoneyTotal` and the customer
   display both put their riel in this class so it alone takes the accent — the
   amount keeps the total's own colour. A colour hook only: the figure keeps the
   size and spacing of the total it sits in, so no other rule has to be undone. */
.total-khr {
  color: var(--accent);
}
/* A total keeps its riel beside the amount rather than beneath it. `MoneyTotal`
   builds the one-line `$10.25 (41000 ៛)` as two pieces, so the block `.money-khr`
   above is not involved and the pair must not break across lines. */
.money-total {
  white-space: nowrap;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.75rem;
}
/* The shop's name, and how to get into it. */
.login-shop {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 700;
}
.login-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}
/* The prompt names the dots below it, so it is centred with them and set like
   a label rather than left out at the card's edge like the setup sentences. */
.pin-label {
  margin: 0 0 0.7rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  /* One dot per digit typed and nothing ahead of it, so the row must hold its
     height while it is still empty. */
  min-height: 0.7rem;
}
.pin-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
}
.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.key {
  padding: 0.85rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
}
.key:hover {
  background: var(--surface-2);
}
.key:active {
  transform: translateY(1px);
}
.key.ghost {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.link-btn {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--text);
}
.login-card .brand {
  margin-bottom: 1.25rem;
}
.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.field input {
  width: 100%;
}

/* ---------- Register ---------- */
.shiftbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 1.25rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.register {
  display: grid;
  grid-template-columns: 1fr 22rem;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}
.toolbar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.chip {
  font: inherit;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}
.product {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 6rem;
  text-align: left;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.product:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.product .name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.98rem;
}
.product .price {
  color: var(--primary);
  font-weight: 700;
  margin-top: 0.5rem;
}
.tile {
  position: relative;
}
.tile .product {
  width: 100%;
}
.tile-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.tile:hover .tile-del {
  opacity: 1;
}
.tile-del:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ---------- Cart panel ---------- */
.cartpanel {
  position: sticky;
  top: 4.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.cartlines {
  list-style: none;
  margin: 0;
  padding: 0.4rem 1rem;
  flex: 1;
  overflow-y: auto;
}
.cartlines li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.cartlines .item {
  flex: 1;
  font-weight: 500;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.stepper button {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.stepper-qty {
  min-width: 1.9rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
}
.cartlines .amount {
  min-width: 4.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0.15rem 0;
}
.total-row > span:last-child {
  text-align: right;
}
.charge {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.charge:hover {
  background: var(--primary-hover);
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.85em;
  color: var(--text-muted);
}

/* ---------- Cards / stats ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.card-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-stat span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.card-stat strong {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.detail {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.85rem 0;
}

/* ---------- Badges / feedback ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.active {
  background: var(--ok-bg);
  color: var(--primary);
}
.badge.low {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}
.badge.suspended {
  background: var(--danger-bg);
  color: var(--danger);
}
.error {
  color: var(--danger);
}
.status {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
  overflow-y: auto;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 26rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
}
/* The POS modal can be dismissed without closing the shift, so it carries a
   close affordance of its own. */
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  color: var(--danger);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}
.modal h3 {
  padding-right: 1.9rem;
}
.opt-group {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.modal-actions > .btn {
  flex: 1;
}
/* The POS modal runs long, so its actions are ruled off from the report. */
.modal-shift .modal-actions {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

/* ---------- Customer display ---------- */
.display {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
  padding: 3rem 1rem;
}
.display h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--primary);
}
.display ul {
  list-style: none;
  padding: 0;
  font-size: 1.4rem;
}
.display h2 {
  font-size: 2rem;
}
.display-name {
  font-weight: 600;
}
.display-line {
  margin-left: 0.4rem;
}
.display-khr {
  margin-left: 0.45rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85em;
}
.display-kh {
  display: block;
  font-size: 0.8em;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .register {
    grid-template-columns: 1fr;
  }
  .cartpanel {
    position: static;
  }
}
@media (max-width: 600px) {
  .screen,
  .register {
    padding: 0.85rem;
  }
  .nav {
    order: 3;
    width: 100%;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Dashboard ---------- */
.page-title {
  font-size: 1.4rem;
  margin: 0;
}
.page-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.dash {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shift-banner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Two tight lines — the chip, then the time — rather than one wide row. */
  gap: 0.3rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  /* A state bar on the edge: open reads green, a closed day reads amber, and
     the status is legible before a single figure is. */
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.shift-banner.open {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--ok-bg) 45%, var(--surface));
}
.shift-banner.closed {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface));
}
.shift-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.shift-pill.open {
  background: var(--ok-bg);
  color: var(--success);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 35%, transparent);
}
.shift-pill.closed {
  background: var(--warn-bg);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.shift-when {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
/* A section of the report, so the Dashboard can lay them out side by side
   instead of stacking every line. In the till's modal they simply stack. */
.report-block {
  display: flex;
  flex-direction: column;
}
.shift-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
/* The open shift's report, inside the shift panel: the same body the till's
   shift modal shows, so the Dashboard and the POS tell one story about the day.
   Denser than the modal — the sections sit in a grid and the rows drop the
   modal's two-line rhythm. */
.shift-report-grid {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.5rem 2rem;
  margin-top: 0.55rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.shift-report-grid .report-section {
  margin-top: 0;
}
.shift-report-grid .report-line {
  min-height: 0;
  padding: 0.1rem 0;
  font-size: 0.84rem;
  gap: 0.75rem;
}
.shift-report-grid .report-head {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
}
.shift-report-grid .audit-banner {
  grid-column: 1 / -1;
}

.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}
.cmp-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.cmp-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
.cmp-value {
  font-family: var(--font-head);
  font-size: 1.7rem;
  margin: 0.35rem 0 0.25rem;
  font-variant-numeric: tabular-nums;
}
.cmp-change {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
}
.cmp-arrow.up,
.cmp-pct.up {
  color: var(--success);
}
.cmp-arrow.down,
.cmp-pct.down {
  color: var(--danger);
}
.cmp-arrow.flat,
.cmp-pct.flat {
  color: var(--text-muted);
}
.cmp-pct {
  font-weight: 700;
}
.cmp-suffix {
  color: var(--text-muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-value {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
}
/* A grid row stretches every panel to the tallest one, so the chart has to be
   able to fill the extra height rather than sitting at a fixed size. */
.chart-grid > .panel {
  display: flex;
  flex-direction: column;
}
.panel {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel h3 {
  margin-bottom: 0.9rem;
}

/* ---------- Settings ---------- */
/* Two columns on a register, one on anything narrower — fixed, not `auto-fit`.
   With auto-fit a card's width came from how many happened to fit, and the tall
   cards here (the layout editor, the logo) shared a row with short ones and
   stretched each neighbour to their own height: `Receipt` and `Logo` rendered
   1531px of empty card beside the layout editor. Cards still stretch to their
   row, but their contents sit at the top and their actions at the foot, so a
   taller neighbour is not a hole.

   The breakpoint comes from what a card actually gets: the viewport minus the
   sidebar's 16rem and the screen's padding, which is what two 20rem cards plus
   their gap need. One column below that. (A collapsed sidebar would fit two
   sooner, which a media query cannot see — it errs the safe way.) */
/* The screen's own tabs sit above the grid, which is where its spacing comes
   from, so the strip itself adds none. */
.set-group-tabs {
  margin-bottom: 0;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 60rem) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
.set-sub {
  font-size: 0.9rem;
}
.set-card {
  display: flex;
  flex-direction: column;
}
.set-card.wide {
  grid-column: 1 / -1;
}
.set-card h3 {
  margin-bottom: 0.25rem;
}
.set-card > .muted {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
/* A card's actions live at its foot, so buttons line up across a row whatever
   the cards above them hold. */
.set-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 1rem;
}
/* One reserved line per card: a save confirmation or a refusal must not resize
   the card and shift everything under it. */
.set-status {
  min-height: 1.25rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.set-about {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}
/* The layout editor's fold: its title and the way in, on one line. */
.set-fold-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.set-fold-toggle {
  flex: none;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.set-fold-toggle:hover {
  text-decoration: underline;
}
.set-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.set-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.set-input {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}
.set-input:focus-within {
  border-color: var(--primary);
}
.set-input input {
  width: 100%;
  padding: 0.55rem 0;
  border: none;
  background: transparent;
}
.set-input input:focus {
  outline: none;
}
.set-suffix {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-faint);
}
.set-current {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.set-current strong {
  color: var(--text);
}
.set-status .set-ok {
  color: var(--primary);
}
.total-row.discount {
  color: var(--danger);
}
.set-status .set-err {
  color: var(--danger);
}

/* The receipt-layout card: the two lists, their rows, and the preview. */
.set-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
}
.set-tab {
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.set-tab.active {
  border-color: var(--primary);
  color: var(--primary);
}
.layout-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.layout-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.layout-row.layout-off .layout-name,
.layout-row.layout-off .layout-label {
  opacity: 0.5;
}
.layout-name {
  flex: none;
  width: 8.5rem;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layout-label {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
}
.layout-label:focus {
  outline: none;
  border-color: var(--primary);
}
.layout-move {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.layout-move:disabled {
  opacity: 0.35;
  cursor: default;
}
.layout-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.layout-preview {
  margin-top: 0.9rem;
  text-align: center;
}
.layout-preview .logo-preview {
  max-height: 420px;
}

/* The logo card: what the shop has, and the picker that replaces it. */
.set-logo {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.logo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.logo-preview {
  /* On white, because that is the paper it is going onto, and a transparent
     PNG over a dark panel reads as the wrong logo entirely. */
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
  padding: 0.5rem;
  align-self: flex-start;
}
.logo-raster {
  /* One dot per pixel, blown up: the point of showing it is to see the dots
     the printer gets, not a smoothed impression of them. */
  image-rendering: pixelated;
  max-height: 80px;
}
.file-hidden {
  display: none;
}

.chart-cols {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  /* Grows to fill the panel when a row-mate is taller; 210px is the floor. */
  flex: 1 1 auto;
  min-height: 210px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
  min-width: 0;
}
.chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 72%;
  max-width: 34px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  min-height: 2px;
  transition: height 0.2s ease;
}
.chart-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.donut {
  width: 170px;
  height: 170px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}
.donut circle {
  transition: stroke-dasharray 0.2s ease;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 10rem;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-label {
  flex: 1;
}
.legend-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend-pct {
  color: var(--text-muted);
  width: 2.6rem;
  text-align: right;
}

.calendar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.cal-title {
  font-family: var(--font-head);
  font-weight: 700;
  min-width: 11rem;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cal-cell {
  min-height: 3rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.cal-cell.empty {
  border: none;
  background: transparent;
}
.cal-day {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.cal-rev {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.top-list {
  display: flex;
  flex-direction: column;
}
.top-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.top-row:last-child {
  border-bottom: none;
}
.top-name {
  flex: 1;
  font-weight: 600;
}
.top-qty {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.top-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.prod-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.prod-filters input[type="text"],
.prod-filters input:not([type]) {
  min-width: 12rem;
}
.cell-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.sku-row {
  display: flex;
  gap: 0.4rem;
}
.sku-row input {
  flex: 1;
}
/* The product picture: uploaded, cropped square, shown as the card will show it. */
.field-picture {
  grid-column: 1 / -1;
}
.prod-picture {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.prod-picture-frame {
  width: 5rem;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--border) 60%, var(--surface-2)));
  color: var(--text-faint);
}
.prod-picture-empty svg {
  width: 1.5rem;
  height: 1.5rem;
}
.prod-picture-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prod-picture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.prod-picture-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}
/* The same square the card shows, next to the name in the list. */
.prod-thumb-cell {
  width: 1px;
  padding-right: 0;
}
.prod-thumb {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  object-fit: cover;
}
.prod-thumb.empty {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-faint);
}
.prod-thumb.empty svg {
  width: 1.1rem;
  height: 1.1rem;
}
tr.dragging {
  opacity: 0.4;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
}
.opt-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 0.6rem;
}
.opt-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.opt-head > input {
  flex: 1;
  min-width: 0;
}
.opt-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.opt-value > input:not([type="number"]) {
  flex: 1;
  min-width: 0;
}
.opt-value > input[type="number"] {
  width: 6rem;
}
.opt-value > select {
  width: 6.5rem;
}
.opt-card > .btn {
  justify-self: start;
}
.drag-handle {
  color: var(--text-faint);
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}
.drag-handle:active {
  cursor: grabbing;
}
.opt-card.dragging,
.opt-value.dragging {
  opacity: 0.45;
  outline: 2px dashed var(--primary);
}
.opt-sign {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.opt-sign button {
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}
.opt-sign button.active {
  background: var(--primary);
  color: var(--on-primary);
}
.opt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.opt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.opt-chip:hover {
  border-color: var(--primary);
}
.opt-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.opt-chip-price {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}
.opt-chip.active .opt-chip-price {
  color: rgba(255, 255, 255, 0.85);
}
.opt-tpl {
  width: 7.5rem;
  flex-shrink: 0;
}
.tpl-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
}
.tpl-hint {
  font-size: 0.75rem;
}
.tpl-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}
.tpl-add {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}
.tpl-add:hover {
  color: var(--primary);
}
.tpl-del {
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  line-height: 1;
}
.tpl-del:hover {
  color: var(--danger);
}
.sync-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.sync-toggle:hover {
  border-color: var(--primary);
}
.sync-toggle.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.opt-card.synced {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2));
}
.held-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 0.5rem;
}
.held-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.3rem;
}
.held-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.82rem;
}
.held-items li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.held-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.held-name .cart-kh {
  margin-left: 0.35rem;
}
.held-name .cart-opts {
  margin-left: 0.35rem;
}
.held-qty {
  color: var(--text-muted);
  font-weight: 600;
}
.held-line {
  min-width: 3.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.held-total {
  font-weight: 700;
  font-size: 0.85rem;
}
.held-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}
.held-actions .btn {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .sidebar {
    width: 4.5rem;
  }
  .side-label,
  .side-brand-text,
  .side-user-text,
  .side-actions {
    display: none;
  }
  .side-item {
    justify-content: center;
    border-left-width: 0;
  }
  .main {
    margin-left: 4.5rem;
  }
  .side-toggle {
    left: 4.5rem;
  }
}

/* ---------- POS ---------- */
.pos {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.pos-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.pos-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
}
.pos-toolbar-row1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pos-toolbar-row2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pos-toolbar-row2 .pos-search {
  flex: 1;
  margin: 0;
}
.pos-layout-ctl {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.pos-filter-fab {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.pos-filter-fab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.pos-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.pos-tabs {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.22rem;
  background: var(--surface-2);
  border-radius: 12px;
}
.pos-tab-icon {
  display: flex;
  align-items: center;
}
.pos-tab-icon .type-icon {
  width: 0.95rem;
  height: 0.95rem;
}
.pos-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pos-tab:hover {
  color: var(--text);
}
.pos-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.pos-tab .count {
  font-size: 0.68rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.pos-tab.active .count {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
}
.pos-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.pos-action {
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pos-action:hover {
  background: var(--surface-2);
  color: var(--text);
}
.pos-action.open {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}
.pos-body {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  padding: 1rem;
  align-items: start;
}
.pos-resize {
  width: 8px;
  align-self: stretch;
  border-radius: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s ease;
}
.pos-resize:hover {
  background: var(--border);
}
.pos-grid-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 1rem;
}
.pos-search {
  margin-bottom: 0.85rem;
}
.pos-search input {
  width: 100%;
  padding: 0.6rem 0.9rem;
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.75rem;
}
.pos-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.pos-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.pos-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--border) 60%, var(--surface-2)));
  display: grid;
  place-items: center;
  color: var(--text-faint);
}
.pos-card-img svg {
  width: 34px;
  height: 34px;
}
.pos-card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.pos-card-kh {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.pos-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pos-card-price {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.pos-cart {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.cart-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cart-head h3 {
  margin: 0;
}
.cart-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.cart-clear {
  border: none;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.cart-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cart-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.cart-field-row .field {
  margin: 0;
}
.discount-row {
  display: flex;
  gap: 0.35rem;
}
.discount-row select {
  width: 4rem;
}
.cart-foot {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}
.cart-grand {
  font-size: 1.35rem;
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}
.cart-sub {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.cart-line-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
}
.cart-remove {
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.cart-remove:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.cart-remove svg {
  width: 15px;
  height: 15px;
  display: block;
}
.cart-edit {
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.cart-edit:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.cart-edit svg {
  width: 15px;
  height: 15px;
  display: block;
}
.cart-remove:hover {
  color: var(--danger);
}
.cart-empty {
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2.5rem 1rem;
  border-bottom: none;
}
.cart-line-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cart-opts {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.cart-kh {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.cart-khr {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
}
@media (max-width: 1000px) {
  .pos {
    flex-direction: column;
    height: auto;
  }
  .pos-resize {
    display: none;
  }
  .pos-cart {
    width: auto !important;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .pos-grid-wrap {
    overflow: visible;
  }
}

.pos-subbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pos-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1;
}
.pos-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.pos-chip:hover {
  background: var(--surface-2);
  color: var(--text);
}
.pos-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pos-chip .count {
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.pos-chip.active .count {
  background: rgba(255, 255, 255, 0.25);
}
.pos-search {
  min-width: 16rem;
  margin-bottom: 0;
}
.pos-search input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  text-align: center;
}
.pos-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pos-card.dragging {
  opacity: 0.4;
  outline: 2px dashed var(--primary);
}
.layout-item {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.pos-card-khr {
  display: block;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.pos-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}
.pos-card-badge.low {
  background: var(--warn-bg);
  color: var(--accent);
}
.pos-card-badge.out {
  background: var(--danger-bg);
  color: var(--danger);
}
.pos-card-badge.floor {
  background: var(--ok-bg);
  color: var(--success);
}
.pos-card-actions {
  display: flex;
  gap: 0.3rem;
  width: 100%;
  margin-top: 0.25rem;
}
.pos-mini {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.25rem 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  cursor: pointer;
}
.pos-mini:hover {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
}
.pos-mini.bargain {
  background: var(--ok-bg);
  color: var(--success);
}
.pos-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.pos-cart-head h3 {
  margin: 0;
}
.shift-report {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.75rem;
}

/* ---------- Checkout modal ---------- */
.modal-wide {
  max-width: 34rem;
}
.modal-form {
  max-width: 52rem;
}
.modal-form .form-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* ---------- Crop picture ---------- */
.crop-modal {
  max-width: 24rem;
}
.crop-frame {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 0 auto 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: grab;
  /* The drag owns the gesture: no page scroll or pinch fighting the crop. */
  touch-action: none;
  user-select: none;
}
.crop-frame:active {
  cursor: grabbing;
}
.crop-image {
  position: absolute;
  /* Never constrained by a global image rule: the inline size is the crop. */
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
}
.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}
.crop-zoom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.crop-zoom input {
  flex: 1;
}
.checkout-items {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: 40vh;
  overflow-y: auto;
}
.checkout-items li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.checkout-items li:last-child {
  border-bottom: none;
}
.qty-badge {
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.checkout-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.checkout-item-name {
  font-weight: 600;
}
.checkout-item-total {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.total-row.big {
  font-size: 1.4rem;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}
.total-row.green {
  color: var(--success);
}
.pay-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.pay-option {
  padding: 0.55rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.pay-option:hover {
  border-color: var(--border-strong);
}
.pay-option.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
}
.pay-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.confirm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: 10px;
  background: var(--warn-bg);
  font-size: 0.85rem;
  margin: 0.5rem 0;
  cursor: pointer;
}
.confirm-row input {
  width: auto;
}
.charge:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.opt-group .req {
  margin-left: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
}
.pos-mobile-bar {
  display: none;
}
@media (max-width: 1000px) {
  .pos-mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    left: 4.5rem;
    right: 0;
    bottom: 0;
    z-index: 25;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(28, 25, 23, 0.06);
  }
  .pos-mobile-total {
    margin-left: auto;
    font-weight: 700;
  }
  .pos-mobile-bar .charge {
    width: auto;
    margin: 0;
    padding: 0.6rem 1rem;
  }
}

/* ---------- Sales ---------- */
.sales-tabs {
  display: flex;
  gap: 0.4rem;
}
/* A bordered surface holding a table: no padding, so the rows reach the edge. */
.table-panel {
  padding: 0;
  overflow: hidden;
}
.orders-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.orders-head h3 {
  margin: 0;
}
.orders-status {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}
.orders-search {
  width: 15rem;
  max-width: 100%;
  padding: 0.45rem 0.7rem;
}
.orders-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.summary-item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.summary-value {
  font-weight: 600;
}
.summary-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-strong);
}
.orders-payment {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}
.orders-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.table-wrap {
  overflow-x: auto;
}
.table-wrap table {
  border: none;
  border-radius: 0;
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}
.info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
}
.info-grid .muted {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.edit-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.edit-lines li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.edit-line-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.edit-line-total {
  min-width: 4rem;
  text-align: right;
}
.sales-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.sales-actions input,
.sales-actions select {
  padding: 0.45rem 0.7rem;
}
.pay-breakdown {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.pay-row-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.pay-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.pay-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.modal-search {
  width: 100%;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.75rem;
}
th.num,
td.num {
  text-align: right;
}
.empty-note {
  padding: 2rem 0;
  text-align: center;
}

/* ---------- Categories ---------- */
.cat-column-badge,
.type-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
  color: #fff;
  flex-shrink: 0;
}
.type-icon {
  width: 1.05rem;
  height: 1.05rem;
}

/* ---------- Inventory ---------- */
.section-title {
  margin: 0;
  font-size: 0.95rem;
}
/* The ledger's window: the heading, its period chips and the date picker. */
.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0.6rem;
}
.section-head input {
  padding: 0.4rem 0.6rem;
}
.inv-product {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.inv-thumb {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.4rem;
  object-fit: cover;
  flex-shrink: 0;
}
.inv-thumb.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-muted);
}
.inv-thumb.empty svg {
  width: 0.9rem;
  height: 0.9rem;
}
.inv-name {
  font-weight: 600;
}

/* ---------- Product types ---------- */
.type-panel {
  padding: 0;
}
.type-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
}
.type-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: grab;
}
.type-row:hover {
  background: var(--surface-2);
}
.type-row.dragging {
  opacity: 0.4;
}
.type-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.type-label {
  font-weight: 600;
  font-size: 0.9rem;
}
.type-key {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.icon-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.icon-choice:hover {
  background: var(--surface-2);
}
.icon-choice.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.color-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}
.color-choice.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}
/* A column per product type, as the reference groups them. */
.cat-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  align-items: start;
}
.cat-column {
  padding: 0;
  overflow: hidden;
}
.cat-column-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cat-column-title {
  font-weight: 600;
}
.cat-column-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.cat-column-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: grab;
}
.cat-row:hover {
  background: var(--surface-2);
}
.cat-row.dragging {
  opacity: 0.4;
}
.cat-grip {
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: -0.15em;
  cursor: grab;
}
.cat-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
}
.cat-cook {
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}
.cat-items {
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.cat-icon-btn {
  padding: 0 0.25rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  cursor: pointer;
}
.cat-icon-btn:hover {
  color: var(--text);
}
.cat-icon-btn.danger:hover {
  color: var(--danger);
}
/* Products in a type that no category claims. */
.cat-loose {
  border-style: dashed;
  background: none;
  cursor: default;
}
.cat-loose .cat-name {
  color: var(--text-muted);
  font-weight: 500;
}
.cat-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cat-toggle {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  margin-left: auto;
  border: none;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.15s;
}
.cat-toggle.on {
  background: var(--primary);
}
.cat-toggle-knob {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.cat-toggle.on .cat-toggle-knob {
  transform: translateX(1rem);
}
.cat-hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}

/* ---------- Expenses ---------- */
.expense-search {
  flex: 1;
  min-width: 12rem;
  padding: 0.5rem 0.7rem;
}
.expense-amount {
  color: var(--danger);
  font-weight: 600;
  white-space: nowrap;
}
/* Tinted from the chip's own colour, so one rule covers every category and
   the tint follows the theme. */
.cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.cat-food {
  color: #ea580c;
}
.cat-ice {
  color: #2563eb;
}
.cat-stock-refill {
  color: #16a34a;
}
.cat-milk {
  color: #9333ea;
}
.cat-supplies {
  color: #d97706;
}
.cat-other {
  color: #78716c;
}
.amount-field {
  position: relative;
}
.amount-field input {
  width: 100%;
  padding-left: 2.9rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.amount-toggle {
  position: absolute;
  left: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--primary);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.cat-btn {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.cat-btn:hover {
  background: var(--surface-2);
}
.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.warn-note {
  border: 1px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
}

/* ---------- POS shift / report ---------- */
/* The report is long, so ordinary lines stay small and only the headline
   figures take the full `total-row` weight. */
.report-section {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.report-lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.report-line {
  display: flex;
  /* The label pairs with the value's first line — the dollars — rather than
     dropping to the KHR note underneath it. */
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  /* A money row is two lines tall (USD with its KHR underneath), so every row
     keeps that height; otherwise the plain count rows collapse to one line and
     the report's rhythm stutters. */
  min-height: 2rem;
  font-size: 0.88rem;
}
.report-label {
  color: var(--text-muted);
  /* Matches .money, so both share a baseline on the first line. */
  line-height: 1.15;
}
.report-value {
  font-weight: 600;
  text-align: right;
}
.report-head {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}
/* The report's actions are longer labels than most modals carry. */
.modal-actions .btn {
  white-space: nowrap;
}
/* What came of the checkout modal's Print button. */
.bill-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
}
/* The checkout's Print control carries its copies in a drop-down pinned to the
   button's own corner, not a centred dialog. That button is on the last line of
   a scrolling modal, so the list opens upward from the corner — the one
   direction whose box stays inside the modal instead of being clipped by it.
   The wrapper takes the flex share the `.modal-actions > .btn` rule gave the
   button before, so the three actions keep their thirds. */
.print-menu-wrap {
  position: relative;
  flex: 1;
}
.print-menu-wrap > .btn {
  width: 100%;
}
.print-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.4rem);
  z-index: 5;
  min-width: 9rem;
  display: flex;
  flex-direction: column;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.print-menu-item {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.print-menu-item:hover {
  background: var(--surface-2);
}

/* The POS modal's title reads as a heading over the report, like a receipt. */
.modal-shift h3 {
  text-align: center;
  padding: 0 1.9rem;
}
.audit-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.2rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
}
/* A float is counted in either currency, so the two fields sit side by side. */
.cash-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.cash-total {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.variance-off .money {
  color: var(--danger);
}
.past-pos {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}
.past-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.past-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.past-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.past-row:last-child {
  border-bottom: none;
}
.past-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.7rem;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.past-main:hover {
  background: var(--surface-2);
}
.past-date {
  color: var(--text-muted);
}
.past-total {
  font-weight: 600;
}
.past-del {
  padding: 0.4rem 0.6rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}
.past-del:hover {
  color: var(--danger);
}
/* The report prints through the browser's dialog: hide the app, show the block. */
.print-only {
  display: none;
}
@media print {
  body * {
    visibility: hidden;
  }
  .print-only,
  .print-only * {
    visibility: visible;
  }
  .print-only {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
  }
}

/* ---------- Report ---------- */
.segmented {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.segmented button {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.segmented button.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.report-head {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.report-head h3 {
  margin: 0;
}
.period-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.period-nav h4 {
  margin: 0;
  min-width: 12rem;
  text-align: center;
}
/* A month of days, Monday first. */
.report-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}
.rcal-head {
  padding: 0.3rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}
.rcal-cell {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 150px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
}
button.rcal-cell {
  cursor: pointer;
}
button.rcal-cell:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}
.rcal-cell.blank {
  border-color: transparent;
  background: transparent;
}
.rcal-cell.quiet {
  border-color: transparent;
  background: var(--surface-2);
}
.rcal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.rcal-day {
  font-size: 0.85rem;
  font-weight: 700;
}
.rcal-day.today {
  color: var(--primary);
}
.rcal-tx {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.cell-net {
  margin: 0.1rem 0 0.2rem;
  color: var(--success);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}
.cell-khr {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.78rem;
  text-align: center;
}
.metrics {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.metric {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
}
.metric > span:first-child {
  color: var(--text-muted);
}
.metric-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.metric.bad .metric-value {
  color: var(--danger);
}
.metric.total {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.metric.total .metric-value {
  font-weight: 700;
}
.month-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 0.75rem;
}
.month-card {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.month-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.month-name {
  font-weight: 700;
}
.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.9rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.stat-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat-value {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.stat-khr {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
}
.day-shifts,
.day-expenses {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.day-shift {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.day-shift-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.day-expense {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.day-expense .note {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-expense .amount {
  font-weight: 600;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

/* ---------- Clock ---------- */
.clock-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.clock-card {
  width: min(420px, 100%);
  padding: 1.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.clock-shop {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.clock-who {
  margin: 0.35rem 0 1.75rem;
  font-size: 1.6rem;
  font-weight: 700;
}
.clock-button {
  width: 100%;
  padding: 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}
.clock-button.in {
  background: var(--success);
}
.clock-button:disabled {
  opacity: 0.6;
  cursor: default;
}
.clock-state {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.clock-unknown h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

/* ---------- Staff ---------- */
.link-code {
  display: inline-block;
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.78rem;
}
.mini {
  margin-left: 0.4rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}
.mini:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.chip {
  margin-left: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.muted-chip {
  background: var(--surface-2);
  color: var(--text-muted);
}
.worked {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.panel-head h3 {
  margin: 0;
}
tr.inactive td {
  opacity: 0.6;
}
.clock-hours {
  display: grid;
  gap: 0.5rem;
  margin: 1.35rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  text-align: left;
}
.clock-hours div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.clock-hours dt {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.clock-hours dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
/* A close says what it does: it is the way out, and it is red. */
.modal-head .icon-btn {
  color: var(--danger);
  border-color: var(--danger);
}
.modal-head .icon-btn:hover,
.sheet-modal .modal-actions .btn-ghost:hover {
  background: var(--danger);
  color: #fff;
}
.sheet-modal .modal-actions .btn-ghost {
  color: var(--danger);
  border-color: var(--danger);
}
.modal-head h3 {
  margin: 0;
}
.modal-head p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}
.sheet-modal {
  width: min(560px, 100%);
}
.sheet-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sheet-summary > div {
  display: grid;
  gap: 0.15rem;
}
.sheet-summary strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.sheet-table th,
.sheet-table td {
  padding: 0.5rem 0.6rem;
}
.sheet-table .day {
  color: var(--text-muted);
  white-space: nowrap;
}
.sheet-table tr.running td {
  color: var(--accent);
}
.sheet-empty {
  margin: 0.5rem 0 1rem;
}
.sheet-rename {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.sheet-rename label {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.sheet-rename input {
  flex: 1;
  min-width: 0;
}
.row-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  vertical-align: middle;
}
.label-note {
  margin-left: 0.4rem;
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.72rem;
}

/* ---------- Customer display ---------- */
/* Facing a customer who is standing up, so everything is large. */
.display {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  /* One screen, no scrolling: what does not fit runs into a second column. */
  height: 100vh;
  overflow: hidden;
  padding: 1.75rem 2.5rem;
  background: var(--bg);
  color: var(--text);
  text-align: left;
}
.display-head {
  flex-shrink: 0;
  text-align: center;
}
.display-head h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
}
.display-head p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.display-waiting {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--text-muted);
}
.display-waiting p:first-child {
  font-size: 1.5rem;
  color: var(--text);
}
.display-waiting-note {
  font-size: 0.95rem;
}
.display-lines {
  flex: 1;
  /* `min-height: 0` lets it shrink inside the column instead of pushing the
     totals off the screen. */
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
/* A long order: fill the left column to the floor, then carry on to the right. */
.display-lines.two-col {
  display: block;
  column-count: 2;
  column-fill: auto;
  column-gap: 3rem;
}
.display-lines.two-col li {
  break-inside: avoid;
}
.display-lines li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.display-line-name {
  font-size: 1.55rem;
  font-weight: 600;
}
.display-kh {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}
.display-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}
.display-opts {
  margin-top: 0.4rem;
}
.display-opt {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
}
.display-qty {
  color: var(--accent);
  font-size: 1.55rem;
  font-weight: 700;
}
.display-line-total {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.display-totals {
  flex-shrink: 0;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
}
.display-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
  font-size: 1.05rem;
}
.display-totals dt {
  color: var(--text-muted);
}
.display-totals dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.display-discount dd {
  color: var(--accent);
}
.display-grand {
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  border-top: 2px solid var(--text);
}
.display-grand dt,
.display-grand dd {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
}
.display-grand .display-khr {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}
.display-thanks {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.4rem;
}
.display-thanks h1 {
  margin: 0;
  font-size: 3rem;
}
.display-thanks-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.15rem;
}
.display-thanks-total {
  margin: 1.5rem 0 0;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Payment success ---------- */
.success-modal {
  width: min(460px, 100%);
  text-align: center;
}
.success-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--success);
  font-size: 1.6rem;
  font-weight: 700;
}
.success-modal h3 {
  margin: 0;
}
.success-total {
  margin: 0.35rem 0 0.9rem;
  font-size: 1.8rem;
  font-weight: 700;
}
.success-prints {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}
