/* Brine-green ground, dark-pickle ink, one dill-green accent. Structure borrows from the panel on a
   supplement tub: heavy top rule, ruled key/value rows. System fonts only (no third-party requests). */
:root {
  --chalk: #e6eed6;
  --paper: #fbfdf5;
  --ink: #14250f;
  --muted: #52654a;
  --rule: #bccbA6;
  --pickle: #2e6b1a;
  --pickle-dark: #204f10;
  --ok: #1d6b2e;
  --warn: #8f5400;
  --bad: #b3261e;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--chalk); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--pickle); text-underline-offset: 2px; }
a:hover { color: var(--pickle-dark); }
:focus-visible { outline: 3px solid var(--pickle); outline-offset: 2px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 56px; min-height: 60vh; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: 1.25rem; }
.h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.small { font-size: .875rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.crumb { font-size: .9rem; margin-bottom: 14px; }

/* header / footer */
header.site { background: var(--ink); color: #fff; }
header.site .bar { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { color: #fff; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; text-decoration: none; }
header.site nav { display: flex; gap: 22px; align-items: center; }
header.site nav a, header.site nav .link { color: #fff; text-decoration: none; font-weight: 600; }
header.site nav a:hover, header.site nav .link:hover { text-decoration: underline; }
.count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--pickle); text-align: center; font-size: .8rem; }
footer.site { border-top: 1px solid var(--rule); background: var(--paper); padding: 28px 0 40px; }
.health { font-size: .875rem; color: var(--muted); max-width: 72ch; }
.inline { display: inline; margin: 0; }
.admin-bar { background: var(--pickle); }

/* the panel: heavy top rule, ruled rows */
.panel { background: var(--paper); border-top: 6px solid var(--ink); padding: 14px 16px 6px; margin: 0 0 20px; }
.rows > div, .facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--rule); }
.rows > div:first-child, .facts > div:first-child { border-top: 0; }
.rows dt, .facts dt { color: var(--muted); }
.rows dd, .facts dd { margin: 0; font-weight: 700; text-align: right; }
.rows.big { font-size: 1.05rem; }
.totals .grand { border-top: 3px solid var(--ink); font-size: 1.2rem; }
.totals .grand dt { color: var(--ink); font-weight: 800; }
.price { font-variant-numeric: tabular-nums; }
.tag { font-size: .8rem; font-weight: 700; padding: 1px 8px; border: 1.5px solid currentColor; border-radius: 3px; }
.tag.in { color: var(--ok); } .tag.low { color: var(--warn); } .tag.out { color: var(--bad); }

/* home */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px 32px; align-items: center; padding: 12px 0 36px; }
.logo-panel { grid-column: 1; grid-row: 1 / span 2; background: #000; border-top: 6px solid var(--ink); }
.logo-panel img { display: block; width: 100%; height: auto; }
.hero .lede { grid-column: 2; grid-row: 1; align-self: end; font-size: 1.3rem; color: var(--muted); margin: 0; }
.hero .facts { grid-column: 2; grid-row: 2; align-self: start; margin: 0; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { display: block; color: inherit; text-decoration: none; height: 100%; margin: 0; transition: border-color .15s; }
.card:hover { border-top-color: var(--pickle); }
.card h2 { margin: 12px 0 8px; }
.thumb { aspect-ratio: 1 / 1; background: var(--chalk); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { font-size: 5rem; font-weight: 800; color: var(--rule); }
.thumb.big { padding: 0; border-top-width: 6px; background: var(--paper); }
.thumb.big .ph { font-size: 9rem; }
.empty { padding: 28px; background: var(--paper); border: 1px dashed var(--rule); }

/* product page */
.pdp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.prose p { max-width: 62ch; }
.buy { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.legal h2 { margin-top: 1.6em; }

/* buttons + forms */
form + .totals, form + .panel { margin-top: 24px; }
.btn { display: inline-block; font: inherit; font-weight: 700; padding: 11px 20px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; border-radius: 2px; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--pickle); border-color: var(--pickle); color: #fff; }
.btn.primary:hover { background: var(--pickle-dark); border-color: var(--pickle-dark); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
button.link { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: var(--pickle); text-decoration: underline; text-underline-offset: 2px; }
.form { max-width: 560px; }
.form.narrow { max-width: 460px; }
.inline-form { margin-top: 28px; }
fieldset { border: 0; border-top: 3px solid var(--ink); padding: 14px 0 6px; margin: 0 0 22px; }
legend { font-weight: 800; padding: 0 12px 0 0; }
.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 5px; }
.opt { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]), select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 2px; }
input.qty { width: 5.5em; }
select#qty { width: auto; }
.has-error input, .has-error select { border-color: var(--bad); }
.err { color: var(--bad); font-weight: 600; margin: 6px 0 0; font-size: .9rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.notice { padding: 12px 14px; background: #fff7e0; border-left: 5px solid var(--warn); max-width: none; }
.two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.summary { list-style: none; margin: 0 0 16px; padding: 0; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); }

/* tables */
.table { width: 100%; border-collapse: collapse; background: var(--paper); margin: 0 0 20px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table thead th { border-bottom: 3px solid var(--ink); font-size: .85rem; color: var(--muted); }
.table tfoot th { border-top: 3px solid var(--ink); border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* status + admin */
.st { display: inline-block; font-weight: 700; font-size: .85rem; padding: 2px 10px; border-radius: 3px; background: var(--chalk); border: 1.5px solid var(--ink); }
.st-paid, .st-shipped { border-color: var(--ok); color: var(--ok); }
.st-pending, .st-processing { border-color: var(--warn); color: var(--warn); }
.st-expired, .st-invalid, .st-cancelled { border-color: var(--bad); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 5px 12px; border: 2px solid var(--ink); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; background: var(--paper); }
.chip.on { background: var(--ink); color: #fff; }
.addr { font-style: normal; font-size: 1.05rem; line-height: 1.6; padding-bottom: 14px; }
.status-line { margin-bottom: 8px; }

.live-total { flex-basis: 100%; font-weight: 800; font-size: 1.25rem; margin: 2px 0 0; }
.live-total:empty { display: none; }

/* stock alerts (admin) */
.alert { background: #fff4dc; border-left: 6px solid var(--warn); padding: 14px 18px; margin: 0 0 22px; }
.alert h2 { margin-bottom: .4em; }
.alert ul { list-style: none; margin: 0; padding: 0; }
.alert li { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.count.warn { background: var(--bad); }
.restock { display: flex; gap: 6px; align-items: center; }
.restock input { width: 5.5em; padding: 6px 8px; }
.btn.small { padding: 6px 12px; font-size: .9rem; }

@media (max-width: 760px) {
  .hero, .pdp, .two { grid-template-columns: 1fr; }
  .logo-panel, .hero .lede, .hero .facts { grid-column: 1; grid-row: auto; }
  .split { grid-template-columns: 1fr; }
  .card .thumb { aspect-ratio: 16 / 9; }
  .thumb .ph { font-size: 3.5rem; }
  .table.cart th:nth-child(2), .table.cart td:nth-child(2) { display: none; }
  header.site nav { gap: 14px; font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* contact line with Telegram icon */
.contact-line { display: flex; align-items: center; gap: 8px; }
.tg-icon { flex: none; }

/* ---- admin panel on phones: bottom tab bar, tables become cards, bigger tap targets ---- */
@media (max-width: 760px) {
  body.admin { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  body.admin main.wrap { padding: 18px 16px 24px; }
  body.admin h1 { font-size: 1.8rem; }
  body.admin header.site .bar { height: 52px; }
  body.admin header.site nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; gap: 0; align-items: stretch; justify-content: space-between;
    background: var(--ink); border-top: 3px solid var(--pickle); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.admin header.site nav > a, body.admin header.site nav > form { flex: 1 1 0; min-width: 0; display: flex; }
  body.admin header.site nav a, body.admin header.site nav button.link {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 56px; padding: 0 4px;
    font-size: .8rem; text-align: center; color: #fff; text-decoration: none;
  }
  body.admin header.site nav a:active, body.admin header.site nav button.link:active { background: var(--pickle-dark); }

  /* tables turn into one card per row, using each cell's data-label */
  body.admin .table.stack, body.admin .table.stack tbody, body.admin .table.stack tr, body.admin .table.stack td { display: block; width: 100%; }
  body.admin .table.stack { background: none; }
  body.admin .table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.admin .table.stack tr { background: var(--paper); border-top: 5px solid var(--ink); margin: 0 0 14px; padding: 4px 14px; }
  body.admin .table.stack td { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); text-align: right; }
  body.admin .table.stack td:last-child { border-bottom: 0; }
  body.admin .table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 600; text-align: left; flex: none; margin-right: auto; }
  body.admin .table.stack td a:not(.btn) { display: inline-block; padding: 8px 0; font-weight: 800; font-size: 1.1rem; }
  body.admin .table.stack td.name { font-weight: 800; }
  body.admin .table.stack td.act { justify-content: flex-end; }

  /* easy to tap, and no zoom-in when a field is focused on iPhone */
  body.admin .btn, body.admin .chip, body.admin select, body.admin input:not([type=checkbox]) { min-height: 44px; font-size: 16px; }
  body.admin .btn.small { min-height: 44px; }
  body.admin .form .btn, body.admin .inline-form .btn { width: 100%; text-align: center; }
  body.admin .chips { gap: 8px; }
  body.admin .check input { width: 24px; height: 24px; }
  body.admin .alert li { flex-wrap: wrap; }
  body.admin .rows dd { word-break: break-word; }
}
