/* ---- myPharma theme (colours sampled from the logo) ---- */
:root {
  --blue: #2B3990;        /* logo blue */
  --blue-dark: #1B2569;
  --green: #00A550;       /* logo green */
  --green-dark: #008a43;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #22263a;
  --muted: #7b809a;
  --line: #e7eaf3;
  --red: #e34848;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(34, 42, 90, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: #e9ecf4;
  color: var(--text);
  font-size: 15px;
}

/* App shell — phone-like column, comfortable on desktop too */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 24px rgba(0,0,0,.08);
}

.hidden { display: none !important; }

/* forgot-password steps */
.steps { display: flex; justify-content: center; gap: 7px; margin: -6px 0 16px; }
.stepdot {
  width: 26px; height: 4px; border-radius: 2px; background: var(--line);
  transition: background .2s;
}
.stepdot.on { background: var(--green); }
input.otp {
  text-align: center; letter-spacing: .5em; font-size: 22px;
  font-weight: 700; padding-left: .5em;
}
.btn.outline {
  background: #fff; color: var(--blue); border: 1px solid var(--line);
}
.btn.outline:disabled { color: var(--muted); cursor: not-allowed; }
.mt { margin-top: 10px; }

/* order progress (customer view) */
.progress { display: flex; gap: 2px; margin: 10px 0 12px; }
.pstep { flex: 1; text-align: center; position: relative; }
.pstep::before {
  content: ""; position: absolute; top: 5px; left: -50%; width: 100%;
  height: 2px; background: var(--line);
}
.pstep:first-child::before { display: none; }
.pstep.done::before, .pstep.current::before { background: var(--green); }
.pdot {
  display: block; width: 12px; height: 12px; border-radius: 50%;
  margin: 0 auto 4px; background: #fff; border: 2px solid var(--line);
  position: relative; z-index: 1;
}
.pstep.done .pdot { background: var(--green); border-color: var(--green); }
.pstep.current .pdot {
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,165,80,.18);
}
.plabel { font-size: 9.5px; color: var(--muted); line-height: 1.1; display: block; }
.pstep.done .plabel, .pstep.current .plabel { color: var(--text); font-weight: 600; }

