/* Cairo — SIL Open Font License 1.1, see /fonts/OFL.txt
   One variable file per script covers every weight we use. */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('/fonts/cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF,
                 U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('/fonts/cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('/fonts/cairo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f2efea;
  --surface: #fbfaf8;
  --bar: #f4f1ec;
  --card: #ffffff;
  --ink: #16130f;
  --muted: #8a8178;
  --line: #e7e1d8;
  --green: #24b24c;
  --green-dark: #199c3f;
  --coffee: #c08457;
  --coffee-dark: #7a4a26;
  --cup: #ddb08a;
  --cup-shade: #c2926c;
  --mk: #1b1b1f;
  --mk-deep: #111114;
  --mk-top: #0c0c0e;
  --danger: #d3453c;
}
[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #17171a;
  --bar: #131316;
  --card: #1e1e22;
  --ink: #f4f2ef;
  --muted: #8b8b93;
  --line: #26262b;
  --cup: #d3a17a;
  --cup-shade: #b1815d;
  --mk: #2e2e35;
  --mk-deep: #24242a;
  --mk-top: #1b1b20;
  --danger: #ef6259;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  transition: background .3s, color .3s;
}

.phone {
  position: relative;
  width: 100%;
  max-width: 400px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transition: background .3s;
}
@media (min-width: 440px) {
  .phone {
    min-height: 0;
    height: 860px;
    max-height: 96dvh;
    border-radius: 34px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  }
}

/* ---------- top bar ---------- */
.bar {
  flex: none;
  display: flex;
  align-items: center;
  padding: 14px 10px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  transition: background .3s, border-color .3s;
}
.bar h1 {
  flex: 1;
  margin: 0 4px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: background .2s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
/* keep the 34px circle, give thumbs a 46px target */
.icon-btn::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .flip svg { transform: scaleX(-1); }
.icon-btn.off { color: var(--muted); }
.icon-btn.off .on-only { display: none; }
.icon-btn:not(.off) .off-only { display: none; }
.badge {
  position: absolute;
  inset-inline-end: 1px;
  bottom: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 15px;
  text-align: center;
}
.badge.zero { display: none; }

/* ---------- layout ---------- */
.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
}
.footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  transition: background .3s, border-color .3s;
}
.card + .card { margin-top: 12px; }

.section-title {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.section-title:first-child { margin-top: 4px; }

/* ---------- buttons ---------- */
.btn-primary {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: 52px;
  border: 0;
  border-radius: 26px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: background .3s;
}
.btn-primary:hover:not(:disabled):not(.busy) { background: var(--green-dark); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary span { position: relative; }

.link-btn {
  border: 0;
  background: none;
  padding: 6px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.link-btn.danger { color: var(--danger); }

/* ---------- money ---------- */
.money { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---------- quantity stepper ---------- */
.stepper { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.stepper button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stepper .count { min-width: 16px; text-align: center; }

/* ---------- forms ---------- */
.field { margin-top: 12px; }
.field:first-child { margin-top: 0; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s, background .3s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field textarea { resize: none; min-height: 68px; }
.field input.num { direction: ltr; }
[dir="rtl"] .field input.num { text-align: right; }
.field .error { margin-top: 5px; font-size: 11px; font-weight: 600; color: var(--danger); min-height: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choices { display: flex; gap: 10px; }
.choice {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.choice svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.choice[aria-checked="true"] { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); }

/* ---------- totals ---------- */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
  color: var(--muted);
}
.total-row.grand {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- empty state ---------- */
.empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.empty h2 { margin: 6px 0 0; font-size: 17px; color: var(--ink); }
.empty p { margin: 0; font-size: 13px; max-width: 220px; line-height: 1.7; }

/* ---------- cup glyph ---------- */
.cup-glyph { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- toast ---------- */
.toast {
  position: absolute;
  inset-inline: 16px;
  top: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 4;
}
.toast.on { opacity: 1; transform: none; pointer-events: auto; }
.toast a { color: var(--green); font-weight: 700; text-decoration: none; white-space: nowrap; }
