:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --border: #e5e9ef;
  --text: #111827;
  --text-dim: #6b7280;
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-soft: #fff1e8;
  --primary-contrast: #ffffff;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 3px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.04);
  --shadow-lg: 0 12px 40px rgba(17,24,39,.14);
  --radius: 14px;
  --nav-h: 64px;
  --topbar-h: 56px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon svg { width: 1.3em; height: 1.3em; display: block; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  z-index: 30;
  padding-top: env(safe-area-inset-top);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-back { background: none; border: none; color: var(--text); display: flex; padding: 4px; cursor: pointer; flex-shrink: 0; }
.topbar-title { font-size: 16.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.demo-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .03em;
  color: var(--warn); background: var(--warn-soft); padding: 3px 8px; border-radius: 20px;
}
.session-badge {
  font-size: 10.5px; font-weight: 700; color: var(--success); background: var(--success-soft);
  padding: 3px 9px; border-radius: 20px; display: flex; align-items: center; gap: 4px;
}
.session-badge.closed { color: var(--text-dim); background: var(--surface-2); }
.topbar-icon-btn { background: none; border: none; color: var(--text-dim); display: flex; padding: 6px; cursor: pointer; border-radius: 8px; }
.topbar-icon-btn:active { background: var(--surface-2); }
.user-chip { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); cursor: pointer; padding: 4px 8px; border-radius: 20px; background: var(--surface-2); }
.user-chip .icon svg { width: 15px; height: 15px; }

#app-root {
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 14px);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
  min-height: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-left: 14px;
  padding-right: 14px;
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 12px; right: 12px; height: var(--nav-h);
  bottom: calc(14px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(17, 24, 39, .06);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, .14);
  display: flex;
  z-index: 30;
  max-width: 536px;
  margin: 0 auto;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-dim); text-decoration: none; font-size: 11px; gap: 2px; background: none; border: none; cursor: pointer;
}
.nav-icon { font-size: 22px; }
.nav-icon .icon svg { width: 1em; height: 1em; }
.nav-item.active { color: var(--primary); }

/* ---------- Sidebar (tablet/desktop) ---------- */
.sidebar {
  display: none;
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  flex-direction: column; padding: 18px 12px; z-index: 25; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
.sidebar-brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex-shrink: 0; }
.sidebar-brand-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); text-decoration: none; font-size: 13.5px; font-weight: 600; cursor: pointer; border: none; background: none; text-align: left;
}
.sidebar-link .icon svg { width: 18px; height: 18px; }
.sidebar-link:hover { background: var(--surface-2); }
.sidebar-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .topbar { left: var(--sidebar-w); }
  #app-root { margin: 0; max-width: none; padding-left: calc(var(--sidebar-w) + 28px); padding-right: 28px; padding-bottom: 40px; }
  #app-root.wrap-narrow { max-width: calc(var(--sidebar-w) + 780px); }
  .modal-overlay { padding-left: calc(var(--sidebar-w) + 20px); }
}

/* ---------- Tile home ---------- */
.hero-card {
  background: linear-gradient(135deg, var(--primary), #f97316);
  color: #fff; border-radius: 20px; padding: 20px 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-lg);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hero-label { font-size: 12px; opacity: .85; }
.hero-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.hero-stats { display: flex; gap: 18px; margin-top: 16px; flex-wrap: wrap; }
.hero-stat-label { font-size: 11px; opacity: .85; }
.hero-stat-value { font-size: 15px; font-weight: 700; margin-top: 2px; }
.hero-shift-pill { background: rgba(255,255,255,.2); border-radius: 20px; padding: 5px 12px; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 5px; }

.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
@media (min-width: 480px) and (max-width: 899px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; } }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text); cursor: pointer; box-shadow: var(--shadow);
  position: relative; transition: transform .12s ease;
}
.tile:active { transform: scale(.96); }
.tile-icon-wrap { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.tile-icon-wrap .icon svg { width: 24px; height: 24px; }
.tile-label { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.25; }
.tile-badge { position: absolute; top: 8px; right: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input[type="file"] { padding: 8px; }
input[type="checkbox"], input[type="radio"] { width: auto; }

.field-label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 4px; margin-top: 2px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; cursor: pointer; }
.toggle-row-title { display: block; font-size: 14px; font-weight: 600; }
.toggle-row-hint { display: block; font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; }
.toggle-row input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  position: relative; flex-shrink: 0; width: 44px; height: 26px;
  background: var(--border); border-radius: 20px; transition: background .2s;
}
.toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-row input:checked + .toggle-switch { background: var(--primary); }
.toggle-row input:checked + .toggle-switch::after { transform: translateX(18px); }

