:root {
  --primary: #0B7F83;
  --primary-dark: #075F62;
  --primary-soft: #EAF7F6;
  --accent: #13A779;
  --ink: #17323A;
  --muted: #6E7C82;
  --line: #DFE8E8;
  --surface: #FFFFFF;
  --bg: #F4F8F8;
  --danger: #D74747;
  --warning: #B2780B;
  --success: #138A67;
  --shadow: 0 10px 30px rgba(24, 66, 72, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; max-width: 560px; margin: 0 auto; background: var(--surface); position: relative; box-shadow: 0 0 0 1px rgba(0,0,0,.025); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; display: grid; place-items: center; font-weight: 900; }
.brand-name { font-weight: 900; letter-spacing: .02em; font-size: 14px; }
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.icon-btn { border: 0; background: #EFF6F6; width: 40px; height: 40px; border-radius: 12px; color: var(--ink); font-weight: 800; }
.hidden { display: none !important; }

.content { padding: 20px 18px 96px; min-height: calc(100vh - 72px); }
.hero { padding: 20px 0 8px; }
.eyebrow { color: var(--primary); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 8px 0 10px; font-size: clamp(30px, 9vw, 42px); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin: 0 0 8px; font-size: 25px; line-height: 1.14; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 17px; }
p { color: var(--muted); line-height: 1.55; }
.tagline { font-weight: 700; color: var(--ink); margin-top: 18px; }

.hero-visual { margin: 22px 0; min-height: 210px; border-radius: 28px; background: radial-gradient(circle at 80% 20%, rgba(19,167,121,.22), transparent 34%), linear-gradient(145deg, #E8F6F4, #F8FBFB); border: 1px solid #D6ECE9; display: grid; place-items: center; overflow: hidden; position: relative; }
.hero-visual::before, .hero-visual::after { content: ""; position: absolute; border-radius: 999px; background: rgba(11,127,131,.12); }
.hero-visual::before { width: 170px; height: 170px; left: -48px; bottom: -78px; }
.hero-visual::after { width: 110px; height: 110px; right: -20px; top: -35px; }
.medicine-cluster { display: flex; align-items: end; gap: 12px; z-index: 2; }
.bottle, .box, .blister { box-shadow: var(--shadow); }
.bottle { width: 62px; height: 110px; border-radius: 14px 14px 18px 18px; background: white; position: relative; }
.bottle::before { content: ""; width: 44px; height: 22px; background: var(--primary); position: absolute; left: 9px; top: -16px; border-radius: 7px 7px 4px 4px; }
.box { width: 100px; height: 72px; border-radius: 12px; background: linear-gradient(135deg, white 65%, #D2EFEA 65%); transform: rotate(-6deg); }
.blister { width: 88px; height: 54px; border-radius: 13px; background: repeating-radial-gradient(circle at 12px 13px, white 0 5px, #DCEAEA 6px 8px); transform: rotate(8deg); }

.btn { width: 100%; min-height: 52px; border: 0; border-radius: 15px; padding: 14px 18px; font-weight: 800; transition: .16s ease; }
.btn:active { transform: translateY(1px) scale(.995); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(11,127,131,.19); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn-outline { border: 1px solid #BFD8D8; background: white; color: var(--primary-dark); }
.btn-danger { background: #FFF0F0; color: var(--danger); }
.btn-inline { width: auto; min-height: 42px; padding: 10px 14px; }

.stack { display: grid; gap: 12px; }
.section { margin: 24px 0; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 12px; }
.section-title small { color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: white; padding: 16px; box-shadow: 0 7px 24px rgba(25,62,67,.045); }
.card.soft { background: #F7FBFB; }

.search-wrap { position: relative; }
.search-input { width: 100%; height: 54px; border: 1px solid #CDDDDD; border-radius: 16px; padding: 0 16px 0 44px; outline: none; background: white; font-size: 16px; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,127,131,.1); }
.search-icon { position: absolute; left: 16px; top: 16px; color: var(--muted); }

.product-row { display: grid; grid-template-columns: 50px 1fr auto; gap: 12px; align-items: center; }
.product-icon { width: 50px; height: 50px; border-radius: 14px; background: linear-gradient(145deg, #E9F8F6, #F8FBFB); display: grid; place-items: center; font-size: 24px; }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #EFF7F7; color: var(--primary-dark); }
.pill.success { background: #EAF8F2; color: var(--success); }
.pill.warning { background: #FFF6DF; color: var(--warning); }
.pill.danger { background: #FFF0F0; color: var(--danger); }

.quantity-panel { display: grid; grid-template-columns: 54px 1fr 54px; gap: 10px; align-items: center; margin: 18px 0; }
.qty-btn { height: 54px; border-radius: 15px; border: 1px solid #C9DCDC; background: white; font-size: 24px; color: var(--primary); }
.qty-display { height: 54px; border-radius: 15px; background: #F6FAFA; display: grid; place-items: center; font-size: 22px; font-weight: 900; }
.qty-input { width: 100%; height: 54px; border: 1px solid #CDDDDD; border-radius: 15px; background: #F6FAFA; text-align: center; font-size: 22px; font-weight: 900; outline: none; }
.qty-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,127,131,.1); }

.field { display: grid; gap: 7px; }
.field label { font-weight: 800; font-size: 13px; }
.input, .select, .textarea { width: 100%; border: 1px solid #CDDDDD; border-radius: 14px; padding: 14px; outline: none; background: white; }
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,127,131,.1); }

.option-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 15px; padding: 14px; }
.option-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-card input { margin-top: 3px; transform: scale(1.2); accent-color: var(--primary); }

.summary-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-label { color: var(--muted); }
.summary-value { font-weight: 800; text-align: right; }

.progress { display: flex; gap: 6px; margin-bottom: 18px; }
.progress span { height: 5px; background: #DCEAEA; border-radius: 999px; flex: 1; }
.progress span.done { background: var(--primary); }

.success-wrap { text-align: center; padding: 32px 0 12px; }
.success-icon { width: 88px; height: 88px; border-radius: 50%; background: #E8F8F1; color: var(--success); display: grid; place-items: center; font-size: 46px; margin: 0 auto 20px; }
.reference { font-size: 20px; font-weight: 900; letter-spacing: .02em; color: var(--primary-dark); }

.quote-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: white; box-shadow: var(--shadow); }
.quote-top { display: flex; justify-content: space-between; gap: 12px; }
.quote-total { font-size: 26px; font-weight: 900; margin: 15px 0 10px; }
.quote-facts { display: grid; gap: 8px; font-size: 13px; margin-bottom: 16px; }
.quote-facts div { display: flex; justify-content: space-between; gap: 10px; }
.verified { color: var(--success); font-size: 12px; font-weight: 800; }

.sticky-actions { position: sticky; bottom: 80px; padding-top: 14px; background: linear-gradient(to top, white 74%, rgba(255,255,255,0)); }

.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); max-width: 560px; width: 100%; height: 74px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.nav-item { border: 0; background: transparent; display: grid; place-items: center; align-content: center; gap: 3px; color: #78868A; }
.nav-item span { font-size: 21px; }
.nav-item small { font-size: 10px; font-weight: 700; }
.nav-item.active { color: var(--primary); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; max-width: 480px; width: calc(100% - 32px); background: #17323A; color: white; padding: 13px 16px; border-radius: 14px; box-shadow: var(--shadow); z-index: 60; animation: slideUp .22s ease; }
@keyframes slideUp { from { transform: translate(-50%, 12px); opacity: .2; } }

@media (min-width: 720px) {
  body { padding: 26px 0; }
  .app-shell { min-height: calc(100vh - 52px); border-radius: 28px; overflow: hidden; }
  .bottom-nav { bottom: 26px; border-radius: 0 0 28px 28px; }
}

.otp-input { text-align: center; letter-spacing: .35em; font-size: 24px; font-weight: 900; }
.staging-code { margin-top: 14px; padding: 12px 14px; border: 1px dashed #C9DCDC; border-radius: 12px; background: #F7FBFB; font-size: 13px; }


/* Transaction-first retailer entry */
.entry-grid { display: grid; gap: 12px; margin: 24px 0; }
.entry-card { width: 100%; border: 1px solid var(--line); border-radius: 18px; background: white; padding: 16px; display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; text-align: left; box-shadow: 0 7px 24px rgba(25,62,67,.045); }
.entry-card strong { display: block; color: var(--ink); font-size: 16px; }
.entry-card small { display: block; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.entry-card.entry-primary { border-color: rgba(11,127,131,.3); background: var(--primary-soft); }
.entry-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: #EFF7F7; color: var(--primary-dark); font-size: 24px; font-weight: 900; }
.result-card, .facility-summary { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: white; padding: 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left; }
.result-card strong, .facility-summary strong { display: block; color: var(--ink); }
.result-card small, .facility-summary small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.result-card:hover, .result-card:focus { border-color: var(--primary); background: #FAFDFD; outline: none; }
.photo-drop { min-height: 230px; display: grid; align-content: center; gap: 18px; text-align: center; }
.photo-icon { font-size: 54px; }


/* Photo-order interpretation review */
.candidate-card { display: grid; gap: 12px; }
.candidate-warning { border-color: rgba(181, 122, 20, .35); background: #fffaf0; }
.candidate-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.candidate-head strong { display: block; margin-top: 3px; color: var(--ink); }
.candidate-head small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.original-request { margin-top: 5px; padding: 9px 11px; border-radius: 11px; background: var(--primary-soft); border: 1px solid var(--line); }
.original-request span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--primary-dark); }
.original-request strong { margin: 0; font-size: 16px; line-height: 1.25; }
.interpreted-as { font-size: 12px; }
.candidate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.candidate-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill.muted { background: #eef1f1; color: var(--muted); }
@media (max-width: 420px) {
  .candidate-grid { grid-template-columns: 1fr; }
  .candidate-head { align-items: stretch; flex-direction: column; }
}


/* PPB product matching in photo-order review */
.match-panel { margin-top: 12px; padding: 12px; border-radius: 14px; background: #f7fbfb; border: 1px solid var(--line); display: grid; gap: 8px; }
.match-panel-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.match-option-wrap { border: 1px solid var(--line); background: white; border-radius: 12px; overflow: hidden; }
.match-option { width: 100%; border: 0; background: white; border-radius: 0; padding: 10px 12px; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left; }
.match-option-wrap:has(.match-option.selected) { border-color: var(--primary); background: var(--primary-soft); }
.match-option strong { display: block; color: var(--ink); }
.match-option small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.match-option.selected { background: var(--primary-soft); }
.match-score { font-weight: 800; color: var(--primary-dark); white-space: nowrap; }
.match-details { padding: 0 12px 8px; font-size: 12px; color: var(--muted); }
.match-details summary { cursor: pointer; color: var(--primary-dark); font-weight: 800; list-style: none; }
.match-details summary::-webkit-details-marker { display: none; }
.match-details[open] span { display: block; margin-top: 5px; }
.selected-match { font-size: 14px; color: var(--primary-dark); }


.match-group-label {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.match-more {
  justify-self: start;
  margin-top: 4px;
}


.brand-resolution-note {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #ead9a8;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}


/* Current wholesaler offers */
.offer-card { display: grid; gap: 14px; }
.offer-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.offer-head h3 { margin-top: 8px; }
.offer-value { color: var(--primary-dark); font-size: 18px; text-align: right; white-space: nowrap; }
.offer-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.offer-facts span { background: #F3F8F8; border-radius: 999px; padding: 7px 10px; font-size: 12px; color: var(--muted); }
@media (max-width: 420px) {
  .offer-head { flex-direction: column; }
  .offer-value { text-align: left; }
}


/* Chemist account, public supplier feed and inbox */
.public-update-card p,.inbox-card p{white-space:pre-wrap}
.inbox-unread{border-color:rgba(11,127,131,.45);box-shadow:0 8px 24px rgba(11,127,131,.09)}
.account-switch{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:5px;background:#EFF6F6;border-radius:15px;margin:18px 0}
.account-switch button{border:0;border-radius:11px;padding:11px;background:transparent;color:var(--muted);font-weight:800}
.account-switch button.active{background:white;color:var(--primary-dark);box-shadow:0 2px 8px rgba(24,66,72,.08)}
.selected-account-facility{display:grid;gap:5px}
.selected-account-facility .pill{justify-self:start}
#accountFacilityResults{display:grid;gap:8px}
