/* ─────────────────────────────────────────────────────────────
   Shared pieces for the customer pages:
   pills, buttons, form errors, dialogs, skeletons, empty states,
   page layouts, cards, lists, toggles, steppers, badges.
   ───────────────────────────────────────────────────────────── */

/* ── Status pills ─────────────────────────────────────── */
.pill { --tone: var(--accent-text, var(--accent)); display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--nodot::before { display: none; }
.pill--success { --tone: var(--success); }
.pill--warning { --tone: var(--warning); }
.pill--danger { --tone: var(--danger); }
.pill--muted { --tone: var(--text-muted); }
.pill--info { --tone: #0e7490; }
[data-theme="dark"] .pill--info { --tone: #5cc8dc; }
.pill--accent { --tone: var(--accent-text, var(--accent)); }

/* ── Extra buttons ────────────────────────────────────── */
.btn--danger { background: var(--danger); color: #fff; }
@media (hover: hover) { .btn--danger:hover { box-shadow: 0 8px 24px -8px rgba(220, 38, 38, .55); } }
.btn--link { height: auto; padding: 0; color: var(--accent-text, var(--accent)); font-weight: 500; background: none; }
@media (hover: hover) { .btn--link:hover { text-decoration: underline; } }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
/* Two-tone icons: the soft fill under the outline takes the brand blue;
   red, amber and green icons keep their own colour for it */
.icon .duo { fill: var(--duo, var(--accent)); opacity: var(--duo-o, .32); }
[data-theme="dark"] .icon .duo { opacity: var(--duo-o, .38); }
[class*="--danger"], [class*="--warn"], [class*="--success"], [class*="--ok"], [class*="--out"], [class*="--due"], [class*="--hot"], .pill, .btn--accent, .box--accent, .tab__icon { --duo: currentColor; }
.btn--accent .icon .duo, .box--accent .icon .duo { opacity: .25; }
.icon-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--text); transition: background-color .2s var(--ease), transform .3s var(--spring); }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); } }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 1; animation: count-pop .4s var(--spring); }
.count:empty, .count[data-n="0"] { display: none; }
/* The gap around a badge is a real hole cut in the icon under it (js/lib/badge-cut.js),
   so whatever is behind the see-through bars shows through, never a painted ring */
@keyframes count-pop { from { transform: scale(.4); } }

/* ── Forms ─────────────────────────────────────────────── */
.field__error { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--danger); animation: err-in .25s var(--ease); }
.field__error svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
@keyframes err-in { from { opacity: 0; transform: translateY(-4px); } }
.input[aria-invalid="true"], .dd:has(.input[aria-invalid="true"]) .dd__button { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.field__hint { font-size: var(--fs-xs); color: var(--text-faint); }
.field[hidden] { display: none; }
.form-grid { display: grid; gap: var(--space-4); }
.form-row { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: 12px; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
.check > span { flex: 1 1 0; min-width: 0; }
.check input { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); }
/* Our own checkbox: a soft rounded square that fills with the accent and draws a tick */
.check input[type="checkbox"] { appearance: none; -webkit-appearance: none; display: grid; place-items: center; margin: 0; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 28%, transparent); cursor: pointer; transition: background-color .18s var(--ease), box-shadow .18s var(--ease), transform .25s var(--spring); }
.check input[type="checkbox"]::after { content: ""; width: 11px; height: 6px; margin-top: -2px; border: solid var(--accent-ink); border-width: 0 0 2px 2px; transform: rotate(-45deg) scale(0); transition: transform .22s var(--spring); }
.check input[type="checkbox"]:checked { background: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.check input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
.check input[type="checkbox"]:active { transform: scale(.9); }
.check input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input[type="checkbox"][aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--danger); }
.check:has(input:checked) { color: var(--text); }
.check--block { flex-wrap: wrap; }
.check--block .field__error { flex-basis: 100%; padding-left: 32px; }

