/* Staff page — big, calm, one thing per screen. */
:root {
  --petal: #f7e8e6;
  --linen: #fffaf7;     /* page */
  --card: #ffffff;
  --ink: #4a2433;
  --muted: #745461;
  --line: #e6c9cc;
  --rose: #ff66c4;
  --rose-deep: #a8346b;
  --green: #2f6b3a;
  --green-bg: #e3efdf;
  --amber-bg: #f8e6cf;
  --red: #a3261f;
  --gold: #c2a06b;
  --text: "Amiri", "Noto Naskh Arabic", serif;
  --display: "Aref Ruqaa", "Amiri", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--linen); color: var(--ink); font: 400 22px/1.8 var(--text); overflow-x: clip; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--rose-deep); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.demo-banner { padding: 8px 16px; background: var(--amber-bg); text-align: center; font-size: 16px; }

/* buttons */
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px; padding: 0 20px;
  background: var(--rose-deep); color: #fff; border: 0; border-radius: 999px;
  font-size: 22px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.big-btn:active { transform: translateY(1px); }
.big-btn:disabled { opacity: .55; }
.big-btn.green { background: var(--green); }
.big-btn.plain { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.link-btn { background: none; border: 0; padding: 12px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 5px; cursor: pointer; font-size: 19px; }
.link-btn.danger { color: var(--red); }

/* login */
.login { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.login-logo { width: 230px; margin: 0 auto 8px; mix-blend-mode: multiply; }
.login h1 { margin: 0 0 24px; text-align: center; font: 400 44px/1.4 var(--display); color: var(--rose-deep); }

/* forms */
label, .field { display: block; margin-bottom: 20px; font-weight: 500; }
.hint { display: block; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1.55; }
input, textarea, select {
  display: block; width: 100%; margin-top: 8px;
  min-height: 58px; padding: 12px 16px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px; font-size: 20px; font-weight: 400;
}
textarea { min-height: 110px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--rose-deep); }
.money { display: block; position: relative; }
.money input { padding-inline-end: 64px; }
.money::after { content: "ريال"; position: absolute; inset-inline-end: 16px; bottom: 14px; color: var(--muted); font-weight: 400; }

.msg { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; font-size: 18px; }
.msg.error { background: #fbe4e2; color: #8c1d18; }

/* app shell */
.app { min-height: 100vh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.bar {
  position: sticky; top: 0; z-index: 5; background: var(--petal);
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 20px 6px; border-bottom: 1px solid var(--line);
}
.bar h1 { margin: 0; font: 400 36px/1.4 var(--display); }
.hello { color: var(--muted); font-size: 19px; }
.content { max-width: 720px; margin: 0 auto; padding: 18px 18px 32px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar button {
  position: relative; display: grid; justify-items: center; gap: 2px;
  min-height: 82px; padding: 10px 2px 8px;
  background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1.3; cursor: pointer;
}
.tabbar svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--rose-deep); font-weight: 600; }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; inset-inline: 28%; height: 4px; border-radius: 0 0 4px 4px; background: var(--rose-deep);
}
.dot { position: absolute; top: 8px; inset-inline-start: calc(50% + 14px); width: 12px; height: 12px; border-radius: 50%; background: var(--rose); }

/* filter chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 48px; padding: 0 18px;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  font-size: 18px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--linen); border-color: var(--ink); }
.chip .n { margin-inline-start: 6px; font-weight: 600; }

/* order card */
.order { margin-bottom: 18px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-no { font: 700 28px/1 var(--text); }
.pill { padding: 4px 14px; border-radius: 999px; font-size: 18px; font-weight: 500; white-space: nowrap; }
.pill.paid { background: var(--green-bg); color: var(--green); }
.pill.preparing, .pill.shipped { background: var(--amber-bg); color: #6b4a0f; }
.pill.delivered { background: #e8e2da; color: var(--muted); }
.pill.awaiting_payment, .pill.cancelled { background: #eee; color: #666; }
.when { margin: 4px 0 12px; color: var(--muted); font-size: 18px; }
.who { font-size: 21px; font-weight: 600; }
.where { margin: 2px 0 12px; }
.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.contact-row a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; border-radius: 14px; border: 2px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.contact-row a.wa { border-color: #b9d9bd; background: #eef7ef; }
.items { margin: 0 0 4px; padding: 12px 0 0; list-style: none; border-top: 1px dashed var(--line); }
.items li, .sum { display: flex; justify-content: space-between; gap: 12px; }
.items .x { color: var(--muted); }
.sum { padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--line); font-weight: 600; }
.note { margin: 10px 0 0; padding: 10px 14px; background: var(--amber-bg); border-radius: 12px; font-size: 17px; }
.order .big-btn { margin-top: 16px; }
.order .link-btn { display: block; margin: 6px auto 0; }

.empty { padding: 40px 10px; text-align: center; color: var(--muted); }

/* product list */
.prod {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center;
  width: 100%; margin-bottom: 14px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  text-align: start; cursor: pointer;
}
.prod img, .prod .noimg { width: 76px; height: 100px; object-fit: cover; object-position: top; border-radius: 10px; background: var(--petal); }
.prod-name { font-weight: 600; line-height: 1.4; }
.prod-meta { color: var(--muted); font-size: 19px; line-height: 1.6; }
.prod-meta .out { color: var(--red); font-weight: 600; }
.prod .edit { color: var(--rose-deep); font-weight: 500; }
.prod.hidden-p { opacity: .6; }
.tag { display: inline-block; margin-inline-start: 6px; padding: 0 8px; border-radius: 8px; background: #eee; font-size: 14px; font-weight: 500; }

/* product edit */
.photos { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.photo { position: relative; width: 96px; height: 128px; }
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 12px; }
.photo button {
  position: absolute; top: -8px; inset-inline-start: -8px;
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--card);
  background: var(--ink); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.photo .first { position: absolute; bottom: 6px; inset-inline-start: 6px; padding: 0 8px; border-radius: 8px; background: rgb(255 255 255 / .92); font-size: 15px; }
.add-photo {
  width: 96px; height: 128px; border: 2px dashed var(--line); border-radius: 12px;
  background: var(--card); color: var(--muted); font-size: 16px; line-height: 1.4; cursor: pointer;
}

.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 10px; margin-top: 8px; }
.stepper button { min-height: 58px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 30px; line-height: 1; cursor: pointer; }
.stepper input { margin: 0; text-align: center; font-size: 24px; font-weight: 600; }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 10px 16px; margin-bottom: 20px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; cursor: pointer;
}
.switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 62px; min-height: 0; height: 36px; margin: 0; padding: 0; border-radius: 18px; border: 0; background: #cbbfae; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: right .15s ease; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { right: 30px; }

.actions { display: grid; gap: 12px; margin-top: 8px; }
.top-actions { display: grid; gap: 10px; margin-bottom: 18px; }

.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 14px 24px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 20px;
  width: max-content; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* =====================================================================
   v3: guidance, step cards, sizes, stock count, numbers, confirm box
   ===================================================================== */
.guide {
  margin: 0 0 20px; padding: 14px 18px;
  background: var(--petal); border-inline-start: 4px solid var(--gold); border-radius: 12px;
  font-size: 20px; line-height: 1.7;
}
.login .guide { margin-bottom: 24px; }
.step-help { margin: 16px 0 0; color: var(--muted); font-size: 18px; text-align: center; }
.order .step-help + .big-btn { margin-top: 8px; }
.size-tag { display: inline-block; padding: 0 10px; border-radius: 8px; background: var(--amber-bg); font-size: 17px; font-weight: 700; }

/* add/edit piece: one card per step */
.step-card {
  margin-bottom: 22px; padding: 18px 18px 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
}
.step-card h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font: 700 24px/1.4 var(--text); }
.num {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 2px solid var(--gold); border-radius: 50%; color: var(--rose-deep); font-size: 22px;
}
.step-card > .hint { margin: -6px 0 10px; }

/* free size / sized choice */
.mode { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
.mode-opt { margin: 0; }
.mode-opt { position: relative; }
.mode-opt input { position: absolute; inset: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.mode-opt span {
  display: grid; place-items: center; min-height: 84px; padding: 10px; text-align: center;
  border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font-weight: 700; line-height: 1.4;
}
.mode-opt small { display: block; font-weight: 400; font-size: 16px; color: var(--muted); }
.mode-opt input:checked + span { border-color: var(--rose-deep); background: #fbeef3; box-shadow: inset 0 0 0 1px var(--rose-deep); }
.mode-opt input:focus-visible + span { outline: 3px solid var(--rose-deep); outline-offset: 3px; }

.size-rows { display: grid; gap: 12px; margin: 10px 0 18px; }
.size-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 48px; gap: 10px; align-items: center; }
.size-name { font-weight: 700; font-size: 22px; }
.size-row .stepper { margin: 0; }
.size-del {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: #fff;
  color: var(--red); font-size: 20px; cursor: pointer;
}
.preset-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; }
.preset-row .chip { direction: ltr; }
.add-size { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.add-size input { margin: 0; }
.add-size .big-btn { width: auto; min-height: 58px; padding: 0 22px; }
.big-btn.small { min-height: 52px; font-size: 19px; width: auto; padding: 0 16px; }
.switch > span small { display: block; margin-top: 2px; }
.empty.small { padding: 12px 0; }

/* categories */
.cat-list { display: grid; gap: 12px; margin-bottom: 20px; }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 48px; gap: 10px; align-items: center; }
.cat-row input { margin: 0; }

/* stock count */
.stock-sum { margin: 0 0 14px; font-size: 20px; text-align: center; }
.stock-sum b { font-size: 34px; color: var(--rose-deep); margin-inline-end: 6px; }
.stock-item {
  display: grid; grid-template-columns: 70px 1fr; gap: 14px; align-items: start;
  margin-bottom: 14px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.stock-item img, .stock-item .noimg { width: 70px; height: 92px; object-fit: cover; object-position: top; border-radius: 10px; background: var(--petal); }
.stock-body .prod-name { margin-bottom: 6px; }
.stock-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.stock-line + .stock-line { border-top: 1px dashed var(--line); }
.stock-line .size-name { font-size: 19px; font-weight: 400; }
.stepper.small { grid-template-columns: 56px 64px 56px; margin: 0; }
.stepper.small button { min-height: 52px; font-size: 26px; }
.stepper output { display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.stepper output.zero { color: var(--red); }
.stepper output.flash { animation: flash .6s ease; }
@keyframes flash { 0% { background: #e3efdf; border-radius: 10px; } 100% { background: transparent; } }

/* numbers */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.stat { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.stat.big { grid-column: 1 / -1; background: #fbeef3; border-color: #ecc9d8; }
.stat .label { display: block; color: var(--muted); font-size: 19px; }
.stat b { display: block; font-size: 32px; line-height: 1.3; color: var(--ink); }
.stat.big b { font-size: 42px; color: var(--rose-deep); }
.stat.warn { background: var(--amber-bg); border-color: #ead2a4; }
.stat .up, .stat .down { display: block; font-size: 18px; font-weight: 700; }
.stat .up { color: var(--green); } .stat .down { color: var(--red); }
.stat .link-btn { padding: 4px 0 0; }
.panel { margin-bottom: 18px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.panel h2 { margin: 0 0 12px; font: 700 23px/1.4 var(--text); }
.panel h2 small { font-weight: 400; font-size: 17px; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 190px; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; justify-items: center; align-items: end; }
.bar-col .n { font-size: 17px; font-weight: 700; }
.vbar { width: 70%; min-height: 4px; background: var(--rose-deep); border-radius: 8px 8px 2px 2px; align-self: end; }
.bar-col .d { font-size: 15px; color: var(--muted); }
.rank { margin: 0; padding: 0; list-style: none; }
.rank li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank b.out { color: var(--red); }
ol.rank { counter-reset: r; }
ol.rank li span::before { counter-increment: r; content: counter(r) ". "; color: var(--gold); font-weight: 700; }
.panel .big-btn { margin-top: 12px; }

/* big Arabic confirm box */
.ask {
  width: min(460px, calc(100vw - 32px)); padding: 26px 22px 22px;
  border: 0; border-radius: 24px; background: var(--card); color: var(--ink); text-align: center;
}
.ask::backdrop { background: rgb(74 36 51 / .45); }
.ask h2 { margin: 0 0 8px; font: 700 26px/1.5 var(--text); }
.ask p { margin: 0 0 20px; color: var(--muted); font-size: 20px; }
.ask-actions { display: grid; gap: 12px; }
.big-btn.danger { background: var(--red); }

@media (max-width: 380px) {
  .tabbar button { font-size: 15px; }
  .stat b { font-size: 27px; }
  .size-row { grid-template-columns: 60px 1fr 44px; }
}

input, select, textarea { min-width: 0; }
.size-row .size-name { overflow-wrap: anywhere; }

/* size rows: keep the number readable on small phones */
.size-row { grid-template-columns: 56px minmax(0, 1fr) 44px; gap: 8px; }
.size-row .stepper { grid-template-columns: 50px minmax(64px, 1fr) 50px; gap: 6px; }
.size-row .stepper input { padding: 8px 4px; font-size: 24px; }
.size-row .size-del { width: 44px; height: 44px; }
.stock-line .size-name { white-space: nowrap; }
.stat b { overflow-wrap: anywhere; }

.guide a { color: var(--rose-deep); font-weight: 700; white-space: nowrap; }

/* ===== v4: one-of-a-kind pieces, price-only editing ===== */
.piece-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.piece {
  display: grid; gap: 4px; justify-items: center; text-align: center;
  padding: 10px 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; cursor: pointer;
}
.piece img, .piece .noimg { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: center 12%; border-radius: 999px 999px 10px 10px; background: var(--petal); }
.piece-name { margin-top: 6px; font-weight: 700; font-size: 20px; line-height: 1.4; }
.piece-price { font-size: 22px; color: var(--rose-deep); font-weight: 700; }
.piece-edit { color: var(--muted); font-size: 18px; text-decoration: underline; text-underline-offset: 4px; }

.price-card { text-align: center; margin-bottom: 18px; }
.price-card img { width: min(220px, 60vw); aspect-ratio: 3 / 4; object-fit: cover; object-position: center 12%; margin: 0 auto 10px; border-radius: 999px 999px 12px 12px; outline: 1px solid var(--gold); outline-offset: 5px; }
.price-card h2 { margin: 8px 0 0; font: 400 32px/1.4 var(--display); }
.price-now { margin: 4px 0 0; font-size: 22px; }
.price-now b { color: var(--rose-deep); }
#priceForm .money input { font-size: 30px; font-weight: 700; text-align: center; min-height: 70px; }
.sold-box { margin-top: 34px; padding-top: 18px; border-top: 1px dashed var(--line); text-align: center; }
.sold-box .hint { margin-bottom: 10px; }
.help-link { text-align: center; margin: 16px 0 0; }
.help-link a { color: var(--rose-deep); font-size: 20px; }
.stat.big-ish { grid-column: 1 / -1; }
#logout { display: block; margin: 20px auto 0; }
.price-card img { width: min(150px, 42vw); }
.price-card h2 { font-size: 28px; }

/* ===== new piece ===== */
.cat-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cat-pick .mode-opt span { min-height: 70px; font-size: 21px; }
.opt-label { font-weight: 400; font-size: 17px; color: var(--muted); }
#addPhotos .add-photo { width: 120px; height: 160px; font-size: 18px; }
#addPhotos .photo { width: 120px; height: 160px; }
