:root {
  color-scheme: light;
  --page: #eef3f1;
  --ink: #10211e;
  --muted: #5c6f6b;
  --line: #d7e4e0;
  --teal: #0f766e;
  --deep: #083f3b;
  --card: rgba(255, 255, 255, 0.92);
  --rose: #fff1f2;
  --rose-ink: #be123c;
  --shadow: 0 18px 50px rgba(16, 46, 42, 0.08);
  --font: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --num: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(45, 212, 191, 0.28), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(167, 139, 250, 0.22), transparent 50%),
    var(--page);
  color: var(--ink);
  font-family: var(--font);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-family: var(--num); letter-spacing: -0.03em; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  padding: 26px 22px 22px;
  box-shadow: 0 30px 80px rgba(15, 46, 42, 0.12);
  backdrop-filter: blur(16px);
}
.logo-row { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center; color: white; background: linear-gradient(160deg, #14b8a6, #0f766e);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
}
.logo-row h1 { margin: 0; font-size: 28px; letter-spacing: -0.04em; }
.logo-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.lang {
  border: 1px solid var(--line); background: white; color: var(--muted);
  border-radius: 999px; padding: 7px 12px;
}
.lang.is-on { background: var(--teal); border-color: var(--teal); color: white; font-weight: 700; }
.login-card h2 { margin: 8px 0 6px; font-size: 30px; letter-spacing: -0.03em; }
.sub { margin: 0 0 8px; color: var(--muted); line-height: 1.55; }
.points { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.points li { display: flex; gap: 8px; align-items: center; color: var(--deep); font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #14b8a6; flex: none; }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
input, .search input, .count input {
  width: 100%; height: 52px; border-radius: 16px; border: 1px solid var(--line);
  background: white; padding: 0 14px; outline: none;
}
input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12); }
.field { position: relative; }
.field input { padding-inline-end: 92px; }
.eye {
  position: absolute; inset-inline-end: 8px; top: 8px; height: 36px;
  border: 0; border-radius: 12px; background: var(--page); color: var(--teal);
  padding: 0 12px; font-size: 13px; font-weight: 700;
}
.primary, .rose, .soft, .chip {
  border: 0; border-radius: 16px; font-weight: 700;
}
.primary { width: 100%; height: 52px; margin-top: 16px; background: var(--teal); color: white; }
.primary:disabled { opacity: 0.65; }
.error, .status { min-height: 1.2em; margin: 10px 0 0; color: var(--rose-ink); font-size: 14px; }
.status.ok { color: var(--teal); }

.app { width: min(1080px, 100%); margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 14px 96px; }
.topbar, .hello-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.who { min-width: 0; }
.who strong { display: block; font-size: 18px; }
.who span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .langs { margin: 0; }
.rose, .soft { height: 40px; padding: 0 12px; background: white; border: 1px solid var(--line); }
.rose { background: var(--rose); color: var(--rose-ink); border-color: #fecdd3; }
.tabs {
  display: flex; gap: 8px; overflow-x: auto; margin: 14px 0;
  position: sticky; top: 0; z-index: 4; padding: 8px 0;
  background: linear-gradient(var(--page), rgba(238, 243, 241, 0.92));
}
.tab {
  border: 0; background: white; color: var(--muted); border-radius: 999px;
  padding: 10px 14px; white-space: nowrap; box-shadow: var(--shadow);
}
.tab.is-on { background: var(--deep); color: white; }
.range { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.range label { margin: 0 0 4px; }
.range input { height: 42px; width: 148px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 12px; background: white; color: var(--deep); border: 1px solid var(--line); }
.chip.is-on { background: #d7f5ef; border-color: #99f6e4; }
.hero {
  background: linear-gradient(145deg, #115e59, #0f766e 58%, #149185);
  color: white; border-radius: 28px; padding: 20px; margin-bottom: 12px;
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
}
.hero span { opacity: 0.86; font-size: 14px; }
.hero strong { display: block; margin-top: 6px; font-size: 40px; font-weight: 800; }
.hero em { display: block; margin-top: 4px; font-style: normal; color: #ccfbf1; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat, .item, .debt {
  background: white; border-radius: 22px; padding: 14px; box-shadow: var(--shadow);
}
.stat .label, .muted { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 6px; font-size: 22px; font-weight: 800; }
.search { margin: 4px 0 12px; }
.list { display: grid; gap: 10px; }
.item { display: grid; gap: 8px; }
.item h3, .debt h3 { margin: 0; font-size: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: #f3f7f6; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--deep);
}
.pill.warn { background: #ffedd5; color: #c2410c; }
.pill.bad { background: #ffe4e6; color: #be123c; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price { background: #f6faf9; border-radius: 14px; padding: 8px 10px; }
.price span { display: block; color: var(--muted); font-size: 12px; }
.price strong { font-size: 16px; }
.count-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.count-row input { height: 46px; }
.savebar {
  position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: white; border-radius: 18px; padding: 10px; box-shadow: 0 12px 30px rgba(16, 46, 42, 0.16);
}
.savebar .primary { margin: 0; width: auto; flex: 1; height: 46px; }
.section-title { margin: 16px 2px 8px; font-size: 15px; }
.invoice { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.invoice strong { font-size: 15px; }
.empty-note { color: var(--muted); text-align: center; padding: 28px 8px; }
.skeleton { height: 22px; border-radius: 8px; background: linear-gradient(90deg, #e7eeeb, #f7faf9, #e7eeeb); background-size: 200% 100%; animation: shine 1.1s linear infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (min-width: 800px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .goods { grid-template-columns: repeat(4, 1fr); }
  .hero strong { font-size: 48px; }
}
@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero strong { font-size: 34px; }
}

.back {
  border: 0; background: white; border-radius: 14px; height: 40px; padding: 0 12px;
  color: var(--deep); font-weight: 700;
}
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  min-height: 92px; border: 0; border-radius: 22px; background: white;
  box-shadow: var(--shadow); padding: 14px; text-align: start; font-weight: 700; font-size: 16px;
}
.goods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.good {
  background: white;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid transparent;
}
.good.is-picked { border-color: #99f6e4; box-shadow: 0 12px 28px rgba(15, 118, 110, 0.16); }
.photo, .ph {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: linear-gradient(160deg, #d7f5ef, #eef3f1);
  display: block;
}
.ph {
  display: grid;
  place-items: center;
  color: var(--teal);
  font-size: 34px;
  font-weight: 800;
}
.good-body { padding: 10px 10px 12px; display: grid; gap: 6px; }
.good-body h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  min-height: 2.7em;
}
.good-body > strong { color: var(--teal); font-size: 16px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stepper strong { min-width: 1.2em; text-align: center; font-size: 18px; }
.stepper button {
  width: 42px; height: 42px; border: 0; border-radius: 14px;
  background: #0f766e; color: white; font-size: 24px; font-weight: 700;
  touch-action: manipulation;
}
.stepper button[data-minus] { background: #e7f3f0; color: var(--deep); }
.goods, .good, .stepper, .cartbar, .cartbar button, .tab, .tile, .back {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.cartbar {
  position: sticky; bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--deep); color: white; border-radius: 20px; padding: 12px 14px;
  box-shadow: 0 16px 30px rgba(8, 63, 59, 0.28);
}
.cartbar button { border: 0; border-radius: 14px; background: white; color: var(--deep); font-weight: 700; height: 40px; padding: 0 14px; }
.banner { margin: 0 0 10px; color: #9a3412; background: #ffedd5; border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.buyer {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  text-align: start;
  border: 1px solid transparent;
}
.buyer-copy { display: grid; gap: 3px; min-width: 0; }
.buyer-copy h3 { font-size: 17px; }
.avatar {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #2dd4bf, #0f766e);
  color: white; font-weight: 800; font-size: 20px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}
.place { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.pin {
  width: 12px; height: 12px; margin-top: 3px; flex: none;
  background: #0f766e;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}
.tile { position: relative; overflow: hidden; }
.tile::before {
  content: "";
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(#2dd4bf, #0f766e);
}
.item { border: 1px solid rgba(15, 118, 110, 0.08); }
.add-buyer, .text-btn {
  width: 100%; border: 1.5px dashed #99f6e4; background: white; color: var(--teal);
  border-radius: 22px; min-height: 64px; font-weight: 800; margin-bottom: 12px;
}
.text-btn { width: auto; min-height: 36px; border-radius: 999px; padding: 0 12px; margin: 0; border-style: solid; }
.panel {
  background: white; border-radius: 24px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 4px;
}
.hint-card {
  background: #f0fdfa; color: var(--deep); border-radius: 18px; padding: 12px 14px; margin: 0 0 12px; line-height: 1.5;
}
.line-step { margin-top: 8px; max-width: 168px; }
.demand-row { display: grid; gap: 8px; }
.demand-row .soft { width: 100%; }
button.item { width: 100%; text-align: start; }
.buyer-chip {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: white; border-radius: 22px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.buyer-chip .soft { flex: none; }

#stage, #view {
  display: grid;
  gap: 16px;
  align-content: start;
}
#cartSlot:empty { display: none; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 4px 0 2px;
}
.page-copy { flex: 1 1 180px; min-width: 0; display: grid; gap: 6px; }
.page-copy .muted, .page-copy p { margin: 0; }
.page-head .section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.page-head .text-btn { margin-inline-start: auto; flex: none; }
.search, .hero, .hint-card, .banner, .buyer-chip, .add-buyer, .section-title, .range { margin: 0; }
.back {
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(16, 46, 42, 0.05);
}
.tab {
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.tab.is-on {
  background: linear-gradient(160deg, #0f766e, #115e59);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.28);
}
.tiles { gap: 12px; }
.tile { min-height: 108px; padding: 16px 16px 16px 18px; }
.goods { gap: 14px; }
.good { border-radius: 24px; }
.search input, .panel input {
  box-shadow: 0 8px 22px rgba(16, 46, 42, 0.04);
}
.text-btn {
  min-height: 40px;
  padding: 0 14px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.08);
}
.stat, .item, .debt {
  border: 1px solid rgba(15, 118, 110, 0.08);
}
.hero { border-radius: 30px; }
.savebar, .cartbar { margin-bottom: env(safe-area-inset-bottom); }