/* Choice cards (radio buttons that look like cards) */
.choices { display: grid; gap: 8px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--field); cursor: pointer; border: 1.5px solid transparent; transition: border-color .2s, background-color .2s; }
@media (hover: hover) { .choice:hover { border-color: var(--line-strong); } }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice__icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; background: none; color: var(--accent-text, var(--accent)); }
.choice:has(input:checked) .choice__icon { background: var(--accent); color: var(--accent-ink); }
.choice__icon svg { width: 24px; height: 24px; }
.choice__text { display: grid; min-width: 0; }
.choice__text strong { font-weight: 600; }
.choice__text span { font-size: var(--fs-sm); color: var(--text-muted); }

/* Toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch:first-child { border-top: 0; }
.switch__text { display: grid; }
.switch__text span { font-size: var(--fs-sm); color: var(--text-muted); }
.switch input { appearance: none; flex-shrink: 0; position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--line-strong); cursor: pointer; transition: background-color .25s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .3s var(--spring); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Quantity stepper */
.qty { display: inline-flex; align-items: center; height: 40px; border-radius: var(--radius-pill); background: var(--field); }
.qty button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text); }
@media (hover: hover) { .qty button:hover:not(:disabled) { background: var(--line); } }
.qty button:disabled { opacity: .35; }
.qty button svg { width: 16px; height: 16px; }
.qty output { min-width: 28px; text-align: center; font-weight: 600; font-family: var(--font-mono); }

/* ── Confirmation dialog ──────────────────────────────── */
.confirm { width: min(calc(100% - 32px), 440px); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--glass-strong); -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px); color: var(--text); box-shadow: var(--edge), 0 30px 80px -20px rgba(0,0,0,.45); animation: confirm-in .3s var(--spring); }
.confirm::backdrop { background: rgba(12, 12, 13, .38); backdrop-filter: blur(6px); animation: fade .25s; }
.confirm.is-closing { animation: confirm-out .18s var(--ease) forwards; }
/* the dim page behind fades away with it instead of snapping off at the end */
.confirm.is-closing::backdrop { animation: fade-out .18s var(--ease) forwards; }
.confirm__box { display: grid; gap: var(--space-4); padding: var(--space-6); }
.confirm__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: none; color: var(--accent-text, var(--accent)); }
.confirm__icon--danger { color: var(--danger); }
.confirm__icon svg { width: 32px; height: 32px; }
.confirm__title { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; }
.confirm__text { color: var(--text-muted); }
.confirm__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: var(--space-2); }
@keyframes confirm-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes confirm-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
/* the global margin reset would pin dialogs to the top corner */
.confirm { margin: auto; }
/* phone: dialogs rise from the bottom, where the thumb is */
@media (max-width: 599px) {
  .confirm { width: calc(100% - 20px); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: auto 10px calc(10px + env(safe-area-inset-bottom)); border-radius: var(--radius-lg); animation: sheet-up .38s var(--ease); } /* floats above the edge, like the nav bars */
  .confirm.is-closing { animation: sheet-down .18s var(--ease) forwards; } /* done before the dialog is removed (180ms) */
  .confirm__box { padding: var(--space-5); }
  .confirm__actions .btn { flex: 1; }
}
@keyframes sheet-up { from { transform: translateY(calc(100% + 40px)); } }
@keyframes sheet-down { to { transform: translateY(calc(100% + 40px)); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* ── Skeleton loaders ─────────────────────────────────── */
.sk { border-radius: var(--radius-lg); background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%) 0 0 / 200% 100%; animation: shimmer 1.3s linear infinite; box-shadow: var(--edge), var(--lift); }
.sk-card { min-height: 320px; }
.sk-row { min-height: 92px; border-radius: var(--radius); }
.sk-line { height: 18px; border-radius: 9px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Empty state ──────────────────────────── */
.empty-state { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-7) var(--space-5); text-align: center; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--edge), var(--lift); }
.empty-state__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: none; color: var(--text-muted); }
.empty-state__icon svg { width: 40px; height: 40px; }
.empty-state h3 { font-size: var(--fs-lg); font-weight: 600; }
.empty-state p { color: var(--text-muted); max-width: 40ch; }

