:root {
  --ml-blue: #2563eb;
  --ml-blue-dark: #1d4ed8;
  --ml-bg: #f1f5f9;
  --ml-card: #ffffff;
  --ml-text: #0f172a;
  --ml-muted: #64748b;
  --ml-ok: #059669;
  --ml-danger: #dc2626;
  --ml-radius: 16px;
  --ml-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
.ml-body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--ml-bg);
  color: var(--ml-text);
  min-height: 100vh;
}
.ml-app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 78px; }
.ml-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--ml-card); border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 20;
}
.ml-top-brand { display: flex; gap: 10px; align-items: center; }
.ml-top-logo { height: 36px; width: auto; object-fit: contain; }
.ml-top-shop { font-weight: 700; font-size: 15px; }
.ml-top-user { font-size: 12px; color: var(--ml-muted); }
.ml-main { padding: 16px; }
.ml-hero-card {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff; border-radius: var(--ml-radius); padding: 22px; box-shadow: var(--ml-shadow);
}
.ml-hero-sm { padding: 16px; }
.ml-kicker { margin: 0; opacity: .9; font-size: 13px; }
.ml-money { margin: 6px 0; font-size: 34px; letter-spacing: -0.5px; }
.ml-muted { color: var(--ml-muted); font-size: 12px; }
.ml-hero-card .ml-muted { color: rgba(255,255,255,.85); }
.ml-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ml-stat {
  background: var(--ml-card); border-radius: 14px; padding: 14px; box-shadow: var(--ml-shadow);
  display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit;
}
.ml-stat-label { font-size: 12px; color: var(--ml-muted); }
.ml-stat-cta { background: #eff6ff; color: var(--ml-blue); align-items: center; text-align: center; }
.ml-stat-cta i { font-size: 22px; }
.ml-quick { display: flex; gap: 10px; margin-top: 14px; }
.ml-quick-btn {
  flex: 1; background: var(--ml-card); border-radius: 12px; padding: 14px; text-align: center;
  text-decoration: none; color: var(--ml-text); font-weight: 600; box-shadow: var(--ml-shadow);
}
.ml-quick-btn i { display: block; margin-bottom: 6px; color: var(--ml-blue); }
.ml-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid #e2e8f0;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 30;
}
.ml-nav a {
  text-decoration: none; color: var(--ml-muted); text-align: center; font-size: 11px; padding: 6px;
}
.ml-nav a i { display: block; font-size: 18px; margin-bottom: 2px; }
.ml-nav a.is-active { color: var(--ml-blue); font-weight: 700; }
.ml-btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.ml-btn-primary { background: var(--ml-blue); color: #fff; }
.ml-btn-primary:disabled { opacity: .5; }
.ml-btn-ghost { background: #e2e8f0; color: var(--ml-text); }
.ml-btn-block { width: 100%; }
.ml-btn-sm { padding: 8px 12px; font-size: 13px; }
.ml-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ml-section-head h2 { margin: 0; font-size: 20px; }
.ml-list { display: flex; flex-direction: column; gap: 8px; }
.ml-list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--ml-card); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: inherit;
  box-shadow: var(--ml-shadow);
}
.ml-list-right { display: flex; align-items: center; gap: 6px; }
.ml-price { font-weight: 700; color: var(--ml-blue-dark); }
.ml-pill { font-size: 10px; padding: 2px 6px; border-radius: 999px; margin-left: 6px; }
.ml-pill-veg { background: #dcfce7; color: #166534; }
.ml-pill-nv { background: #fee2e2; color: #991b1b; }
.ml-icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f1f5f9; color: var(--ml-text);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.ml-empty { text-align: center; color: var(--ml-muted); padding: 30px 10px; }
.ml-sheet {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40;
  display: none;
  align-items: flex-end; justify-content: center;
}
.ml-sheet.is-open,
.ml-sheet:not([hidden]) {
  display: flex;
}
.ml-sheet[hidden] {
  display: none !important;
}
.ml-sheet-card {
  width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0; padding: 18px;
  max-height: min(92vh, 640px); overflow-y: auto;
  position: relative;
}
.ml-sheet-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: #f1f5f9; color: var(--ml-text); font-size: 18px; line-height: 1;
  cursor: pointer;
}
.ml-sheet-card label { display: block; font-size: 12px; color: var(--ml-muted); margin: 10px 0 4px; }
.ml-sheet-card input[type=text],
.ml-sheet-card input[type=number],
.ml-input, .ml-search {
  width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 15px;
}
.ml-check { display: flex !important; align-items: center; gap: 8px; margin-top: 12px !important; }
.ml-sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.ml-sheet-actions .ml-btn { flex: 1; }
.ml-search { margin-bottom: 12px; }
.ml-beauty-grid {
  display: grid;
  /* Next size down from 2-col: fit more items, still easy to tap */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 360px) {
  .ml-beauty-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
.ml-beauty-empty { grid-column: 1 / -1; }
.ml-beauty-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--ml-shadow);
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  display: flex;
  flex-direction: column;
  width: 100%;
  cursor: default;
}
.ml-beauty-tap { cursor: pointer; }
.ml-beauty-tap:active { transform: scale(0.98); }
.ml-beauty-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, #e0e7ff, #f8fafc);
  overflow: hidden;
}
.ml-beauty-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ml-beauty-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 20px;
}
.ml-beauty-photo .ml-pill {
  position: absolute;
  left: 5px;
  top: 5px;
  margin: 0;
  font-size: 9px;
  padding: 1px 5px;
}
.ml-beauty-body {
  padding: 6px 7px 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ml-beauty-body strong {
  font-size: 12px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ml-beauty-body .ml-price { font-size: 12px; }
.ml-beauty-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding: 2px 4px 6px;
}
.ml-beauty-actions .ml-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
}
.ml-file-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.ml-photo-pick { display: block; cursor: pointer; margin-bottom: 8px; }
.ml-photo-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 140px;
  border-radius: 14px;
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  color: var(--ml-muted);
  font-size: 13px;
  overflow: hidden;
}
.ml-photo-preview i { font-size: 28px; color: var(--ml-blue); }
.ml-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.ml-bill-grid { max-height: 48vh; overflow: auto; margin-bottom: 12px; }
.mb-10 { margin-bottom: 10px; }
.ml-chip {
  border: 0; background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--ml-shadow);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 110px; cursor: pointer;
}
.ml-chip strong { color: var(--ml-blue); }
.ml-cart-card { background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--ml-shadow); }
.ml-cart-card h3 { margin: 0 0 10px; }
.ml-cart-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed #e2e8f0; }
.ml-cart-qty { display: flex; gap: 8px; align-items: center; }
.ml-cart-qty button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: #e2e8f0; font-weight: 700; }
.ml-total-row { display: flex; justify-content: space-between; font-size: 18px; margin: 12px 0; }
.ml-pay-row { display: flex; gap: 8px; margin-bottom: 10px; }
.ml-pay-tab { flex: 1; border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 10px; font-weight: 600; }
.ml-pay-tab.is-active { background: var(--ml-blue); color: #fff; border-color: var(--ml-blue); }
.ml-upi-box {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  text-align: center;
}
.ml-upi-vpa { margin: 0 0 6px; font-size: 13px; color: var(--ml-text); }
.ml-upi-hint { margin: 0 0 10px; font-size: 12px; color: var(--ml-muted); }
.ml-upi-ref-label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--ml-muted);
  margin: 4px 0 4px;
}
.ml-upi-ref-label span { font-weight: 400; color: #94a3b8; }
.ml-upi-warn { margin: 0 0 10px; font-size: 12px; color: #b45309; }
.ml-upi-qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.ml-upi-qr-wrap img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.ml-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.ml-tabs a {
  flex: 1; text-align: center; padding: 10px; border-radius: 12px; background: #fff; color: var(--ml-muted);
  text-decoration: none; font-weight: 600; box-shadow: var(--ml-shadow);
}
.ml-tabs a.is-active { background: var(--ml-blue); color: #fff; }

.ml-receipt-page { padding-bottom: 8px; }
.ml-receipt {
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px 16px;
  box-shadow: var(--ml-shadow);
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
  font-family: Consolas, "Courier New", Courier, monospace;
  color: #111;
  overflow: hidden;
  max-width: 100%;
}
.ml-receipt-head { text-align: center; margin-bottom: 2px; }
.ml-receipt-shop {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: #000;
  word-break: break-word;
}
.ml-receipt-addr,
.ml-receipt-phone {
  margin: 0 0 2px;
  font-size: 12px;
  line-height: 1.35;
  color: #222;
  word-break: break-word;
}
.ml-receipt-type {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #000;
}
.ml-rcpt-line {
  display: block;
  border: 0;
  border-top: 1px dashed #333;
  margin: 10px 0;
  height: 0;
  width: 100%;
}
.ml-rcpt-line.is-double {
  border-top: 2px solid #111;
  margin: 8px 0;
}
.ml-receipt-meta { display: grid; gap: 4px; }
.ml-receipt-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  color: #111;
  line-height: 1.35;
}
.ml-receipt-meta-row span:last-child {
  text-align: right;
  font-weight: 600;
  word-break: break-all;
}
.ml-rcpt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  color: #111;
}
.ml-rcpt-table th,
.ml-rcpt-table td {
  padding: 5px 0;
  vertical-align: top;
  font-weight: 400;
}
.ml-rcpt-table thead th {
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px dashed #333;
}
.ml-rcpt-table .c-qty { width: 14%; text-align: left; }
.ml-rcpt-table .c-item { width: 54%; text-align: left; word-break: break-word; padding-right: 6px; }
.ml-rcpt-table .c-amt { width: 32%; text-align: right; font-variant-numeric: tabular-nums; }
.ml-receipt-totals { margin-top: 2px; }
.ml-receipt-total-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-size: 12px;
  color: #111;
}
.ml-receipt-total-row.is-grand {
  font-size: 15px;
  font-weight: 800;
  padding: 2px 0;
  background: transparent !important;
  color: #000 !important;
}
.ml-receipt-thanks {
  text-align: center;
  margin-top: 14px;
}
.ml-receipt-thanks p {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: #111;
}
.ml-receipt-thanks p + p {
  font-weight: 400;
  color: #333;
}
.ml-receipt-shop-mini {
  margin-top: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #000 !important;
}
.ml-receipt-actions { padding: 0 0 20px; }
.ml-login-body { display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, #dbeafe, #f8fafc); }
.ml-login { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 24px; box-shadow: var(--ml-shadow); }
.ml-login-brand { text-align: center; margin-bottom: 18px; }
.ml-login-logo { height: 56px; object-fit: contain; }
.ml-login-brand h1 { margin: 8px 0 4px; font-size: 22px; }
.ml-login-brand p { margin: 0; color: var(--ml-muted); font-size: 13px; }
.ml-login-tag { font-weight: 700 !important; color: var(--ml-blue) !important; margin-top: 4px !important; }
.ml-login-hint { margin-top: 8px !important; line-height: 1.4; }
.ml-login-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ml-muted); }
.ml-login-foot a { color: var(--ml-blue); font-weight: 600; text-decoration: none; }
.ml-login-form label { display: block; font-size: 12px; color: var(--ml-muted); margin: 12px 0 4px; }
.ml-login-form input { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 15px; }
.ml-login-form .ml-btn { margin-top: 16px; }
.ml-alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.ml-alert-error { background: #fee2e2; color: #991b1b; }
.ml-alert-ok { background: #dcfce7; color: #166534; }
.ml-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 50;
}
@page {
  size: 80mm auto;
  margin: 2mm;
}
@media print {
  html, body, .ml-body {
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-family: "Courier New", Courier, monospace !important;
  }
  .ml-top, .ml-nav, .ml-sheet-actions, .ml-receipt-actions, #mlPrintBtn { display: none !important; }
  .ml-app {
    width: 76mm !important;
    max-width: 76mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    min-height: 0 !important;
  }
  .ml-main, .ml-receipt-page { padding: 0 !important; }
  .ml-receipt {
    width: 100% !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 1mm 1mm 6mm !important;
    background: #fff !important;
    margin: 0 !important;
    color: #000 !important;
  }
  .ml-receipt-shop { font-size: 14px !important; color: #000 !important; }
  .ml-receipt-addr,
  .ml-receipt-phone,
  .ml-receipt-type,
  .ml-receipt-meta-row,
  .ml-rcpt-table,
  .ml-receipt-total-row,
  .ml-receipt-thanks p { color: #000 !important; font-size: 11px !important; }
  .ml-receipt-total-row.is-grand { font-size: 13px !important; background: none !important; color: #000 !important; }
  .ml-rcpt-line { border-top-color: #000 !important; margin: 5px 0 !important; }
  .ml-rcpt-line.is-double { border-top: 2px solid #000 !important; }
  .ml-rcpt-table thead th { border-bottom-color: #000 !important; }
}
@media print and (max-width: 60mm) {
  @page { size: 58mm auto; margin: 1.5mm; }
  html, body, .ml-body { width: 58mm !important; max-width: 58mm !important; }
  .ml-app { width: 54mm !important; max-width: 54mm !important; }
  .ml-receipt-shop { font-size: 13px !important; }
  .ml-rcpt-table { font-size: 10px !important; }
}
