/* Ram Medicals shop panel. Same look as the customer app: teal gradient, Poppins, brand name in Baloo 2.
   Works on the shop PC and on delivery staff phones. Fonts fall back to system fonts when offline. */
:root {
  --bg: #f3f7f9;
  --panel: #ffffff;
  --ink: #14232b;
  --muted: #5f7079;
  --line: #e1e9ed;
  --field: #d3dee3;
  --brand: #0b7285;
  --brand-dark: #085a69;
  --brand-light: #15aabf;
  --brand-soft: #e3f4f7;
  --grad: linear-gradient(120deg, #085a69 0%, #0b7285 45%, #15aabf 100%);
  --ok: #1e7b45;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --violet: #6b3fa0;
  --violet-soft: #f1eafa;
  --rider: #a61e4d;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(16, 42, 52, .04), 0 8px 24px rgba(16, 42, 52, .06);
  --shadow-lift: 0 2px 6px rgba(16, 42, 52, .06), 0 16px 36px rgba(16, 42, 52, .12);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --brand-font: "Baloo 2", "Poppins", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 26px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.big { font-size: 22px; font-weight: 700; }

/* ---------------------------------------------------------------- brand */
.logo {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 11px; background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  animation: logo-in .7s var(--spring) both;
}
.logo svg { width: 22px; height: 22px; fill: var(--brand); transition: transform .5s var(--spring); }
.brand:hover .logo svg { transform: rotate(90deg) scale(1.08); }
.brand-name {
  font-family: var(--brand-font); font-weight: 800; letter-spacing: .01em; line-height: 1;
  background: linear-gradient(100deg, #fff 0%, #fff 42%, #c3fae8 50%, #fff 58%, #fff 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 7s linear infinite;
}

/* ---------------------------------------------------------------- top navigation */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  background: var(--grad); color: #fff;
  padding: 0 18px; min-height: 62px;
  box-shadow: 0 6px 20px rgba(8, 90, 105, .25);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px; margin-right: 18px; padding: 0;
  text-decoration: none; white-space: nowrap;
}
.topbar .brand:hover { background: none; }
.topbar .brand-name { font-size: 25px; padding-top: 4px; }
.topbar a:not(.brand) {
  color: rgba(255, 255, 255, .85); text-decoration: none; position: relative;
  padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  transition: background .2s var(--ease), color .2s, transform .2s var(--ease);
}
.topbar a:not(.brand):hover { color: #fff; background: rgba(255, 255, 255, .14); }
.topbar a.active { color: var(--brand-dark); background: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.topbar a.active:hover { color: var(--brand-dark); background: #fff; }
.topbar .spacer { flex: 1; }
.topbar .who {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #e3f6f9; margin-right: 10px;
}
.topbar .who::before {
  content: attr(data-initial); display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; font-weight: 700; font-size: 13px;
}
.topbar form { margin: 0; }
.topbar button {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 500;
  transition: background .2s, transform .15s var(--ease);
}
.topbar button:hover { background: rgba(255, 255, 255, .2); }
.topbar button:active { transform: scale(.96); }
.topbar .count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: #ffd43b; color: #3d2c00; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 19px;
  animation: pop .5s var(--spring) both;
}
.topbar .sound { margin-right: 8px; }

/* ---------------------------------------------------------------- page */
.container { max-width: 1240px; margin: 0 auto; padding: 26px 20px 56px; }
.narrow { max-width: 680px; }

/* Sections rise in one after another when a page opens. Not again when the live update redraws it. */
.container > * { animation: rise .5s var(--ease) both; }
.container > *:nth-child(2) { animation-delay: .05s; }
.container > *:nth-child(3) { animation-delay: .1s; }
.container > *:nth-child(4) { animation-delay: .15s; }
.container > *:nth-child(5) { animation-delay: .2s; }
.container > *:nth-child(n+6) { animation-delay: .25s; }
.container.swapped > *, .container.swapped table.data tbody tr { animation: none; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  margin-bottom: 16px; box-shadow: var(--shadow);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lift); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500;
  animation: drop .45s var(--spring) both;
}
.flash::before {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 800; color: #fff;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.ok::before { content: "✓"; background: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.error::before { content: "!"; background: var(--danger); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.warn::before { content: "!"; background: var(--warn); }

/* ---------------------------------------------------------------- tables */
table.data { width: 100%; border-collapse: collapse; background: var(--panel); }
table.data th, table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: #f7fafb;
}
table.data th.num { text-align: right; }
table.data tbody tr { animation: rise .45s var(--ease) both; }
table.data tbody tr:nth-child(2) { animation-delay: .03s; }
table.data tbody tr:nth-child(3) { animation-delay: .06s; }
table.data tbody tr:nth-child(4) { animation-delay: .09s; }
table.data tbody tr:nth-child(5) { animation-delay: .12s; }
table.data tbody tr:nth-child(6) { animation-delay: .15s; }
table.data tbody tr:nth-child(n+7) { animation-delay: .18s; }
table.data tbody tr td { transition: background .2s; }
table.data tbody tr:hover td { background: #f3fafb; }
table.data tr:last-child td { border-bottom: 0; }
table.data tfoot td { font-weight: 600; background: #f7fafb; }
table.data tr.link { cursor: pointer; }
table.data tr.link:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand-light); }
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
}
.table-wrap table.data { border: 0; }
tr.inactive td { color: var(--muted); }
tr.unavailable td { color: var(--muted); text-decoration: line-through; }
tr.unavailable td.keep { text-decoration: none; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: 9px 12px; border: 1.5px solid var(--field); border-radius: var(--radius-s); background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 70px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b7c7ce; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 4px rgba(21, 170, 191, .16);
}
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; accent-color: var(--brand); }
.check { display: flex; align-items: center; color: var(--ink); font-size: 14px; margin: 6px 0; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { margin: 0; }
.toolbar input, .toolbar select { width: auto; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head-row h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-block; font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-s); border: 1.5px solid var(--field); background: #fff; color: var(--ink);
  text-align: center;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), background-color .2s, background-position .4s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(16, 42, 52, .1); border-color: #b7c7ce; }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn-primary {
  background: var(--grad); background-size: 170% 100%; border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(11, 114, 133, .28);
}
.btn-primary:hover { background-position: 100% 0; border-color: transparent; box-shadow: 0 10px 22px rgba(11, 114, 133, .34); }
.btn-ok {
  background: linear-gradient(120deg, #1e7b45, #2f9e44); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(30, 123, 69, .28);
}
.btn-ok:hover { border-color: transparent; box-shadow: 0 10px 22px rgba(30, 123, 69, .34); }
.btn-danger { color: var(--danger); border-color: #f0b8b2; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e9968c; }
.btn-small { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { display: block; width: 100%; }
.btn-big { font-size: 18px; padding: 14px; border-radius: 14px; }
/* A light sweep across coloured buttons on hover. */
.btn-primary::after, .btn-ok::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
}
.btn-primary:hover::after, .btn-ok:hover::after { transform: translateX(120%); transition: transform .8s var(--ease); }
/* Sent: the button waits with a spinner until the next page opens. */
.btn.is-busy { pointer-events: none; color: transparent !important; }
.btn.is-busy::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
.btn.is-busy:not(.btn-primary):not(.btn-ok)::before { border-color: rgba(11, 114, 133, .25); border-top-color: var(--brand); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
form.inline { display: inline; margin: 0; }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-size: 13.5px; }

/* ---------------------------------------------------------------- badges and order status */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 20px; background: #edf2f4; color: var(--muted); white-space: nowrap;
}
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.blue { background: var(--brand-soft); color: var(--brand-dark); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge[class*="st-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-PLACED { background: #fff3bf; color: #7a5a00; }
.st-PLACED::before, .st-OUT_FOR_DELIVERY::before { animation: blink 1.6s ease-in-out infinite; }
.st-QUOTED { background: var(--violet-soft); color: var(--violet); }
.st-CONFIRMED { background: var(--brand-soft); color: var(--brand-dark); }
.st-PACKED { background: #e7f5ff; color: #1864ab; }
.st-OUT_FOR_DELIVERY { background: #fff0f6; color: var(--rider); }
.st-DELIVERED { background: var(--ok-soft); color: var(--ok); }
.st-CANCELLED, .st-REJECTED { background: #f1f3f5; color: #495057; }

/* ---------------------------------------------------------------- stat tiles */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--grad); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat .label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* "Find order" box on the order list */
.find-order { display: flex; gap: 6px; margin-left: auto; }
.find-order input { width: 260px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; text-transform: uppercase; }
.find-order input::placeholder { font-family: var(--font); text-transform: none; }

/* ---------------------------------------------------------------- tabs */
.tabs {
  display: inline-flex; gap: 4px; flex-wrap: wrap; padding: 5px; margin-bottom: 18px;
  background: #e6eef1; border-radius: 14px;
}
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--muted); border-radius: 10px; font-weight: 500;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.tabs a.active { color: var(--brand-dark); background: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(16, 42, 52, .1); }
.tabs a .n {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: rgba(16, 42, 52, .08); font-size: 11.5px; text-align: center; line-height: 19px;
}
.tabs a .n.hot { background: #ffd43b; color: #3d2c00; font-weight: 700; animation: pop .5s var(--spring) both, glow 2s ease-in-out .5s infinite; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------------------------------------------------------------- login and first-time setup */
.auth { position: relative; z-index: 1; max-width: 400px; margin: 0 auto; padding: 8vh 16px 40px; }
.auth .card { padding: 26px; }
.auth h1 { text-align: center; }
.auth-page { min-height: 100vh; background: var(--grad); background-attachment: fixed; overflow-x: hidden; }
.auth-page::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .16), transparent 40%),
              radial-gradient(circle at 85% 80%, rgba(195, 250, 232, .18), transparent 45%);
}
.auth-brand { text-align: center; color: #fff; margin-bottom: 22px; }
.auth-brand .logo { width: 74px; height: 74px; border-radius: 22px; box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
  animation: logo-in .9s var(--spring) both, bob 4s ease-in-out 1s infinite; }
.auth-brand .logo svg { width: 42px; height: 42px; }
.auth-brand .brand-name { display: block; font-size: 48px; margin: 16px 0 4px; animation: shine 7s linear infinite, rise .7s var(--ease) .15s both; }
.auth-brand p { margin: 0; color: rgba(255, 255, 255, .85); letter-spacing: .25em; text-transform: uppercase; font-size: 12px;
  animation: rise .7s var(--ease) .25s both; }
.auth-card { border: 0; border-radius: 22px; box-shadow: 0 24px 60px rgba(4, 52, 61, .35); animation: rise .7s var(--ease) .3s both; }
.auth-card:hover { box-shadow: 0 24px 60px rgba(4, 52, 61, .35); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-foot { text-align: center; color: rgba(255, 255, 255, .75); font-size: 12.5px; margin-top: 18px; animation: rise .7s var(--ease) .45s both; }
/* Pills and crosses drifting behind the login card. */
.floaters { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.floaters i { position: absolute; display: block; opacity: .16; animation: float 14s ease-in-out infinite; }
.floaters .pill { width: 70px; height: 28px; border-radius: 14px; background: linear-gradient(90deg, #fff 50%, rgba(255, 255, 255, .45) 50%); }
.floaters .plus { width: 34px; height: 34px; }
.floaters .plus::before, .floaters .plus::after { content: ""; position: absolute; background: #fff; border-radius: 3px; }
.floaters .plus::before { left: 12px; top: 0; width: 10px; height: 34px; }
.floaters .plus::after { top: 12px; left: 0; width: 34px; height: 10px; }
.floaters .dot { width: 26px; height: 26px; border-radius: 50%; border: 5px solid #fff; }
.floaters i:nth-child(1) { left: 8%; top: 14%; animation-duration: 13s; }
.floaters i:nth-child(2) { left: 82%; top: 10%; animation-duration: 16s; animation-delay: -4s; }
.floaters i:nth-child(3) { left: 70%; top: 62%; animation-duration: 15s; animation-delay: -8s; }
.floaters i:nth-child(4) { left: 14%; top: 72%; animation-duration: 17s; animation-delay: -2s; }
.floaters i:nth-child(5) { left: 44%; top: 86%; animation-duration: 12s; animation-delay: -6s; }
.floaters i:nth-child(6) { left: 90%; top: 40%; animation-duration: 18s; animation-delay: -10s; }
.floaters i:nth-child(7) { left: 30%; top: 6%; animation-duration: 14s; animation-delay: -3s; }

/* ---------------------------------------------------------------- order page */
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.rx-thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.rx-thumbs a {
  display: block; width: 150px; height: 190px; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: #f7fafb; text-align: center; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.rx-thumbs a:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: var(--shadow-lift); }
.rx-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.rx-thumbs .pdf { display: flex; align-items: center; justify-content: center; height: 100%; font-weight: 700; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 12px 22px; border-left: 2px solid var(--line); position: relative; font-size: 13.5px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 3px #fff;
}
.timeline li:last-child::before { animation: ring 2s ease-out infinite; }
.timeline .when { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- quote builder */
.quote input.qty { width: 70px; text-align: right; }
.quote input.price { width: 100px; text-align: right; }
.quote input.note { min-width: 140px; }
.quote td { vertical-align: middle; }
.quote .del { border: 0; background: none; color: var(--danger); font-size: 20px; cursor: pointer; padding: 0 6px;
  border-radius: 8px; transition: background .2s, transform .15s; }
.quote .del:hover { background: var(--danger-soft); transform: scale(1.1); }
.search-box { position: relative; }
.results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 16px 36px rgba(16, 42, 52, .16); max-height: 50vh; overflow-y: auto;
  animation: drop .25s var(--ease) both;
}
.results div { padding: 10px 14px; display: flex; justify-content: space-between; gap: 12px; cursor: pointer; transition: background .15s; }
.results div.sel, .results div:hover { background: var(--brand-soft); }
.results .meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.totals { width: 100%; max-width: 320px; margin-left: auto; border-collapse: collapse; }
.totals td { padding: 3px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand td { font-size: 20px; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 6px; }
.msg { padding: 10px 12px; border-radius: 12px; font-size: 13.5px; margin-top: 10px; animation: drop .35s var(--spring) both; }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------------------------------------------------------------- deliveries (phone) */
.delivery-card { position: relative; overflow: hidden; padding-top: 22px; }
.delivery-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, #a61e4d, #e64980, #a61e4d); background-size: 200% 100%; animation: shine 3s linear infinite;
}
.delivery-card .amount { font-size: 32px; font-weight: 800; letter-spacing: -.01em; }
.delivery-card .pay { display: flex; gap: 10px; margin: 12px 0; }
.delivery-card .pay label {
  flex: 1; margin: 0; border: 1.5px solid var(--field); border-radius: 12px; padding: 12px;
  color: var(--ink); font-size: 16px; font-weight: 500; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.delivery-card .pay label:hover { border-color: var(--brand-light); }
.delivery-card .pay label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.02); }
.delivery-card .pay input:checked + span { font-weight: 700; color: var(--brand-dark); }
.delivery-card details summary { cursor: pointer; color: var(--muted); margin-top: 12px; font-weight: 500; }
.otp-field {
  margin: 14px 0; padding: 14px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, #fff0f6, #fff5f9); border: 1.5px dashed #f3a5c6;
}
.otp-field label { color: var(--rider); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.otp-input {
  display: block; width: 100%; max-width: 230px; margin: 6px auto 8px;
  font: 700 32px/1.2 var(--mono); letter-spacing: .55em; text-indent: .55em; text-align: center;
  padding: 10px 8px; border: 2px solid #f3a5c6; border-radius: 14px; background: #fff; color: var(--rider);
}
.otp-input::placeholder { color: #f0c3d6; }
.otp-input:focus { border-color: var(--rider); box-shadow: 0 0 0 5px rgba(230, 73, 128, .16); }
.otp-input:disabled { background: #f6f6f6; border-color: #ddd; }
.otp-field p { margin: 0; }
.otp-warn { color: var(--danger); font-weight: 600; animation: shake .4s ease both; }
.otp-skip { margin: 0 0 14px; }
.otp-skip .field { margin-top: 8px; }

/* Mid-size screens: the name shrinks to its initial so the menu stays on one line. */
@media (max-width: 1180px) {
  .topbar .who { font-size: 0; gap: 0; margin-right: 8px; }
  .topbar .who::before { font-size: 13px; }
  .topbar a:not(.brand) { padding: 8px 11px; }
}
@media (max-width: 960px) {
  .order-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 16px 14px 40px; }
  .hide-phone { display: none; }
  h1 { font-size: 20px; }

  /* Menu: one row that scrolls sideways instead of three wrapped rows. */
  .topbar { flex-wrap: nowrap; overflow-x: auto; padding: 0 10px; min-height: 56px; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar a:not(.brand) { padding: 7px 11px; white-space: nowrap; }
  .topbar .brand { margin-right: 8px; gap: 8px; }
  .topbar .brand-name { font-size: 21px; }
  .topbar .logo { width: 30px; height: 30px; border-radius: 9px; }
  .topbar .logo svg { width: 18px; height: 18px; }
  .topbar .who, .topbar .sound .lbl { display: none; }
  .topbar .sound { padding: 5px 9px; margin-right: 6px; }
  .topbar .spacer { min-width: 8px; }
  .topbar button { white-space: nowrap; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }
  .auth-brand .brand-name { font-size: 40px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px 10px; }
  .stat .value { font-size: 21px; }

  /* Tables marked "stack" become one card per row, each value with its column name. */
  .table-wrap:has(table.stack) { overflow-x: visible; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  table.stack td.num { text-align: left; }
  table.stack td.hide-phone, table.stack td:empty { display: none; }
  table.stack td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 88px; margin-right: 8px;
    color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  }
  table.stack td.lead { font-weight: 600; font-size: 16px; }
  table.stack input, table.stack select { max-width: 100%; }
  table.data tr.link:hover td:first-child { box-shadow: none; }
  .quote input.qty, .quote input.price { width: 110px; }
  .quote input.note { min-width: 0; width: 100%; }
  .totals { max-width: none; }
  .toolbar input, .toolbar select { width: 100%; }
  .toolbar .field { flex: 1 1 100%; }
  .head-row .actions .btn { flex: 1; }
  .find-order { width: 100%; }
  .find-order input { width: auto; flex: 1; }
}

@media print {
  .topbar, .no-print, .toolbar, .actions, .tabs { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap { border: 0; padding: 0; box-shadow: none; }
  .container > *, table.data tbody tr { animation: none !important; }
}

/* ---------------------------------------------------------------- live updates */
/* Connection dot, sound button states, corner messages, "page changed" bar, new rows. */
.topbar .live-dot { width: 9px; height: 9px; border-radius: 50%; background: #9fb3ba; margin-right: 12px; flex: none; }
.topbar .live-dot.up { background: #69db7c; animation: live-pulse 2.4s ease-out infinite; }
.topbar .sound.on { background: rgba(255, 255, 255, .18); }
.topbar .sound.waiting { border-color: #ffd43b; color: #ffe066; animation: live-nudge 1.8s ease-in-out infinite; }
.live-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-end; max-width: calc(100% - 32px); }
.live-toast {
  display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 13px 18px;
  background: linear-gradient(120deg, #14232b, #085a69); border-radius: 14px;
  box-shadow: 0 12px 30px rgba(4, 52, 61, .35); font-weight: 600;
  animation: live-in .45s var(--spring); transition: opacity .4s, transform .4s;
}
.live-toast::before { content: "🔔"; font-size: 16px; }
a.live-toast:hover { background: var(--grad); }
.live-toast.out { opacity: 0; transform: translateY(8px); }
.live-banner {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex;
  gap: 12px; align-items: center; background: var(--warn-soft); color: var(--warn); border: 1px solid #f5d38a;
  padding: 8px 10px 8px 18px; border-radius: 999px; box-shadow: 0 10px 24px rgba(0, 0, 0, .14); font-weight: 600;
  animation: live-drop .4s var(--spring); max-width: calc(100% - 32px);
}
tr.live-new td { animation: live-glow 2.4s ease-out; }
.card.live-new { animation: live-ring 2.4s ease-out; }

/* ---------------------------------------------------------------- medicine photos */
.thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  vertical-align: middle; margin-right: 8px; }
.form-section { margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.photo-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.photo-preview { width: 120px; height: 120px; object-fit: contain; border-radius: 14px; background: #fff;
  border: 1px solid var(--line); }
.photo-preview.empty { background: var(--brand-soft); border-style: dashed; }

/* ---------------------------------------------------------------- offer cards (same look as the app) */
.th-TEAL { --o1: #0b7285; --o2: #15aabf; }
.th-VIOLET { --o1: #5f3dc4; --o2: #9775fa; }
.th-SUNSET { --o1: #c2410c; --o2: #f59f00; }
.th-MAROON { --o1: #a61e4d; --o2: #f06595; }
.th-MINT { --o1: #087f5b; --o2: #20c997; }
.th-NIGHT { --o1: #1c2b5a; --o2: #4263eb; }
.offer-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.offer-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow); transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.offer-item:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.offer-item.off .offer-card { filter: grayscale(.85); opacity: .6; }
.offer-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 2px 8px; }
.offer-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.offer-tools form { margin: 0; }
/* The text side stays the dark colour so white text reads well; the light colour is on the right. */
.offer-card {
  position: relative; overflow: hidden; aspect-ratio: 12 / 5; border-radius: 16px; color: #fff;
  background: linear-gradient(90deg, var(--o1) 0%, var(--o1) 45%, var(--o2) 100%);
  display: flex; align-items: center; padding: 14px 16px;
  box-shadow: 0 10px 22px rgba(16, 42, 52, .16);
}
.offer-card::before { content: ""; position: absolute; width: 60%; aspect-ratio: 1; right: -18%; top: -40%;
  border-radius: 50%; background: rgba(255, 255, 255, .13); }
.offer-card::after { content: ""; position: absolute; width: 34%; aspect-ratio: 1; right: 18%; bottom: -30%;
  border-radius: 50%; background: rgba(255, 255, 255, .09); }
.offer-card > img:not(.oc-person) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; z-index: 2; }
.offer-card.has-pic > img:not(.oc-person) { display: block; }
.offer-card.has-pic .oc-person, .offer-card.has-pic .oc-art { display: none !important; }
.oc-text { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 68%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.offer-card.has-person .oc-text { max-width: 58%; }
/* The person fills the right side and fades into the card colour towards the text. */
.oc-person { position: absolute; right: 0; top: 0; height: 100%; width: 48%; object-fit: cover; object-position: center 20%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%); mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
  display: none; z-index: 1; animation: person-in .7s var(--ease) both; }
.offer-card.has-person .oc-person { display: block; }
.offer-card.has-person .oc-art { display: none; }
.oc-badge { text-shadow: none; background: #ffd43b; color: #3b2b00; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
.oc-badge:empty { display: none; }
.oc-title { font-size: 17px; line-height: 1.2; font-weight: 700; }
.oc-sub { font-size: 12px; opacity: .9; line-height: 1.3; }
.oc-sub:empty { display: none; }
.oc-cta { text-shadow: none; margin-top: 4px; background: #fff; color: var(--o1); font-size: 11.5px; font-weight: 700; padding: 4px 11px;
  border-radius: 999px; }
.oc-art { position: absolute; right: 7%; top: 50%; transform: translateY(-50%) rotate(-12deg); z-index: 1;
  width: 24%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 26%;
  background: rgba(255, 255, 255, .2); animation: bob 3.2s ease-in-out infinite; }
.oc-art svg { width: 58%; fill: #fff; }
.offer-preview { margin-bottom: 16px; max-width: 460px; }
.offer-preview .small { margin-bottom: 6px; }
.theme-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.person-pick { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.person { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px;
  border-radius: 14px; border: 1.5px solid var(--field); background: #fff; font-size: 12.5px; color: var(--ink);
  text-align: center; transition: border-color .2s, box-shadow .2s, transform .2s; }
.person:hover { transform: translateY(-1px); }
.person input { position: absolute; opacity: 0; pointer-events: none; }
.person .ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: center 20%; }
.person .ph.none { background: var(--brand-soft); display: block; }
.person:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21, 170, 191, .2); font-weight: 600; }
.swatch { cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1.5px solid var(--field); font-size: 13px; color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s; }
.swatch::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(125deg, var(--o1), var(--o2)); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch:has(input:checked) { border-color: var(--o1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--o2) 30%, transparent); font-weight: 600; }

/* ---------------------------------------------------------------- motion */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes person-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes logo-in { from { transform: scale(.3) rotate(-25deg); opacity: 0; } }
@keyframes shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(255, 212, 59, .35); } }
@keyframes ring { 0% { box-shadow: 0 0 0 3px #fff, 0 0 0 3px rgba(21, 170, 191, .5); }
  100% { box-shadow: 0 0 0 3px #fff, 0 0 0 12px rgba(21, 170, 191, 0); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes float { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(18px, -26px) rotate(25deg); }
  66% { transform: translate(-14px, 14px) rotate(-15deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(105, 219, 124, .7); } 70%, 100% { box-shadow: 0 0 0 8px rgba(105, 219, 124, 0); } }
@keyframes live-nudge { 0%, 100% { transform: none; } 50% { transform: scale(1.05); } }
@keyframes live-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes live-drop { from { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes live-glow { 0%, 30% { background: #fff3bf; } 100% { background: transparent; } }
@keyframes live-ring { 0%, 30% { box-shadow: 0 0 0 3px #ffd43b; } 100% { box-shadow: 0 0 0 3px rgba(255, 212, 59, 0); } }

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