/* ── Page layouts ─────────────────────────────────────── */
.page-head { display: grid; gap: var(--space-3); margin-bottom: var(--space-6); }
.page-head__title { font-size: var(--fs-page); font-weight: 700; line-height: .95; letter-spacing: -0.04em; }
.page-head__title em { font-style: normal; color: var(--accent-text, var(--accent)); }
.page-head__text { color: var(--text-muted); max-width: 60ch; }
.page-head__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-muted); }
@media (hover: hover) { .crumbs a:hover { color: var(--text); } }
.crumbs svg { width: 14px; height: 14px; color: var(--text-faint); }
.split { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr) 380px; } .split--wide-side { grid-template-columns: minmax(0, 1fr) 420px; } .sticky { position: sticky; top: calc(var(--nav-h) + 32px); } }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.box { display: grid; align-content: start; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--edge), var(--lift); }
@media (min-width: 700px) { .box { padding: var(--space-6); } }
.box__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px var(--space-3); }
.box__head > .box__sub { white-space: nowrap; }
.box__title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.box__sub { color: var(--text-muted); font-size: var(--fs-sm); }
.box--ink { background: var(--surface-ink); color: var(--text-on-ink); box-shadow: none; --text-muted: #a3a3aa; --line: rgba(255,255,255,.1); }
.box--accent { background: var(--accent); color: var(--accent-ink); box-shadow: none; --text-muted: color-mix(in srgb, var(--accent-ink) 75%, transparent); --line: color-mix(in srgb, var(--accent-ink) 20%, transparent); }
.box--warn { box-shadow: 0 0 0 1.5px var(--warning); }

/* Key/value rows */
.kv { display: grid; gap: 0; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.kv .kv__total { font-size: var(--fs-md); font-weight: 600; padding-top: 14px; }
.kv .kv__total dd { font-weight: 700; }

/* Filter pills (tabs) */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--edge), var(--lift); font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); transition: background-color .2s, color .2s; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { background: var(--text); color: var(--bg); box-shadow: none; }
.tabs .tab-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; background: var(--surface-2); color: var(--text); }
.tabs [aria-selected="true"] .tab-n { background: color-mix(in srgb, var(--bg) 25%, transparent); color: var(--bg); }

/* Step indicator */
.steps-bar { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--space-5); counter-reset: s; }
.steps-bar li { flex: 1; display: grid; gap: 8px; font-size: var(--fs-xs); color: var(--text-faint); counter-increment: s; }
.steps-bar li::before { content: ""; height: 4px; border-radius: 2px; background: var(--line-strong); transition: background-color .35s var(--ease); }
.steps-bar li.is-done, .steps-bar li.is-current { color: var(--text); }
.steps-bar li.is-done::before, .steps-bar li.is-current::before { background: var(--accent); }

/* Product thumbnail (illustration) */
.thumb { display: grid; place-items: center; overflow: hidden; border-radius: calc(var(--radius) - 4px); background: var(--surface-2); aspect-ratio: 1; }
.thumb .art { width: 100%; height: 100%; }
.thumb--sm { width: 64px; flex-shrink: 0; }
.thumb--md { width: 88px; flex-shrink: 0; }
.thumb svg:not(.art) { width: 26px; height: 26px; color: var(--text-faint); }

/* Rows in lists (orders, payments, messages) */
.rows { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.row { display: flex; align-items: center; gap: var(--space-4); padding: 12px; border-radius: 22px; background: var(--surface); box-shadow: var(--edge), var(--lift); transition: box-shadow .25s var(--ease), transform .3s var(--ease); }
@media (hover: hover) { a.row:hover { box-shadow: var(--edge), var(--shadow); transform: translateY(-1px); } }
.row__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__end { display: grid; justify-items: end; gap: 6px; flex-shrink: 0; text-align: right; }
.row__chev { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }

/* Stars */

/* Banners inside pages (delays, reminders) */
.callout { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--tone, var(--accent)) 6%, var(--surface)); box-shadow: 0 0 0 1.5px var(--tone, var(--accent)); }
.callout > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--tone, var(--accent)); }
.callout__body { flex: 1; display: grid; gap: 6px; font-size: var(--fs-sm); }
.callout__body strong { font-size: var(--fs-md); }
.callout--warning { --tone: var(--warning); }
.callout--danger { --tone: var(--danger); }
.callout--success { --tone: var(--success); }

/* Page-wide offline strip */
/* Offline: the same glass pop-up as the other messages, under the top bar */
.offline-bar {
  position: fixed; z-index: 990; left: 50%; top: calc(env(safe-area-inset-top) + 84px); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 2 * var(--gutter));
  display: none; align-items: center; gap: 12px; padding: 12px 20px 12px 16px; min-height: 52px;
  border-radius: 26px; color: var(--text); font-size: var(--fs-sm); font-weight: 500; line-height: 1.4;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 0 0 1px var(--glass-line), var(--shadow);
}
.offline-bar svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--warning); }
html.is-offline .offline-bar { display: flex; animation: confirm-in .3s var(--spring); }

@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

/* ── Product card (js/lib/cards.js) ───────────────────── */
.pgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
@media (max-width: 599px) { .pgrid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.prod { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--edge), var(--lift); overflow: hidden; transition: box-shadow .35s var(--ease), transform .35s var(--ease); }
@media (hover: hover) { .prod:hover { transform: translateY(-4px); box-shadow: var(--edge), var(--shadow); } }
.prod__media { display: block; aspect-ratio: 1; margin: 8px 8px 0; border-radius: calc(var(--radius-lg) - 8px); background: var(--surface-2); overflow: hidden; }
.prod__media .art { width: 100%; height: 100%; transition: transform .6s var(--ease); }
@media (hover: hover) { .prod:hover .prod__media .art { transform: scale(1.05); } }
.prod__badges { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.prod__badges .pill { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.prod__body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 12px 14px 14px; }
.prod__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-faint); }
.prod__name { font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod__name::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.prod__name:focus-visible { border-radius: 6px; }
.prod__order { position: relative; z-index: 1; flex-shrink: 0; }
.prod__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.prod__price { display: grid; gap: 2px; min-width: 0; }
.prod__price strong { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.prod__price span { font-size: 11px; color: var(--text-faint); line-height: 1.3; }
@media (max-width: 599px) {
  .prod__body { padding: 10px 10px 12px; }
  .prod__badges { top: 12px; left: 12px; right: 12px; }
  .prod__badges .pill:nth-child(n+2) { display: none; }
    .prod__price strong { font-size: var(--fs-sm); }
  }

/* ── Order conversation (js/lib/chat.js) ──────────────── */
.chat { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; }
.chat__list { list-style: none; margin: 0; padding: 16px; mask-image: linear-gradient(transparent, #000 16px, #000 calc(100% - 8px), transparent); scroll-padding-top: 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 520px; min-height: 240px; }
.chat--compact .chat__list { max-height: 420px; }
.chat__day { align-self: center; margin: 8px 0; }
.chat__day span { padding: 4px 10px; border-radius: var(--radius-pill); background: var(--surface); font-size: 11px; color: var(--text-faint); }
.chat__empty { display: grid; justify-items: center; gap: 8px; margin: auto; text-align: center; color: var(--text-muted); font-size: var(--fs-sm); }
.chat__empty svg { width: 32px; height: 32px; color: var(--text-faint); }
.msg { display: flex; gap: 8px; max-width: 86%; }
.msg--me { align-self: flex-end; }
.msg--them { align-self: flex-start; }
.msg__avatar { display: grid; place-items: center; flex-shrink: 0; align-self: flex-end; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.msg__bubble { display: grid; gap: 4px; padding: 10px 12px 6px; border-radius: 18px; background: var(--surface); box-shadow: 0 1px 1px rgba(0,0,0,.04); min-width: 0; }
.msg--me .msg__bubble { background: var(--text); color: var(--bg); border-bottom-right-radius: 6px; }
[data-theme="dark"] .msg--me .msg__bubble { background: var(--accent); color: var(--accent-ink); }
.msg--them .msg__bubble { border-bottom-left-radius: 6px; }
.msg__who { font-size: 11px; font-weight: 600; color: var(--accent-text, var(--accent)); }
.msg__bubble p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); line-height: 1.45; }
.msg__meta { display: inline-flex; align-items: center; gap: 4px; justify-self: end; font-size: 10.5px; opacity: .6; }
.msg__meta svg { width: 12px; height: 12px; }
.msg__img img { display: block; max-width: min(240px, 100%); border-radius: 12px; }
.msg__file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, currentColor 8%, transparent); }
.msg__file svg { width: 22px; height: 22px; flex-shrink: 0; }
.msg__file span { display: grid; font-size: var(--fs-xs); min-width: 0; }
.msg__file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg--event { align-self: stretch; max-width: none; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.msg--event p { font-size: var(--fs-sm); line-height: 1.4; }
.msg--event .msg__meta { opacity: 1; color: var(--text-faint); }
.msg--event .msg__meta a, .msg--event .msg__meta button { color: var(--accent-text, var(--accent)); font-weight: 600; font-size: 11px; }
.msg__eicon { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; background: none; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--accent-text, var(--accent)); }
.msg__eicon svg { width: 16px; height: 16px; }
.msg--payment .msg__eicon { color: var(--success); }
.msg--delay .msg__eicon { color: var(--warning); }
.chat__compose { display: grid; gap: 8px; padding: 10px; background: var(--surface); border-top: 1px solid var(--line); }
.chat__row { display: flex; align-items: flex-end; gap: 6px; }
.chat__attach { cursor: pointer; display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; color: var(--text-muted); transition: background .2s var(--ease), color .2s var(--ease); }
@media (hover: hover) { .chat__attach:hover { background: var(--surface-2); color: var(--text); } }
.chat__attach:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
/* No scrollbar line beside chat and note text: they still scroll by touch, wheel and keys */
.chat__list, textarea.chat__input, .adm-reply textarea, .adm-notes, .adm-chat { scrollbar-width: none; }
.chat__list::-webkit-scrollbar, textarea.chat__input::-webkit-scrollbar, .adm-reply textarea::-webkit-scrollbar, .adm-notes::-webkit-scrollbar, .adm-chat::-webkit-scrollbar { display: none; }
textarea.chat__input { flex: 1; min-height: 44px; max-height: 140px; padding-block: 11px; border-radius: 22px; line-height: 1.4; resize: none; field-sizing: content; }
.chat__send { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); transition: transform .3s var(--spring); }
.chat__send:active { transform: scale(.9); }
.chat__send svg { width: 20px; height: 20px; }
.chat__attachment { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: var(--surface-2); font-size: var(--fs-xs); animation: err-in .25s var(--ease); }
.chat__attachment[hidden] { display: none; }
.chat__attachment img, .chat__attachment > svg { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.chat__attachment > span { display: grid; flex: 1; min-width: 0; }
.chat__attachment strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__attachment .icon-btn { width: 32px; height: 32px; }

/* ── Receipt (js/lib/receipt.js) ──────────────────────── */
/* Header and Download stay put; only the receipt scrolls */
.receipt-dialog { width: min(calc(100% - 32px), 560px); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: hidden; }
.rcpt { display: flex; flex-direction: column; max-height: inherit; }
.rcpt__top { display: flex; align-items: center; gap: 12px; padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.rcpt__top > div { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.rcpt__top strong { font-size: var(--fs-md, 1.0625rem); font-weight: 650; letter-spacing: -0.01em; }
.rcpt__top .mono { font-size: var(--fs-xs); color: var(--text-muted); }
.rcpt__x { margin-right: -4px; }
.rcpt__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-5); scrollbar-width: none; }
.rcpt__body::-webkit-scrollbar { display: none; }
.rcpt__foot { display: flex; justify-content: flex-end; gap: 8px; padding: var(--space-3) var(--space-5) var(--space-4); border-top: 1px solid var(--line); background: var(--surface); }
.rcpt__foot .btn { min-width: 176px; transition: background-color .2s var(--ease), color .2s var(--ease), transform .3s var(--spring); }
.rcpt__foot .btn.is-done { background: var(--success); border-color: var(--success); color: #fff; }
.receipt { display: grid; gap: var(--space-5); }
.receipt__logo { flex-shrink: 0; }
.receipt__totals { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.receipt__totals > div { display: grid; gap: 2px; padding: 14px 16px; min-width: 0; }
.receipt__totals > div + div { border-left: 1px solid var(--line); }
.receipt__totals dt { font-size: var(--fs-xs); color: var(--text-muted); }
.receipt__totals dd { font-size: var(--fs-md, 1.0625rem); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt__totals .is-left dd { color: var(--accent-text, var(--accent)); }
.receipt__sec { display: grid; gap: 4px; }
.receipt__sec h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--text); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.receipt__sec h3 .pill { text-transform: none; letter-spacing: 0; }
.receipt__sec .kv dd { overflow-wrap: anywhere; }
@media (max-width: 599px) {
  /* the same 10px each side as the other phone dialogs (100% pushed it off the right edge) */
  /* a sheet from the bottom with the page still showing above it, so it never sits
     stuck at the top (vh first for in-app browsers without dvh, e.g. older Telegram) */
  .receipt-dialog { width: calc(100% - 20px); height: auto; max-height: 86vh; max-height: 86dvh; padding-bottom: 0; inset: auto 0 0 0; margin: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .rcpt__body { padding: var(--space-4); }
  .rcpt__foot { padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); }
  .rcpt__foot .btn { flex: 1; }
  .receipt__totals > div { padding: 12px; }
  .receipt__totals > div { padding: 12px 10px; }
  /* a long total wraps after "ETB" instead of being cut to "ETB 100,4…" */
  .receipt__totals dd { font-size: var(--fs-sm); white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
}
@media (max-width: 560px) {
  .row__title, .row__sub { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
}

/* ── Email + code sign-in steps (js/lib/signin-flow.js): page and dialog ── */
.signin__step { position: relative; display: grid; gap: var(--space-4); }
.signin__step[hidden] { display: none; }
.signin__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: none; color: var(--accent-text, var(--text)); }
.signin__icon svg { width: 32px; height: 32px; }
.signin__icon--ok { color: var(--success); }
.signin__title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; }
.signin__text { color: var(--text-muted); }
.signin__text b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.signin__note { font-size: var(--fs-xs); color: var(--text-faint); text-align: center; }
.signin__back { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-muted); }
@media (hover: hover) { .signin__back:hover { background: var(--surface-2); } }
.signin__back svg { width: 18px; height: 18px; }

.code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code__box {
  width: 100%; height: 58px; text-align: center; font-size: 1.5rem; font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent; background: var(--field);
  color: var(--text); transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.code__box:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn.is-busy { opacity: .6; pointer-events: none; }


.signin__hint { color: var(--text-faint); font-size: var(--fs-sm); }
.signin__resend { justify-self: center; font-size: var(--fs-sm); }
.signin__resend:disabled { color: var(--text-faint); cursor: default; }
.signin__or { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: var(--fs-sm); }
.signin__or::before, .signin__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn--telegram { background: #1a84c4; color: #fff; }
@media (hover: hover) { .btn--telegram:hover { background: #1675b0; } }
.signin__lede { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-muted); }
/* "optional" next to a label */
.quote__hint { margin-left: 6px; color: var(--text-faint); font-size: var(--fs-xs); font-weight: 400; }
@media (max-width: 520px) {
  .prod__foot { flex-direction: column; align-items: stretch; }
  .prod__order { width: 100%; }
}
.field__hint > svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

/* Admin panel (/ahadu) has its own sidebar instead of the nav bar and footer */
body[data-page="ahadu"] > [data-component="header"],
body[data-page="ahadu"] > [data-component="footer"] { display: none; }
body[data-page="ahadu"] { padding-bottom: 0; }
body[data-page="ahadu"] .page { padding-top: 0; }

.art--photo { display: block; background: var(--surface-2, #f4f4f2); }

/* Product art sits on a lighter tile in dark mode so it doesn't sink into the page */
:root[data-theme="dark"] .thumb { background: color-mix(in srgb, var(--surface-2) 70%, #fff 8%); }

/* Number fields without the browser's up/down arrows */
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input[type="number"]::-webkit-inner-spin-button, .input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── "Needs your action" card (js/lib/action-card.js) ─────
   Phones: above the bottom tab bar. Desktop: bottom right. */
.act-card {
  position: fixed; z-index: 60; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  translate: -50% 0; width: min(calc(100% - 2 * var(--gutter)), 420px);
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 14px;
  border-radius: 26px; color: var(--text);
  /* the same glass as the nav bars and the pop-up messages (a little thicker: it holds more text) */
  background: var(--glass-strong); backdrop-filter: saturate(180%) blur(28px); -webkit-backdrop-filter: saturate(180%) blur(28px);
  box-shadow: inset 0 0 0 1px var(--glass-line), var(--shadow);
}
.act-card[hidden] { display: none; }
/* Slides away with the top and bottom bars while scrolling down */
.act-card { transition: transform .45s cubic-bezier(.22, 1, .36, 1), opacity .3s; }
.bars-hidden .act-card { transform: translateY(calc(100% + 120px)); opacity: 0; pointer-events: none; }
[data-theme="dark"] .act-card { box-shadow: inset 0 0 0 1px var(--glass-line), 0 18px 44px -14px rgba(0, 0, 0, .65); }
.act-card__icon {
  --tone: var(--accent-text, var(--accent));
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 13px;
  color: var(--tone); background: none; /* the icon alone, like the pop-up messages */
}
[data-theme="dark"] .act-card__icon { --tone: var(--accent); }
.act-card[data-kind="expiring"] .act-card__icon { --tone: var(--warning); }
.act-card[data-kind="confirm"] .act-card__icon { --tone: var(--success); }
.act-card__icon svg { width: 26px; height: 26px; }
.act-card__body { flex: 1; min-width: 0; display: grid; gap: 2px; padding-right: 22px; }
.act-card__title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.act-card__text { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-card__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; }
.act-card__more { margin-left: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text, var(--accent)); padding: 6px 4px; }
[data-theme="dark"] .act-card__more { color: var(--accent); }
.act-card__close {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted);
}
@media (hover: hover) { .act-card__close:hover { background: var(--surface-2); color: var(--text); } }
.act-card__close svg { width: 16px; height: 16px; }
@media (min-width: 960px) {
  .act-card { left: auto; right: 24px; bottom: 24px; translate: none; width: 380px; }
}

/* ── The Ahadu logo (js/lib/brand.js): the colour version on light
   backgrounds, the version for dark backgrounds in the dark theme ── */
.logo { display: inline-flex; align-items: center; flex-shrink: 0; line-height: 0; }
.logo__img { display: block; max-width: none; height: auto; }
.logo__img--dark, [data-theme="dark"] .logo__img--light { display: none; }
[data-theme="dark"] .logo__img--dark { display: block; }

/* ── Touch: a press you can feel ─────────────────────────
   Phones have no hover, so cards and list items answer the finger instead:
   a quick, soft press-in that springs back (hover lifts are for mice only). */
a.row, .prod, .channel, .hub, a.adm-tile, .phub__tile, .shot, .prow, .pshort, .adm-person, .qa summary, .tabs button, .tabs a, .chip, .side__item, .menu__item, .dd__option, .shop__sg, .choice, .qty button {
  -webkit-tap-highlight-color: transparent;
  transition-property: transform, box-shadow, background-color, color, border-color, opacity;
  transition-duration: .3s; transition-timing-function: var(--spring);
}
@media (hover: none) {
  a.row:active, .prod:active, .channel:active, .hub:active, a.adm-tile:active, .phub__tile:active, .shot:active, .prow:active, .choice:active { transform: scale(.98); transition-duration: .1s; }
  .tabs button:active, .tabs a:active, .chip:active, .qty button:active { transform: scale(.94); transition-duration: .1s; }
  .menu__item:active, .dd__option:active, .shop__sg:active, .pshort:active, .side__item:active, .adm-person:active, .qa summary:active { background: var(--surface-2); transition-duration: .05s; }
}

/* ── Photos (js/lib/photo.js) ──────────────────────────────
   A tiny blurred copy shows at once; the sharp photo fades in over it as
   soon as it has arrived (js/app.js marks it loaded), like social apps. */
.ph { position: relative; display: block; overflow: hidden; background: var(--surface-2, #f4f4f2); --ph-fit: contain; }
.ph--blur::before {
  content: ""; position: absolute; inset: 0; background: var(--ph) center / var(--ph-fit) no-repeat;
  filter: blur(14px) saturate(1.2); transform: scale(1.08); transition: opacity .5s var(--ease);
}
.ph__img { position: relative; display: block; width: 100%; height: 100%; object-fit: var(--ph-fit); transition: opacity .45s var(--ease); }
html.js-photos .ph__img:not(.is-loaded) { opacity: 0; }
.ph.is-loaded::before { opacity: 0; transition-delay: .4s; }
.art--photo { transition: transform .6s var(--ease); }
/* A quiet shimmer while a photo without a placeholder (an older link) loads */
.ph:not(.ph--blur):not(.is-loaded)::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--surface) 60%, transparent) 50%, transparent 70%) 0 0 / 200% 100%;
  animation: ph-shimmer 1.3s linear infinite;
}
@keyframes ph-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ph::after { animation: none; } .ph__img { transition: none; } }

/* Option pickers (colour, storage…): js/lib/options.js */
.opts { display: grid; gap: 20px; margin-top: var(--space-2); }
.opts__group { border: 0; padding: 0; margin: 0; min-width: 0; }
.opts__head { padding: 0; margin-bottom: 10px; font-size: var(--fs-sm); color: var(--text-muted); }
.opts__pills, .opts__dots { display: flex; flex-wrap: wrap; gap: 8px; }
.opts__dots { gap: 10px; padding: 5px; }
.opt-pill, .opt-dot { position: relative; display: inline-flex; cursor: pointer; }
.opt-pill input, .opt-dot input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.opt-pill span {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--edge), var(--lift); font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted);
  transition: background-color .2s var(--ease), color .2s, box-shadow .2s, transform .15s var(--ease);
}
@media (hover: hover) { .opt-pill:hover span { color: var(--text); } }
.opt-pill input:checked + span { background: var(--text); color: var(--bg); box-shadow: none; }
.opt-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-dot span { --ring: transparent; display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 3px var(--bg), 0 0 0 5px var(--ring); transition: box-shadow .2s var(--ease), transform .15s var(--ease); }
@media (hover: hover) { .opt-dot:hover span { --ring: var(--line-strong); } }
.opt-dot input:checked + span { --ring: var(--text); }
.opt-dot input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 6px; }
.opt-pill:active span, .opt-dot:active span { transform: scale(.95); }
.opt-pill.is-off span, .opt-dot.is-off span { opacity: .4; cursor: not-allowed; }
.opt-pill.is-off span { text-decoration: line-through; }
.opt-pill.is-off, .opt-dot.is-off, .opt-pill.is-off input, .opt-dot.is-off input { cursor: not-allowed; }

/* Time left to pay (js/lib/countdown.js) */
.paytimer { --tone: var(--accent-text, var(--accent)); position: relative; display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--line)); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--tone) 14%, transparent), transparent 60%), var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.paytimer.is-urgent { --tone: var(--warning); }
.paytimer.is-over { --tone: var(--danger); }
.paytimer__ring { position: relative; flex-shrink: 0; width: 64px; height: 64px; display: grid; place-items: center; }
.paytimer__ring svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.paytimer__ring circle { fill: none; stroke-width: 4; }
.paytimer__track { stroke: color-mix(in srgb, var(--tone) 16%, transparent); }
.paytimer__bar { stroke: var(--tone); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.paytimer__ring > svg:last-child { width: 24px; height: 24px; color: var(--tone); }
.paytimer.is-urgent .paytimer__ring > svg:last-child { animation: paytimer-flip 2.4s var(--ease, ease) infinite; }
.paytimer__body { display: grid; gap: 4px; min-width: 0; }
.paytimer__label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tone); }
.paytimer__clock { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; line-height: 1; }
.paytimer__clock span { display: inline-flex; align-items: baseline; gap: 2px; }
.paytimer__clock b { font-size: clamp(1.6rem, 6vw, 2rem); font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.paytimer__clock small { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--text-muted); }
.paytimer__clock i { font-style: normal; font-size: 1.4rem; color: var(--text-faint); }
.paytimer__note { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.paytimer__note strong { color: var(--text); font-weight: 600; }
@keyframes paytimer-flip { 0%, 70% { transform: rotate(0); } 85%, 100% { transform: rotate(180deg); } }
@media (prefers-reduced-motion: reduce) { .paytimer__bar { transition: none; } .paytimer.is-urgent .paytimer__ring > svg:last-child { animation: none; } }
