/* Shared components: buttons, pills and badges, inputs, cards, dialogs, toasts, tables. Needs tokens.css and base.css. */

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 22px; border-radius: var(--r-pill);
  font-weight: var(--w-title); font-size: var(--t-body); line-height: 1.2; white-space: nowrap;
  background: var(--y-500); color: var(--on-y);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:hover { background: var(--y-600); transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: none; box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.dark { background: var(--ink); color: var(--sand); }
.btn.dark:hover { background: var(--ink-2); }
.btn.ghost, .btn.o { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--control); }
.btn.ghost:hover, .btn.o:hover { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); transform: none; }
.btn.wa, .btn.g { background: var(--moss); color: #fff; }
.btn.wa:hover, .btn.g:hover { background: #0b6a36; }
.btn.danger { background: var(--clay); color: #fff; }
.btn.sm, .btn.s { min-height: 40px; padding: 0 16px; font-size: var(--t-small); }
.btn.lg { min-height: 56px; padding: 0 28px; font-size: var(--t-body); }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: var(--w-label); cursor: pointer; }
.ib { /* icon button */
  width: var(--tap); height: var(--tap); border-radius: 50%; display: inline-grid; place-items: center; position: relative; color: var(--ink);
  transition: background var(--t-fast);
}
.ib:hover { background: var(--line); }
.ib .badge { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--ink); color: var(--y-500); font-size: var(--t-micro); font-weight: var(--w-title); display: grid; place-items: center; }

/* pills, chips, status */
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: var(--t-small); font-weight: var(--w-label); background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--control); white-space: nowrap;
}
.pill.on, .pill[aria-pressed="true"] { background: var(--ink); color: var(--sand); box-shadow: none; }
.pill.sm { min-height: 28px; padding: 0 10px; font-size: var(--t-micro); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--t-micro); font-weight: var(--w-title); background: var(--well); color: var(--ink); }
.chip.moss, .chip.ok { background: var(--moss-100); color: var(--moss); }
.chip.clay, .chip.low, .chip.bad { background: var(--clay-100); color: var(--clay); }
.chip.y { background: var(--y-100); color: var(--ink); }
.chip.sky { background: var(--sky-100); color: var(--sky); }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-micro); font-weight: var(--w-title); padding: 3px 9px 3px 7px; border-radius: var(--r-pill); background: var(--well); color: var(--stone); }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.y, .st.awaiting { background: var(--y-100); color: #6B5300; }
.st.g, .st.paid { background: var(--moss-100); color: var(--moss); }
.st.b, .st.dispatched { background: var(--sky-100); color: var(--sky); }
.st.r, .st.cancelled { background: var(--clay-100); color: var(--clay); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .st.y { color: var(--y-500); } }
:root[data-theme="dark"] .st.y { color: var(--y-500); }

/* inputs */
.fd { display: flex; flex-direction: column; gap: 6px; }
.fd label, .lbl { font-size: var(--t-small); font-weight: var(--w-label); color: var(--ink-2); }
.fd input, .fd select, .fd textarea, .input, .select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-2); border: 0;
  background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--control);
  transition: box-shadow var(--t-fast);
}
.fd textarea { min-height: 96px; resize: vertical; }
.fd input:focus, .fd select:focus, .fd textarea:focus, .input:focus, .select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.fd input[aria-invalid="true"], .fd .err-field { box-shadow: inset 0 0 0 2px var(--clay); }
.fd .hint { font-size: var(--t-micro); color: var(--stone); }
.fd .msg { font-size: var(--t-micro); color: var(--clay); font-weight: 500; min-height: 16px; }
.fg { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.fg .f { grid-column: 1 / -1; }
@media (max-width: 720px) { .fg { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--t-small); color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.qty { display: inline-flex; align-items: center; min-height: 48px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1.5px var(--control); background: var(--paper); }
.qty button { width: 44px; min-height: 48px; font-size: var(--t-title); border-radius: var(--r-pill); }
.qty b, .qty span { min-width: 28px; text-align: center; font-weight: var(--w-title); font-variant-numeric: tabular-nums; }
.qty.sm { min-height: 36px; } .qty.sm button { width: 34px; min-height: 36px; font-size: var(--t-body); }

/* cards and panels */
.panel { background: var(--paper); border-radius: var(--r-3); border: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: var(--t-body); font-weight: var(--w-title); letter-spacing: 0; }
.panel-body { padding: var(--s-5); }
.note { background: var(--well); border-radius: var(--r-2); padding: 12px 14px; font-size: var(--t-small); color: var(--ink-2); }
.note.sm, .note-sm { font-size: var(--t-micro); }
.empty { text-align: center; color: var(--stone); padding: var(--s-6) var(--s-4); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--well) 25%, var(--line) 37%, var(--well) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-2); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* dialogs and sheets */
dialog { border: 0; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(15, 14, 12, .5); backdrop-filter: blur(2px); }
dialog .pn { position: relative; width: min(720px, calc(100vw - 24px)); max-height: 92vh; overflow: auto; background: var(--paper); border-radius: var(--r-4); padding: var(--s-5); box-shadow: var(--sh-3); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; height: 100dvh; }
dialog.drawer .pn { width: min(440px, 100vw); height: 100%; max-height: none; border-radius: 0; display: flex; flex-direction: column; padding: 0; }
dialog.drawer .pn > #dlg-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
dialog.sheet { margin: auto 0 0; width: 100vw; }
dialog.sheet .pn { width: 100vw; max-height: 86vh; border-radius: var(--r-4) var(--r-4) 0 0; }
dialog .x { position: absolute; top: 12px; right: 12px; z-index: 3; width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; background: var(--paper); box-shadow: var(--sh-1); }
dialog .x svg { width: 20px; height: 20px; }
dialog .x:hover { background: var(--line); }
dialog h2[tabindex="-1"]:focus { outline: none; }
@media (max-width: 720px) {
  dialog:not(.drawer):not(.sheet) { margin: auto 0 0; width: 100vw; }
  dialog:not(.drawer):not(.sheet) .pn { width: 100vw; max-height: 94vh; border-radius: var(--r-4) var(--r-4) 0 0; padding: var(--s-4); }
}

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--sand); padding: 12px 18px; border-radius: var(--r-pill); font-size: var(--t-small); font-weight: var(--w-label); box-shadow: var(--sh-3); z-index: 60; max-width: calc(100vw - 32px); }
.toast.ok { background: var(--moss); color: #fff; }
.toast.bad { background: var(--clay); color: #fff; }
.toast { transition: opacity .2s, transform .2s; }
.toast:not(.show) { opacity: 0; transform: translate(-50%, 8px); pointer-events: none; }

/* tables (admin) */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
th { text-align: left; font-size: var(--t-micro); letter-spacing: .06em; text-transform: uppercase; color: var(--stone); font-weight: var(--w-title); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--well); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--well); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Back link: the same control on every page that goes back to the shop */
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px 0 12px; border-radius: var(--r-pill); color: var(--ink); font-weight: var(--w-label); font-size: var(--t-small); text-decoration: none; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--control); background: var(--paper); }
.back-link svg { flex: none; }
.back-link:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* Site footer: one design for the home page and the policy pages */
.site-ft { background: var(--ft-bg); color: var(--ft-text); margin-top: var(--s-7); padding: var(--s-7) 0 var(--s-5); font-size: var(--t-small); line-height: 1.6; }
.site-ft-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--s-6); }
.site-ft-h { margin: 0 0 var(--s-3); font-size: var(--t-micro); font-weight: var(--w-title); letter-spacing: .1em; text-transform: uppercase; color: var(--ft-head); }
.site-ft-col { display: grid; justify-items: start; align-content: start; }
.site-ft-col #ft-cats { display: grid; justify-items: start; }
.site-ft-brand p { margin: var(--s-3) 0 var(--s-4); max-width: 36ch; color: var(--ft-text); }
.site-ft .logo .wm { color: var(--ft-head); }
.site-ft .logo .wm-sub { color: var(--ft-muted); }
.site-ft a, .site-ft button { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 0; font: inherit; color: var(--ft-text); background: none; border: 0; text-align: left; text-decoration: none; }
.site-ft a:hover, .site-ft button:hover { color: var(--ft-head); text-decoration: underline; text-underline-offset: 3px; }
.site-ft a:focus-visible, .site-ft button:focus-visible { outline: 3px solid var(--y-500); outline-offset: 2px; border-radius: 4px; }
.site-ft-social { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; }
.site-ft-social a { width: var(--tap); height: var(--tap); padding: 0; justify-content: center; border-radius: 50%; }
.site-ft-social a { box-shadow: inset 0 0 0 1px #3A3733; color: var(--ft-head); }
.site-ft-social a:hover { box-shadow: inset 0 0 0 1px var(--y-500); color: var(--y-500); text-decoration: none; }
.site-ft-bot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-top: var(--s-5); padding-top: var(--s-5); border-top: 1px solid #2A2824; font-size: var(--t-micro); color: var(--ft-muted); }
@media (max-width: 880px) {
  .site-ft-grid { grid-template-columns: 1fr 1fr; }
  .site-ft-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-ft-grid { gap: var(--s-5) var(--s-4); }
}

/* Checkout: the saved delivery details of a signed-in customer */
.saved-to { display: grid; gap: var(--s-3); justify-items: start; }
.saved-to-body { margin: 0; line-height: 1.6; color: var(--ink); }