/* status chips for the new fulfilment stages */
.chip.packed { background: #e6eefc; color: #2452a8; }
.chip.dispatched { background: #ddeefb; color: #1c6a99; }
.chip.out_for_delivery { background: #d9f2ee; color: #0b6b63; }
.chip.partially_delivered { background: #fff1e0; color: #a0561a; }

/* cascading address selects */
.field select {
  width: 100%; padding: 12px 14px; font-family: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237b809a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field select:disabled { background-color: #f4f6fb; color: var(--muted); }
.field select:focus { outline: none; border-color: var(--blue); }

/* filter row (orders/invoices) */
.filter-row { display: flex; gap: 8px; padding: 0 14px 10px; }
.filter-row select {
  flex: 1; padding: 9px 10px; font-family: inherit; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text);
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 34px; cursor: pointer; }
.icon-btn {
  position: relative;
  background: none; border: none; color: var(--blue);
  cursor: pointer; padding: 6px;
}
.dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
}

/* ---- Main view ---- */
#view { flex: 1; padding: 16px 16px 90px; }

/* ---- Bottom navigation ---- */
.bottomnav {
  position: fixed; bottom: 0; z-index: 20;
  width: 100%; max-width: 520px;
  left: 50%; transform: translateX(-50%);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav button {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; position: relative; padding: 4px 0;
}
.bottomnav button.active { color: var(--green); font-weight: 600; }
.badge {
  position: absolute; top: -2px; right: 22%;
  background: var(--red); color: #fff; font-style: normal;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---- Cards & general ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.section-title {
  font-size: 15px; font-weight: 700; color: var(--blue-dark);
  margin: 18px 0 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.section-title a { font-size: 12.5px; color: var(--green); text-decoration: none; font-weight: 600; }
.muted { color: var(--muted); font-size: 12.5px; }
.center { text-align: center; }
.mt { margin-top: 14px; }

/* ---- Forms ---- */
.field { margin-bottom: 12px; position: relative; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfe; font-size: 14.5px; color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); background: #fff; }
.eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted);
}
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.check input { width: auto; }

.btn {
  display: block; width: 100%;
  background: var(--green); color: #fff;
  border: none; border-radius: 10px;
  padding: 13px; font-size: 15.5px; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.blue { background: var(--blue); }
.btn.blue:hover { background: var(--blue-dark); }
.btn.outline { background: none; border: 1.5px solid var(--blue); color: var(--blue); }
.btn.danger { background: var(--red); }
.btn.small { width: auto; padding: 8px 16px; font-size: 13px; display: inline-block; }

.auth-wrap { padding: 40px 8px 20px; }
.auth-logo { display: block; margin: 0 auto 8px; height: 64px; }
.auth-tag { text-align: center; color: var(--blue); font-weight: 600; margin-bottom: 26px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 14px; }
.auth-links a { color: var(--blue); text-decoration: none; display: block; margin-bottom: 10px; font-weight: 600; }
.auth-links a.green { color: var(--green); }

/* typeahead */
.suggest {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  max-height: 210px; overflow: auto; box-shadow: 0 8px 18px rgba(0,0,0,.1);
}
.suggest div { padding: 10px 14px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.suggest div:hover { background: var(--bg); }

/* ---- Search row ---- */
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row input { flex: 1; min-width: 0; }
.search-row .btn { width: auto; padding: 0 16px; }

/* ---- Product cards ---- */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 460px) { .pgrid.wide { grid-template-columns: 1fr 1fr; } }
.pcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; position: relative; display: flex; flex-direction: column;
}
.pcard .disc {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 7px;
}
.pcard .heart {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: none; border: none; cursor: pointer; font-size: 20px; color: #cfd3e4;
}
.pcard .heart.on { color: var(--red); }
.pimg {
  height: 92px; border-radius: 10px; background: #eef1f9;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 10px; overflow: hidden;
}
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pname { font-size: 13.5px; font-weight: 700; line-height: 1.3; min-height: 35px; }
.pcompany { font-size: 12px; color: var(--muted); margin: 3px 0 6px; }
.prices { margin-bottom: 10px; }
.prices s { color: var(--muted); font-size: 12px; margin-right: 6px; }
.prices b { color: var(--blue); font-size: 15px; }
.btn-add {
  margin-top: auto;
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 8px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn-add:hover { background: var(--blue-dark); }

/* ---- Offer cards ---- */
/* ---- Offers slider ----
   One offer per screen, snapped. The old side-by-side scroll left cards
   half-cut on a phone, which read as broken rather than scrollable. */
.slider { position: relative; margin-bottom: 4px; }
.slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;              /* Firefox */
}
.slides::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;           /* never skip two offers in one swipe */
  padding: 0 14px;
  box-sizing: border-box;
}
.dots { display: flex; justify-content: center; gap: 7px; padding: 10px 0 2px; }
.dot {
  width: 7px; height: 7px; padding: 0; border: none; border-radius: 50%;
  background: #c9cede; cursor: pointer; transition: width .2s, background .2s;
}
.dot.active { width: 20px; border-radius: 4px; background: var(--blue); }

/* legacy horizontal strip — still used elsewhere */
.offers-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.offer-card {
  min-width: 240px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, #4353b8 60%, var(--green) 130%);
  padding: 18px 16px; cursor: pointer; box-shadow: var(--shadow);
  min-height: 128px; display: flex; flex-direction: column;
}
.slide .offer-card { min-width: 0; width: 100%; }
.offer-card p {
  /* keep every card the same height so the slider doesn't jump */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.offer-card .learn { margin-top: auto; }
.offer-card.full { min-width: 0; width: 100%; margin-bottom: 14px; }
.offer-card h3 { font-size: 16px; margin-bottom: 6px; }
.offer-card p { font-size: 12.5px; opacity: .92; line-height: 1.45; }
.offer-card .learn { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 700; color: #d8ffe9; }

/* ---- Cart ---- */
.citem {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
}
.citem .info { flex: 1; min-width: 0; }
.citem .info b { font-size: 13.5px; display: block; }
.citem .info span { font-size: 12px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; cursor: pointer; color: var(--blue); font-weight: 700;
}
.qty b { min-width: 20px; text-align: center; }
.del { background: none; border: none; color: var(--red); font-size: 18px; cursor: pointer; }
.cart-footer {
  position: sticky; bottom: 78px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.cart-footer .row { display: flex; justify-content: space-between; margin-bottom: 12px; font-weight: 700; }

/* ---- Status chips ---- */
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.chip.pending    { background: #fff3d6; color: #9a7300; }
.chip.confirmed  { background: #ddeeff; color: #1565c0; }
.chip.processing { background: #ddeeff; color: #1565c0; }
.chip.invoiced   { background: #e5e0ff; color: #5e35b1; }
.chip.delivered  { background: #dcf5e7; color: var(--green-dark); }
.chip.cancelled  { background: #ffe1e1; color: var(--red); }
.chip.issued     { background: #e5e0ff; color: #5e35b1; }
.chip.paid       { background: #dcf5e7; color: var(--green-dark); }

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs button {
  flex: 1; background: none; border: none; padding: 11px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
}
.tabs button.active { color: var(--blue); border-color: var(--blue); }

.date-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.date-row input { flex: 1; }

/* ---- More menu ---- */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 18px;
}
.avatar {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.menu-group { margin-bottom: 8px; }
.menu-group h4 { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 14px 4px 8px; }
.menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: none; border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 8px; cursor: pointer; text-align: left; font-size: 14px;
  color: var(--text);
}
.menu-item .mi { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.menu-item .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; font-weight: 400; }
.menu-item b { font-size: 13.5px; }
.menu-item .chev { margin-left: auto; color: var(--muted); }

/* ---- Lists / entries ---- */
.entry {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 13px 14px; margin-bottom: 9px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.entry .l b { font-size: 13.5px; display: block; }
.entry .l span { font-size: 12px; color: var(--muted); }
.amt-debit { color: var(--red); font-weight: 700; }
.amt-credit { color: var(--green); font-weight: 700; }

.summary { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 13.5px; }
.summary b.pos { color: var(--green-dark); }
.summary b.neg { color: var(--red); }

/* ---- Success screen ---- */
.success-wrap { text-align: center; padding: 60px 20px; }
.success-ico {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 44px;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  z-index: 50; max-width: 90%; width: max-content;
  background: var(--blue-dark); color: #fff;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  animation: pop .18s ease-out;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ---- Staff queue ---- */
.chips-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; }
.chip-filter {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; text-transform: capitalize; white-space: nowrap; flex-shrink: 0;
}
.chip-filter.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.actions-row { display: flex; gap: 8px; margin-top: 10px; }
.actions-row .btn { flex: 1; }

/* ---- Modal (replaces native confirm dialogs) ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 25, 60, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade .15s ease-out;
}
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 360px;
  padding: 22px 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
  animation: pop .18s ease-out;
}
.modal .m-ico {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 12px;
  background: #e3ecff;
}
.modal .m-ico.danger { background: #ffe1e1; }
.modal h3 { text-align: center; color: var(--blue-dark); margin-bottom: 8px; font-size: 16.5px; }
.modal p { text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; padding: 11px; font-size: 14px; }
@keyframes fade { from { opacity: 0; } }

.empty { text-align: center; padding: 46px 16px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

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