@font-face { font-family: Prompt; src: url("../fonts/Prompt-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Prompt; src: url("../fonts/Prompt-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Prompt; src: url("../fonts/Prompt-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: Prompt; src: url("../fonts/Prompt-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f4efe7;
  --bg-2: #efe7db;
  --surface: #fffcf8;
  --ink: #1c1410;
  --muted: #6b5e55;
  --line: #e6ddd2;
  --brand: #8e1b1b;
  --brand-dark: #6e1414;
  --brand-soft: #f6e6e3;
  --gold: #c4a35a;
  --green: #2f6b4f;
  --green-soft: #e5f0ea;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --warn: #9a5b12;
  --warn-soft: #fbeedc;
  --info: #1e4e8c;
  --info-soft: #e6eef8;
  --tabbar: #2a1c18;
  --radius: 16px;
  --tap: 52px;
  --shadow: 0 8px 24px rgba(28, 20, 16, 0.08);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: 58px;
  --tab-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
html { height: 100%; height: 100dvh; }
body {
  font-family: Prompt, "Noto Sans Thai", Thonburi, "Sukhumvit Set", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(142, 27, 27, 0.12); }
textarea { min-height: 110px; resize: vertical; }
label.lbl { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

#app { height: 100%; height: 100dvh; display: flex; flex-direction: column; }

/* ---- screens without tab bar ---- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: var(--safe-t);
}

.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 32px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.brand-mark {
  width: 88px; height: 88px; border-radius: 24px;
  box-shadow: var(--shadow);
  margin: 12px 0 16px;
}
.auth-wrap h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.auth-wrap .sub { color: var(--muted); margin: 6px 0 28px; text-align: center; }

.pin-dots { display: flex; gap: 14px; margin-bottom: 28px; }
.pin-dots span {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--brand);
  background: transparent;
  transition: background 0.12s;
}
.pin-dots span.on { background: var(--brand); }
.pin-dots.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(320px, 100%);
}
.pad button {
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line);
  font-size: 28px;
  font-weight: 600;
  width: 72px;
  justify-self: center;
}
.pad button:active { background: var(--brand-soft); transform: scale(0.96); }
.pad button.ghost { font-size: 15px; font-weight: 600; color: var(--muted); box-shadow: none; background: transparent; }

.staff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(400px, 100%);
}
.staff-btn {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 12px;
  min-height: 72px;
  font-weight: 600;
  font-size: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.staff-btn small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 4px; }
.staff-btn:active { transform: scale(0.98); background: var(--brand-soft); }

/* ---- app chrome ---- */
.app-frame { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-top: var(--safe-t); }
.topbar {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--brand);
  color: #fff;
  flex-shrink: 0;
}
.topbar h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .who {
  font-size: 13px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: inherit;
  flex-shrink: 0;
}
.icon-btn:active { background: rgba(255,255,255,0.15); }
.topbar .icon-btn { color: #fff; }
.icon-btn.dark { color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); }
.icon-btn svg { width: 22px; height: 22px; }

.page {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(var(--tab-h) + var(--safe-b) + 18px);
}
.page.pad-fab { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 88px); }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  background: var(--tabbar);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 20;
}
.tabbar button {
  color: rgba(255,255,255,0.62);
  font-weight: 600;
  font-size: 13px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  position: relative;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.on { color: #fff; background: rgba(255,255,255,0.1); }
.badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 28px);
  background: #e8b44c;
  color: #1c1410;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

/* ---- list helpers ---- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  margin-bottom: 10px;
}
.search input { border: 0; box-shadow: none; padding: 11px 0; background: transparent; }
.search input:focus { box-shadow: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
}
.card.tap:active { transform: scale(0.99); }

.recipe-card { display: grid; grid-template-columns: 96px 1fr; min-height: 96px; }
.recipe-card img, .recipe-card .ph {
  width: 96px; height: 100%; min-height: 96px; object-fit: cover; background: var(--bg-2);
}
.recipe-card .ph { display: grid; place-items: center; color: var(--muted); font-size: 28px; }
.recipe-card .meta { padding: 10px 12px; min-width: 0; }
.recipe-card h3 { margin: 0 0 2px; font-size: 17px; }
.recipe-card .cat { color: var(--muted); font-size: 13px; }
.recipe-card .by { color: var(--muted); font-size: 12px; margin-top: 6px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  height: 56px;
  padding: 0 18px 0 16px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(142, 27, 27, 0.35);
  z-index: 15;
}
.fab:active { transform: scale(0.97); }
.fab svg { width: 22px; height: 22px; }

/* ---- inventory ---- */
.low-box {
  background: var(--warn-soft);
  border: 1.5px solid #efd2a8;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.low-box h2 { margin: 0 0 8px; font-size: 16px; color: var(--warn); display: flex; align-items: center; gap: 8px; }
.inv-item { padding: 12px; }
.inv-item.low { background: linear-gradient(90deg, #fde8e6 0 6px, var(--surface) 6px); }
.inv-item .title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.inv-item h3 { margin: 0; font-size: 17px; flex: 1; }
.inv-item .tag { font-size: 11px; font-weight: 700; background: var(--danger-soft); color: var(--danger); padding: 3px 8px; border-radius: 999px; }
.inv-item .sub { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.inv-item .ops { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: var(--tap); height: var(--tap);
  border-radius: 14px;
  background: var(--bg-2);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}
.qty-btn:active { background: var(--brand-soft); }
.qty-read {
  min-width: 76px;
  text-align: center;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
}
.qty-read small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.btn-ask {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 0 12px;
  height: var(--tap);
  flex-shrink: 0;
  font-size: 15px;
}
.btn-ask:active { background: var(--brand-dark); }
.inv-item .foot { margin-top: 6px; font-size: 12px; color: var(--muted); }
.group-h {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- recipe detail ---- */
.hero { width: 100%; height: 240px; background: var(--bg-2); position: relative; overflow: hidden; }
.hero img { width: 100%; height: 240px; object-fit: cover; }
.hero-nav {
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.hero-nav i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); }
.hero-nav i.on { background: #fff; width: 18px; border-radius: 8px; }
.detail { padding: 16px 16px 8px; }
.detail h1 { margin: 0 0 4px; font-size: 26px; }
.detail .cat { color: var(--muted); margin-bottom: 8px; }
.detail .byline { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.block h2 { font-size: 15px; margin: 16px 0 8px; color: var(--brand); }
.block pre, .ing, .steps {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
}
.btn-row { display: flex; gap: 8px; padding: 8px 16px 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 14px;
  font-weight: 700; font-size: 16px;
}
.btn.block { width: 100%; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: 0.5; }

/* ---- photos editor ---- */
.photos-edit { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.photos-edit .shot {
  position: relative; width: 96px; height: 96px; flex-shrink: 0;
  border-radius: 12px; overflow: hidden; background: var(--bg-2);
}
.photos-edit .shot img { width: 96px; height: 96px; object-fit: cover; }
.photos-edit .shot .x {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 16px;
}
.add-photo {
  width: 96px; height: 96px; flex-shrink: 0;
  border-radius: 12px; border: 1.5px dashed var(--muted);
  display: grid; place-items: center; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--bg);
}

/* ---- orders ---- */
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.order-card { padding: 12px; }
.order-card .hd { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.order-card h3 { margin: 0; font-size: 17px; }
.order-card .qty { font-weight: 700; font-size: 18px; white-space: nowrap; }
.order-card .note { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.order-card .meta { font-size: 12px; color: var(--muted); }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 12px;
  padding: 4px;
  margin-top: 10px;
}
.seg button {
  min-height: 40px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.seg button.on.st-pending { background: #f3c56b; color: #1c1410; }
.seg button.on.st-ordered { background: #8bb7e8; color: #10233f; }
.seg button.on.st-received { background: #8dcea8; color: #143323; }
.pill {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 8px;
}
.pill.st-pending { background: var(--warn-soft); color: var(--warn); }
.pill.st-ordered { background: var(--info-soft); color: var(--info); }
.pill.st-received { background: var(--green-soft); color: var(--green); }

/* ---- settings ---- */
.settings .card { padding: 14px; }
.settings h2 { margin: 18px 0 8px; font-size: 15px; color: var(--brand); }
.list-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; }
.list-row .grow span { font-size: 12px; color: var(--muted); }
.mock-banner {
  background: #efe3c2;
  color: #5c4310;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  word-break: keep-all;
  line-height: 1.35;
}

/* ---- modal ---- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20, 12, 8, 0.45);
  z-index: 40; display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  max-height: 88dvh;
  overflow: auto;
  animation: up 0.2s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 12px; font-size: 20px; }
.grab { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--tabbar);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  z-index: 50;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
}
body.is-auth .toast { bottom: 24px; }

.back-row { display: flex; align-items: center; gap: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.form-page { padding-bottom: calc(24px + var(--safe-b)); }

.lang-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
  padding-top: calc(12px + var(--safe-t));
}
.screen { position: relative; }
.lang-toggle {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.lang-toggle button {
  min-width: 48px;
  min-height: 36px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.lang-toggle button.on {
  background: var(--brand);
  color: #fff;
}
.sub-h { margin-top: 8px; font-size: 12px; letter-spacing: 0; text-transform: none; }
.form-narrow { max-width: 640px; }
.detail-page { padding: 0 0 calc(var(--tab-h) + var(--safe-b) + 18px); }
.order-board { display: flex; flex-direction: column; gap: 4px; }
.low-grid { display: flex; flex-direction: column; gap: 10px; }
.low-grid .inv-item, .low-grid .card { margin-bottom: 0; }
.recipe-list .card { margin-bottom: 10px; }

/* ---- desktop / Mac browser, 1024px+ ---- */
@media (min-width: 1024px) {
  body {
    background: #d9cfc3;
  }
  #app {
    max-width: 1180px;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 0 1px rgba(28,20,16,0.06), 0 24px 80px rgba(28,20,16,0.14);
    position: relative;
  }
  .screen {
    padding-top: 0;
    justify-content: center;
  }
  .lang-bar { padding-top: 16px; padding-right: 24px; }
  .auth-wrap {
    max-width: 460px;
    margin: 0 auto 40px;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 36px 40px 40px;
  }
  .app-frame {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    padding-top: 0;
  }
  .mock-banner { grid-column: 1 / -1; }
  .topbar { grid-column: 1 / -1; min-height: 64px; padding: 10px 20px; }
  .topbar h1 { font-size: 22px; }
  .page {
    grid-column: 2;
    grid-row: 3;
    padding: 20px 28px 32px;
  }
  .page.pad-fab { padding-bottom: 96px; }
  .detail-page { padding: 0 0 32px; }
  .tabbar {
    position: static;
    grid-column: 1;
    grid-row: 3;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    padding: 16px 12px 24px;
    background: var(--tabbar);
  }
  .tabbar button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 52px;
    padding: 0 14px;
    font-size: 15px;
    width: 100%;
  }
  .tabbar button .badge {
    position: static;
    margin-left: auto;
  }
  .fab {
    position: absolute;
    right: 32px;
    bottom: 28px;
  }
  .toast {
    position: absolute;
    bottom: 28px;
  }
  .recipe-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .recipe-list .card { margin-bottom: 0; }
  .recipe-card { grid-template-columns: 128px 1fr; min-height: 120px; }
  .recipe-card img, .recipe-card .ph { width: 128px; min-height: 120px; }
  .hero { height: 320px; }
  .hero img { height: 320px; }
  .low-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .inv-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }
  .inv-groups .group-h { grid-column: 1 / -1; }
  .inv-groups .card { margin-bottom: 0; }
  .order-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .order-col .group-h:first-child {
    margin-top: 0;
    font-size: 15px;
    color: var(--ink);
    letter-spacing: 0.02em;
  }
  .settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
    align-items: start;
  }
  .form-narrow { margin: 0 auto; width: 100%; }
  .modal {
    max-width: 480px;
    margin: auto auto 0;
    border-radius: 20px 20px 0 0;
  }
  .modal-bg { align-items: flex-end; }
}

@media (min-width: 1280px) {
  #app { max-width: 1240px; }
  .app-frame { grid-template-columns: 240px minmax(0, 1fr); }
}

/* ---- order list (v4): every item, staff just enter quantities ---- */
.view-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 12px;
}
.view-seg button {
  min-height: 48px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 16px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.view-seg button svg { width: 20px; height: 20px; }
.view-seg button.on { background: var(--surface); color: var(--brand); box-shadow: 0 2px 8px rgba(28,20,16,0.1); }
.seg-count {
  background: #e8b44c; color: #1c1410; font-size: 12px; font-weight: 700;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
}
.chip.big { padding: 11px 18px; font-size: 15px; }
.page.pad-send { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 104px); }
.oq-card { padding: 0; }
.oq-group .group-h { margin-top: 14px; }
.oq-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.oq-row:last-child { border-bottom: 0; }
.oq-row.has-qty { background: #fff4e0; box-shadow: inset 5px 0 0 var(--brand); }
.oq-info { flex: 1; min-width: 0; cursor: pointer; }
.oq-name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.oq-name .tag { font-size: 11px; font-weight: 700; background: var(--danger-soft); color: var(--danger); padding: 2px 7px; border-radius: 999px; vertical-align: 2px; }
.oq-unit { color: var(--muted); font-size: 13px; margin-top: 2px; }
.oq-pend { color: var(--info); font-size: 12px; font-weight: 600; margin-top: 2px; }
.oq-step { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.oq-btn {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--bg-2);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  touch-action: manipulation;
}
.oq-btn.plus { background: var(--brand); color: #fff; }
.oq-btn:active { transform: scale(0.94); }
.oq-input {
  width: 58px; height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 12px;
}
.oq-row:not(.has-qty) .oq-input { color: var(--muted); }
.add-to-list { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; }
.add-to-list svg { width: 20px; height: 20px; }
.send-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + var(--safe-b) + 10px);
  display: flex;
  gap: 8px;
  z-index: 16;
}
.send-btn {
  flex: 1;
  min-height: 60px;
  border-radius: 18px;
  background: #b9aca0;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(28, 20, 16, 0.2);
}
.send-btn.ready { background: var(--green); box-shadow: 0 10px 24px rgba(47, 107, 79, 0.35); }
.send-btn.ready:active { transform: scale(0.98); }
.send-clear {
  min-height: 60px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.app-frame:has(.send-bar) ~ .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
.sent-box {
  background: #e7f3ec;
  border: 1.5px solid #b9dcc8;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.sent-box h2 { margin: 0 0 4px; color: var(--green); font-size: 18px; }
.sent-box p { margin: 0 0 8px; }
.sent-box ul { list-style: none; margin: 0 0 12px; padding: 0; }
.sent-box li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #b9dcc8; font-size: 15px; }
.sent-box li:last-child { border-bottom: 0; }
.sent-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (min-width: 1024px) {
  .page.pad-send { padding-bottom: 110px; }
  .view-seg { max-width: 460px; }
  .oq-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
    align-items: start;
  }
  .send-bar {
    position: absolute;
    left: auto;
    right: 32px;
    bottom: 24px;
    width: 420px;
  }
  .app-frame:has(.send-bar) ~ .toast { bottom: 100px; }
  .add-to-list { max-width: 420px; }
}

/* ---- v7: stock-check banner ---- */
.badge.alert { background: #e5484d; color: #fff; }
.check-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(135deg, #fff3d6, #ffe4b8);
  border: 2px solid #e8b44c;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(154, 91, 18, 0.18);
}
.check-banner .cb-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  animation: ring 1.6s ease-in-out 2;
}
@keyframes ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } }
.check-banner .cb-text { flex: 1; min-width: 0; }
.check-banner h2 { margin: 0 0 2px; font-size: 18px; color: #6b3a05; }
.check-banner p { margin: 0 0 10px; font-size: 14px; color: #6b4a1c; }
.cb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.check-banner .btn { min-height: 44px; padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.check-banner .cb-go { background: var(--brand); color: #fff; }
.check-banner .cb-done { background: #fffaf0; color: #6b3a05; border: 1.5px solid #e8b44c; }

/* ---- v7: settings bits ---- */
.small { font-size: 12.5px; }
.days-line { display: block; color: var(--green) !important; font-weight: 600; }
.days-line.none { color: var(--muted) !important; font-weight: 400; }
.warn-note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-picker .day {
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.day-picker .day.on { background: var(--green); border-color: var(--green); color: #fff; }
.time-row { display: flex; gap: 8px; align-items: center; }
.time-row input { max-width: 180px; }
.chat-lang button { letter-spacing: 0; min-width: 0; padding: 6px 12px; }

/* ---- v7: chat ---- */
.chat-page { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 86px); background: #fbf8f4; }
.chat-langbar {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); font-weight: 600;
  margin-bottom: 10px;
}
.chat-langbar svg { width: 18px; height: 18px; flex-shrink: 0; }
.chat-langbar span { flex: 1; }
.msgs { display: flex; flex-direction: column; gap: 2px; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); font-weight: 600; margin: 10px 0 6px; }
.msg { display: flex; flex-direction: column; max-width: 80%; margin-bottom: 6px; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-name { font-size: 12px; font-weight: 700; color: var(--muted); margin: 4px 0 2px 12px; }
.bubble {
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 16px;
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg-orig, .msg-text { white-space: pre-wrap; }
.msg.theirs .bubble { background: #e9e5e0; color: var(--ink); border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: #1f7aec; color: #fff; border-bottom-right-radius: 6px; }
.msg-orig {
  font-size: 13px;
  line-height: 1.3;
  color: #8a8079;
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.msg.mine .msg-orig { color: rgba(255,255,255,0.72); border-bottom-color: rgba(255,255,255,0.25); }
.msg-text { font-size: 16px; }
.msg-text.pending { opacity: 0.6; font-style: italic; }
.msg-text.failed { opacity: 0.7; font-size: 13px; }
.msg-time { font-size: 11px; color: var(--muted); margin: 2px 10px 0; }
.msg-photo img { max-width: 220px; max-height: 260px; border-radius: 14px; margin: 2px 0 6px; object-fit: cover; }
.composer {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  z-index: 16;
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 22px;
  resize: none;
  line-height: 1.3;
}
.composer-cam { width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.composer-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.composer-send:disabled { opacity: 0.5; }
.composer-send svg { width: 20px; height: 20px; }
.composer-photo { position: relative; display: inline-block; margin: 0 0 8px 52px; }
.composer-photo img { height: 72px; border-radius: 10px; }
.composer-photo .x {
  position: absolute; top: -8px; right: -8px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 16px; line-height: 1;
}
.app-frame.chat-frame ~ .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 80px); }

@media (min-width: 1024px) {
  .chat-page { padding-bottom: 100px; }
  .composer { position: absolute; left: 220px; right: 0; bottom: 0; padding: 12px 28px; }
  .msg { max-width: 60%; }
}