.btn {
  border: none; border-radius: 10px; padding: 11px 16px; font-size: 14.5px; font-weight: 700;
  cursor: pointer; color: var(--text); background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn .icon svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-block { width: 100%; margin-bottom: 10px; }
.btn-icon { width: 44px; flex-shrink: 0; padding: 0; font-size: 18px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 10px; }
.page-head h2 { font-size: 18px; margin: 0; }
.page-subtitle { font-size: 12.5px; color: var(--text-dim); margin: 2px 0 14px; }

.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row input { flex: 1; min-width: 0; margin-bottom: 0; }

.search-box { position: relative; }
.search-box input { margin-bottom: 0; padding-right: 44px; }
.search-box-scan {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: none; background: transparent; color: var(--primary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px;
}

.empty-state { text-align: center; color: var(--text-dim); padding: 40px 16px; font-size: 14px; line-height: 1.6; }
.empty-state .icon { margin-bottom: 8px; opacity: .5; }
.empty-state .icon svg { width: 40px; height: 40px; }

/* ---------- POS: kategori + grid menu + keranjang ---------- */
.pos-layout { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .pos-layout { flex-direction: row; align-items: flex-start; } }
.pos-main { flex: 1; min-width: 0; }
.pos-cart-col { width: 100%; }
@media (min-width: 900px) { .pos-cart-col { width: 360px; flex-shrink: 0; position: sticky; top: calc(var(--topbar-h) + 14px); } }

.cat-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.cat-chip { flex-shrink: 0; padding: 8px 16px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1180px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }
.menu-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; position: relative;
}
.menu-card:active { transform: scale(.97); }
.menu-card.out-of-stock { opacity: .5; }
.menu-card-emoji { font-size: 26px; line-height: 1; }
.menu-card-name { font-size: 13.5px; font-weight: 700; line-height: 1.3; min-height: 34px; }
.menu-card-price { font-size: 13px; font-weight: 800; color: var(--primary); }
.menu-card-cat { font-size: 10.5px; color: var(--text-dim); }
.menu-card-qty-badge { position: absolute; top: 8px; right: 8px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.cart-list { margin-top: 0; display: flex; flex-direction: column; gap: 8px; }
.cart-item {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px;
  box-shadow: var(--shadow);
}
.cart-item-name { font-size: 13.5px; font-weight: 700; }
.cart-item-price { font-size: 11.5px; color: var(--text-dim); }
.qty-control { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; }
.qty-btn { background: none; border: none; color: var(--text); width: 24px; height: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.qty-btn .icon svg { width: 16px; height: 16px; }
.cart-item-subtotal { font-weight: 800; font-size: 13.5px; min-width: 74px; text-align: right; }
.cart-remove { background: none; border: none; color: var(--danger); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.cart-remove .icon svg { width: 17px; height: 17px; }

.pos-summary { position: sticky; bottom: 0; background: var(--bg); padding-top: 14px; margin-top: 14px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; font-size: 13.5px; }
.summary-row input { width: 130px; margin-bottom: 0; text-align: right; }
.summary-total { font-size: 18px; font-weight: 800; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; }

.product-list, .trx-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.product-row, .trx-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  box-shadow: var(--shadow);
}
.product-name, .trx-invoice { font-weight: 700; font-size: 14px; }
.product-sub, .trx-date { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.product-meta { text-align: right; }
.product-price { font-weight: 700; font-size: 14px; color: var(--primary); }
.product-stock { font-size: 12px; color: var(--text-dim); }
.product-stock.low-stock { color: var(--warn); font-weight: 700; }
.product-stock.negative-stock { color: var(--danger); font-weight: 700; }
.trx-total { font-weight: 800; color: var(--primary); }

.filter-row { margin-bottom: 4px; }
.filter-row-flex { display: flex; gap: 8px; margin-bottom: 4px; align-items: stretch; }
.filter-row-flex select, .filter-row-flex input { flex: 1; margin-bottom: 0; }

.segmented { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; overflow-x: auto; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 9px 4px; border-radius: 9px;
  font-size: 12.5px; font-weight: 700; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
}
.seg-btn .icon svg { width: 15px; height: 15px; }
.seg-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.picker-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.picker-row { background: var(--surface-2); border-radius: 10px; padding: 9px 10px; }
.picker-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.picker-row-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-remove { background: none; border: none; color: var(--danger); cursor: pointer; display: flex; flex-shrink: 0; padding: 0; }
.picker-remove .icon svg { width: 16px; height: 16px; }
.picker-row-bottom { display: flex; align-items: center; gap: 6px; }
.picker-qty, .picker-cost { margin-bottom: 0; padding: 6px; font-size: 13px; text-align: center; width: 64px; flex: none; }
.picker-x { color: var(--text-dim); font-size: 12px; }
.picker-subtotal { margin-left: auto; font-size: 13px; font-weight: 700; white-space: nowrap; }
.empty-state-sm { text-align: center; color: var(--text-dim); font-size: 13px; padding: 16px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; }
.badge-income, .badge-penjualan { background: var(--success-soft); color: var(--success); }
.badge-expense, .badge-pembelian { background: #dbeafe; color: #1d4ed8; }
.badge-void { background: var(--danger-soft); color: var(--danger); }
.badge-open { background: var(--success-soft); color: var(--success); }
.badge-closed { background: var(--surface-2); color: var(--text-dim); }
.badge-role { background: var(--primary-soft); color: var(--primary-dark); }

.section-title { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin: 22px 0 10px; font-weight: 700; }

.report-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
@media (min-width: 560px) { .report-cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .report-cards { grid-template-columns: repeat(4, 1fr); } }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px; box-shadow: var(--shadow); }
.report-card-label { font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.report-card-label .icon svg { width: 14px; height: 14px; }
.report-card-value { font-size: 18px; font-weight: 800; margin-top: 8px; word-break: break-word; }
.report-card-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 10px 10px; min-height: 160px; overflow-x: auto; box-shadow: var(--shadow); }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; min-width: 40px; }
.bar-val { font-size: 9px; color: var(--text-dim); margin-bottom: 4px; white-space: nowrap; }
.bar { width: 20px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 4px; }
.bar-label { font-size: 9.5px; color: var(--text-dim); margin-top: 6px; white-space: nowrap; }

.top-products { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.top-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.top-row:last-child { border-bottom: none; }
.top-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.top-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-qty { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }

.hint-text { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 6px 0 4px; }
.app-version { text-align: center; font-size: 11px; color: var(--text-dim); margin: 26px 0 4px; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { margin-bottom: 10px; }

/* ---------- Table list (responsive: card di mobile, tabel di layar lebar) ---------- */
.dt { width: 100%; }
.dt-row {
  display: flex; flex-wrap: wrap; gap: 4px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer;
}
.dt-cell { font-size: 13px; }
.dt-cell-label { color: var(--text-dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; display: block; margin-bottom: 1px; }

/* ---------- Permission checklist (RBAC) ---------- */
.perm-group-title { font-size: 12px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; margin: 16px 0 8px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: none; }
.perm-row label { font-size: 13.5px; font-weight: 600; flex: 1; cursor: pointer; }

/* ---------- Activation / onboarding / login gate ---------- */
body.pre-activation .topbar, body.pre-activation .bottom-nav, body.pre-activation .sidebar,
body.pre-setup .topbar, body.pre-setup .bottom-nav, body.pre-setup .sidebar,
body.locked .topbar, body.locked .bottom-nav, body.locked .sidebar { display: none; }
body.pre-activation #app-root, body.pre-setup #app-root, body.locked #app-root { padding: 0; max-width: none; margin: 0; }

.gate-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card { max-width: 400px; width: 100%; }
.gate-card-center { text-align: center; }
.gate-icon {
  width: 60px; height: 60px; border-radius: 18px; background: var(--primary); color: var(--primary-contrast);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.gate-icon .icon svg { width: 30px; height: 30px; }
.gate-card h2 { margin: 0 0 8px; font-size: 20px; text-align: center; }
.gate-card p.gate-desc { color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; line-height: 1.55; text-align: center; }
#lic-input { text-align: center; letter-spacing: 2px; font-weight: 700; text-transform: uppercase; font-size: 16px; }
.gate-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 12px; text-align: center; }

.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 22px 0; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); }
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-key {
  aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pin-key:active { background: var(--border); }
.pin-key.pin-key-ghost { background: transparent; border: none; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-box {
  background: var(--surface); border-radius: 18px; padding: 18px 16px;
  width: 100%; max-width: 480px; max-height: min(88vh, 760px); overflow-y: auto;
  box-shadow: var(--shadow-lg);
  margin: auto;
}
.modal-box.modal-wide { max-width: 720px; }
.modal-box h3 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; }
.modal-msg { font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.modal-actions > div { display: flex; gap: 8px; }
.modal-actions-col { flex-direction: column; }
.modal-actions-col .btn { width: 100%; }
.modal-close-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px; }

.scanner-box { text-align: center; }
.scanner-box video { width: 100%; border-radius: 10px; background: #000; max-height: 60vh; object-fit: cover; }
.scanner-hint { color: var(--text-dim); font-size: 13px; margin: 10px 0; }

.receipt-preview .receipt-html {
  background: #fff; color: #000; font-family: 'Courier New', monospace; font-size: 12px;
  padding: 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--border);
}
.receipt-html .center { text-align: center; }
.receipt-html .line { border-top: 1px dashed #000; margin: 6px 0; }
.receipt-html table { width: 100%; border-collapse: collapse; }
.receipt-html td { padding: 1px 0; font-size: 12px; }
.receipt-html .r { text-align: right; }

/* ---------- Toasts ---------- */
#toast-holder { position: fixed; top: calc(var(--topbar-h) + 10px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast {
  background: var(--text); border: 1px solid var(--border); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; transform: translateY(-8px);
  transition: all .25s ease; max-width: 90%; text-align: center; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }
