:root {
  --bg: #faf4e1;
  --card: #ffffff;
  --pill: #f8ead9;
  --pill-2: #f3ddc9;
  --accent: #f4683a;
  --accent-2: #ff7a4d;
  --accent-soft: #f7b59a;
  --accent-tint: #fdeae0;
  --text: #2c2a28;
  --muted: #948b7d;
  --green: #34c75e;
  --line: #efe6d4;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 12px 28px rgba(70, 50, 30, 0.10);
  --shadow-sm: 0 4px 14px rgba(70, 50, 30, 0.07);
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

/* Nunito for headings, DM Sans (body var) for everything else. */
h1,
h2,
h3,
.brand h1,
.tabhead h1,
.section-title,
.grand h2 {
  font-family: var(--font-head);
}

body {
  font-family: var(--font);
  color: var(--text);
  /* Soft gradient frame around the whole app. */
  background: linear-gradient(125deg, #bfe3cd 0%, #f3c9da 50%, #d9caee 100%);
  padding: 10px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  background: var(--bg);
  border-radius: var(--radius);
  min-height: calc(100vh - 20px);
  padding: 26px 16px 48px;
}

.wrap {
  max-width: 460px;
  margin: 0 auto;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.brand .logo {
  font-size: 30px;
}
.brand-icon {
  width: 54px;
  height: 59px;
}
.brand h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand h1 .b-tab {
  color: var(--accent);
}
.brand h1 .b-share {
  color: #28384b;
}
.tabhead .logo-img {
  width: 30px;
  height: 33px;
}
.tagline {
  text-align: center;
  color: #6f675b;
  margin: 4px 0 22px;
  font-size: 17px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card.flat {
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .opt {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
}
.muted {
  color: var(--muted);
  font-size: 14px;
}

/* Inputs */
label.lbl {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
input.line {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input.line::placeholder {
  color: #b9b0a2;
}
input.line:focus {
  border-color: var(--accent);
}
input.pill {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 999px;
  background: var(--pill);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
input.pill:focus {
  box-shadow: 0 0 0 2px var(--accent-soft) inset;
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}
.btn {
  width: 100%;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 600;
  padding: 16px 20px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.05s, filter 0.15s, background 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 18px rgba(244, 104, 58, 0.32);
}
.btn-primary:hover {
  filter: brightness(1.03);
}
.btn-soft {
  background: var(--accent-soft);
  box-shadow: none;
}
.btn[disabled] {
  cursor: default;
  background: var(--accent-soft);
  box-shadow: none;
  opacity: 0.95;
}

/* Snap dropzone */
.dropzone {
  border: 2px dashed #f1c3ab;
  background: #fdf1ea;
  border-radius: var(--radius-sm);
  padding: 30px 18px;
  text-align: center;
  color: #b97a5c;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover {
  border-color: var(--accent);
  background: #fdeae0;
}
.dropzone .cam {
  font-size: 26px;
  display: block;
  margin-bottom: 8px;
}

.preview {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--pill);
  min-height: 180px;
}
.preview img {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 320px;
  object-fit: cover;
  background: var(--pill);
  opacity: 0; /* hidden until decoded — no broken-image flash */
  transition: opacity 0.25s ease;
}
.preview img.loaded {
  opacity: 1;
}
.preview .close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  display: grid;
  place-items: center;
}
.preview .badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.preview .badge.ok {
  background: #1e9e4a;
}
.preview .reading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--pill);
  color: var(--accent);
  font-weight: 600;
  gap: 8px;
}
.preview .reading .spinner {
  border-color: rgba(244, 104, 58, 0.25);
  border-top-color: var(--accent);
}

/* Currency select */
.select {
  position: relative;
}
.select .trigger {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--text);
  text-align: left;
}
.select .trigger .sym {
  color: var(--accent);
  font-weight: 600;
}
.select .trigger .code {
  color: var(--muted);
  font-size: 14px;
}
.select .trigger .chev {
  margin-left: auto;
  color: var(--muted);
}
.select .menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 8px;
  max-height: 280px;
  overflow: auto;
}
.select .menu input {
  width: 100%;
  border: none;
  background: var(--pill);
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  margin-bottom: 6px;
  outline: none;
}
.select .opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
}
.select .opt:hover {
  background: #faf3ec;
}
.select .opt.sel {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.select .opt .code {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
}
.select .opt.sel .code {
  color: var(--accent);
}

/* Tip presets */
.tips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  background: var(--pill);
  color: #6f675b;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
}
.chip.active {
  background: var(--accent);
  color: #fff;
}
.tip-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill);
  border-radius: 999px;
  padding: 6px 14px;
  margin-top: 8px;
}
.tip-custom span {
  color: var(--muted);
  font-size: 14px;
}
.tip-custom input {
  width: 46px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

/* How it works */
.how {
  text-align: center;
  margin-top: 10px;
}
.how .h {
  letter-spacing: 1.5px;
  font-size: 12px;
  color: #a99a86;
  font-weight: 600;
}
.how .steps {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin-top: 12px;
}
.how .step {
  font-size: 13px;
  color: #8a8275;
}
.how .step .ico {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}

/* ---- Tab page ---- */
.tabhead {
  margin-bottom: 16px;
}
.tabhead .row1 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tabhead h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}
.tabhead .share {
  margin-left: auto;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.tabhead .meta {
  color: var(--muted);
  font-size: 15px;
  margin-top: 6px;
  display: flex;
  gap: 16px;
}

.billcard {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 18px;
}
.billcard .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font-weight: 600;
  color: #6f675b;
}
.billcard img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  background: #000;
  cursor: zoom-in;
}

