:root {
  --navy: #0b1f3a;
  --navy-2: #12305a;
  --gold: #d4a437;
  --gold-2: #e8c25e;
  --bg: #f6f4ef;
  --ink: #1c2430;
  --muted: #7a8494;
  --line: #e4e0d6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
}
.app-header {
  background: var(--navy);
  color: #fff;
  padding: 14px 16px 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.brand-mark {
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  border-radius: 10px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.app-header h1 { font-size: 18px; line-height: 1.1; }
.tagline { font-size: 12px; color: var(--gold-2); }
.tabs { display: flex; }
.tab {
  flex: 1;
  background: none;
  border: none;
  color: #b8c4d8;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tab.active { color: var(--gold-2); border-bottom-color: var(--gold); }

main { padding: 14px 16px 40px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.bill-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--muted); font-size: 13px; }

.bill-lines { list-style: none; }
.bill-lines li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.line-info { flex: 1; min-width: 0; }
.line-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-detail { font-size: 12px; color: var(--muted); }
.line-amount { font-weight: 700; font-size: 16px; white-space: nowrap; }
.line-remove {
  border: none; background: none; color: #c0392b; font-size: 18px; cursor: pointer; padding: 4px;
}

.empty-hint { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }

.total-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--navy); color: #fff;
  border-radius: 14px; padding: 14px 16px; margin: 12px 0;
  font-size: 17px; font-weight: 600;
}
.total-amount { font-size: 26px; font-weight: 800; color: var(--gold-2); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.action-grid .btn-gold:first-child { grid-column: 1 / -1; }

.btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); font-size: 17px; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-ghost { background: none; border: none; color: var(--navy); font-size: 13px; padding: 6px; }

.manual-scan input, .field input, #product-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.manual-scan { margin-bottom: 10px; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(11, 31, 58, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 20;
}
.overlay.hidden, .hidden { display: none; }
.sheet {
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px 28px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
}
.sheet h2 { font-size: 18px; margin-bottom: 12px; color: var(--navy); }
.qr-box { display: flex; justify-content: center; padding: 10px 0; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }
.upi-amount { text-align: center; font-size: 28px; font-weight: 800; color: var(--navy); }
.muted { color: var(--muted); font-size: 13px; text-align: center; margin: 6px 0 12px; }
.small { font-size: 12px; text-align: left; }
.scanner-view { width: 100%; min-height: 260px; border-radius: 12px; overflow: hidden; background: #000; }
.scanner-view video { width: 100%; }
.row-gap { display: flex; gap: 8px; margin-top: 12px; }
.row-gap .btn { flex: 1; }

.field { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.field input { margin-top: 5px; font-weight: 400; }
#btn-save-settings { width: 100%; margin-top: 4px; }

.product-list { list-style: none; margin-top: 12px; }
.product-list li {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.product-list .line-remove { font-size: 15px; }

.form-field { margin-bottom: 10px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.form-field input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px; font-size: 16px; background: #fff;
}

hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.backup-h { font-size: 15px; color: var(--navy); margin-bottom: 10px; }

.print-only { display: none; }

@media print {
  body { max-width: none; background: #fff; }
  .app-header, main { display: none !important; }
  .print-only { display: block; font-family: monospace; font-size: 13px; width: 72mm; margin: 0 auto; }
  .print-only h2 { text-align: center; font-size: 15px; margin-bottom: 2px; }
  .print-only .p-meta { text-align: center; font-size: 11px; margin-bottom: 8px; }
  .print-only table { width: 100%; border-collapse: collapse; }
  .print-only td { padding: 2px 0; vertical-align: top; }
  .print-only .amt { text-align: right; }
  .print-only .p-total { border-top: 1px dashed #000; margin-top: 6px; padding-top: 6px; font-weight: bold; font-size: 15px; }
  .print-only .p-foot { text-align: center; margin-top: 10px; font-size: 11px; }
}