/* Pick dishes */
.dish {
  background: var(--pill);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.dish.picked {
  background: #fff;
  border-color: var(--accent);
}
.dish .top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dish .name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dish .price {
  color: var(--accent);
  font-weight: 600;
}
.stepper {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.dish.picked .stepper {
  background: var(--pill);
}
.stepper button {
  width: 30px;
  height: 30px;
  font-size: 17px;
  background: transparent;
  color: #7a7264;
}
.stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}
.qbadge {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
}
.dish .price .ea {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
.stepper .val {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: #b6ab9a;
  font-size: 15px;
  display: grid;
  place-items: center;
}
.icon-btn:hover {
  background: #f0e7d8;
  color: #8a8275;
}
.dish .split {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.dish .split .lab {
  color: var(--muted);
  font-size: 13px;
  margin-right: 2px;
}
.schip {
  background: var(--pill);
  color: #6f675b;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.schip.active {
  background: var(--accent);
  color: #fff;
}
.dish .split .line-total {
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
}
.dish .claimers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.dish .claimers:empty {
  margin-top: 0;
}
.claimchip {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6f675b;
}
.claimchip.me {
  border-color: var(--accent-soft);
  background: #fff8f4;
  color: var(--accent);
}
.dish .left {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.dish .left.full {
  color: var(--green);
}

.additem {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 4px;
}
.additem .h {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.additem input {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  min-width: 0;
}
.additem input:focus {
  border-color: var(--accent);
}
.additem .nm {
  width: 100%;
  margin-bottom: 8px;
}
.additem .row {
  display: flex;
  gap: 8px;
}
.additem .row .pr {
  flex: 1;
}
.additem .row .qt {
  width: 64px;
}
.additem .row .add {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #fff;
  font-size: 20px;
  flex: none;
}

.tally {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--pill);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
  font-weight: 600;
}
.tally .amt {
  color: var(--accent);
}

/* Your share tiles */
.tiles {
  display: flex;
  gap: 10px;
}
.tile {
  flex: 1;
  background: var(--pill);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.tile.pay {
  background: var(--accent-tint);
}
.tile .t {
  color: var(--muted);
  font-size: 13px;
}
.tile.pay .t {
  color: var(--accent);
  font-weight: 600;
}
.tile .v {
  font-size: 20px;
  font-weight: 700;
  margin-top: 3px;
}
.tile.pay .v {
  color: var(--accent);
}
.hi {
  text-align: center;
  color: var(--muted);
  margin-top: 10px;
}
.hi b {
  color: var(--text);
}
.editlink {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
  background: transparent;
  font-size: 15px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.formula {
  background: #fdeecb;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0;
}
.formula .l {
  color: #9a8b6a;
  font-weight: 600;
}
.formula .r {
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

/* Who's in */
.who-head {
  display: flex;
  align-items: center;
}
.who-head .count {
  margin-left: auto;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 600;
}
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
}
.person.me {
  border-color: var(--accent-soft);
  background: #fff8f4;
}
.person .av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffd98a;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}
.person .nm b {
  font-weight: 700;
}
.person .nm .you {
  color: var(--accent);
  font-size: 13px;
  margin-left: 4px;
}
.person .nm .sub {
  color: var(--muted);
  font-size: 13px;
}
.person .amt {
  margin-left: auto;
  text-align: right;
}
.person .amt b {
  font-size: 17px;
  font-weight: 700;
}
.person .amt .sub {
  color: var(--muted);
  font-size: 12px;
  display: block;
}

/* Grand total */
.grand {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: var(--radius);
  color: #fff;
  padding: 22px;
  box-shadow: 0 12px 28px rgba(244, 104, 58, 0.3);
}
.grand h2 {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
}
.grand .ppl .pp {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 17px;
}
.grand hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  margin: 12px 0;
}
.grand .sub {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
}
.grand .sub.faint {
  color: rgba(255, 255, 255, 0.7);
}
.grand .gt-val {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.grand .gt-edit {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  padding: 2px 6px;
  line-height: 1;
}
.grand .gt-edit:hover {
  background: rgba(255, 255, 255, 0.35);
}
.grand .gt-input {
  width: 90px;
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 15px;
  text-align: right;
  outline: none;
}
.grand .gt-ok,
.grand .gt-cancel {
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  font-weight: 700;
}
.grand .ghint {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  padding: 2px 0 8px;
}
.grand .tot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  font-weight: 800;
}
.grand .tot .big {
  font-size: 30px;
}

/* misc */
.hidden {
  display: none !important;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2.4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
.spinner.dark {
  border-color: rgba(244, 104, 58, 0.25);
  border-top-color: var(--accent);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #2c2a28;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.center {
  text-align: center;
}
/* Detecting / scanning loader */
.detecting {
  padding: 4px 2px 2px;
}
.scanbox {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  padding: 8px 0;
}
.srow {
  height: 16px;
  border-radius: 8px;
  margin: 11px 6px;
  background: linear-gradient(90deg, #f1e4d2 25%, #fbf3e8 37%, #f1e4d2 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.srow.short {
  width: 55%;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}
.scanline {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  top: 4%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px 2px rgba(244, 104, 58, 0.5);
  animation: scan 1.8s ease-in-out infinite;
}
@keyframes scan {
  0% {
    top: 4%;
  }
  50% {
    top: 90%;
  }
  100% {
    top: 4%;
  }
}
.detcap {
  text-align: center;
  color: var(--muted);
  margin-top: 10px;
  font-weight: 600;
  transition: opacity 0.25s ease;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 200;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
}
.collapse-btn {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
}

/* Review-page receipt total row */
.rt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.rt-lbl {
  color: var(--muted);
  font-weight: 600;
}
.rt-val {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--accent);
}
.rt-val .rt-input {
  width: 100px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 15px;
  text-align: right;
  color: var(--text);
  outline: none;
}
.rt-val .rt-input:focus {
  border-color: var(--accent);
}
.rt-val .rt-ok {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-weight: 700;
}
