/* Beannsofts design system: one stylesheet for every template's admin and storefront.
   Brand colours come from the business's settings through --brand and --accent on :root. */

:root {
  --brand: #1f6feb;
  --accent: #f59e0b;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, white);
  --brand-ink: color-mix(in srgb, var(--brand) 80%, black);
  --ink: #18212f;
  --ink-2: #4a5568;
  --ink-3: #8592a6;
  --line: #e6e9f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --side: #111a2c;
  --side-ink: #b6c0d4;
  --ok: #12a150;
  --ok-soft: #e3f6ec;
  --warn: #c27c0e;
  --warn-soft: #fdf3e1;
  --bad: #d93a3a;
  --bad-soft: #fde8e8;
  --info: #2f6fde;
  --info-soft: #e7effd;
  --muted-soft: #eef1f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side-w: 256px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
body.store { overflow-x: clip; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; text-decoration: none !important; background: var(--brand); color: #fff; transition: filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(.94); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--muted-soft); filter: none; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--muted-soft); filter: none; }
.btn-danger { background: var(--bad); }
.btn-success { background: var(--ok); }
.btn-accent { background: var(--accent); color: #1a1200; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .45rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label, .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.input, .select, .textarea, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=search], input[type=url], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 7rem; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.form-grid > .field { min-width: 0; }
/* a label that wraps its control: the control fills the field and the caption sits above it */
.field > label { display: flex; flex-direction: column; gap: .35rem; width: 100%; }
.field > label > input, .field > label > select, .field > label > textarea { width: 100%; min-width: 0; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding-top: .5rem; flex-wrap: wrap; }
.switch { position: relative; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: #cfd6e2; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }
.input-group { display: flex; } .input-group > * { border-radius: 0; } .input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.qty button { border: 0; background: transparent; width: 34px; height: 34px; font-size: 1.1rem; cursor: pointer; color: var(--ink-2); }
.qty input { width: 44px; border: 0; text-align: center; padding: 0; box-shadow: none !important; }

/* ---------- Cards, badges, alerts ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.1rem 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-foot { padding: .75rem 1.25rem; border-top: 1px solid var(--line); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600;
  background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: .7rem; font-weight: 700; background: var(--bad); color: #fff; }
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-ok { background: var(--ok-soft); border-color: #bfe8d1; color: #0b6b36; }
.alert-warn { background: var(--warn-soft); border-color: #f4dcae; color: #7a4d06; }
.alert-bad { background: var(--bad-soft); border-color: #f6c4c4; color: #8f1f1f; }
.alert-info { background: var(--info-soft); border-color: #c7d9fa; color: #1c4aa0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700;
  padding: .7rem 1rem; background: #f8f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--muted-soft); }
.cell-main { display: flex; align-items: center; gap: .75rem; }
.cell-main strong { display: block; font-weight: 600; }
.cell-main small { display: block; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 220px; max-width: 360px; position: relative; }
.toolbar .search .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.toolbar .search input { padding-left: 2.6rem; }
.toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); padding: 0 1rem; overflow-x: auto; }
.tabs a { padding: .75rem .85rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; }
.tabs a.active, .tabs a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1.25rem; font-size: .85rem; color: var(--ink-3); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: .25rem; }
.pagination .pages a, .pagination .pages span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); background: #fff; text-decoration: none; padding: 0 .5rem; }
.pagination .pages .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--ink-3); }
.empty > .icon { width: 44px; height: 44px; margin: 0 auto .75rem; color: #c3cad8; }
.empty h3 { color: var(--ink); font-size: 1.05rem; }
.empty p { max-width: 380px; margin: 0 auto 1rem; }

/* ================= Admin shell ================= */
.admin { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.02rem; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 800; overflow: hidden; }
.sidebar .brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.side-search { padding: .75rem 1rem .25rem; }
.side-search input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #fff; font-size: .85rem; padding: .5rem .7rem; }
.side-search input::placeholder { color: #7f8aa3; }
.nav-group { padding: .6rem .75rem .2rem; }
.nav-group > .nav-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f7b94; padding: .4rem .5rem; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: 8px; color: var(--side-ink); font-size: .9rem; text-decoration: none !important; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link .count { margin-left: auto; }
.nav-link .sub-count { margin-left: auto; font-size: .72rem; color: #8b97b0; }
.nav-sub { padding-left: 1.9rem; display: none; }
.nav-item.open > .nav-sub, .nav-item.active > .nav-sub { display: block; }
.nav-sub .nav-link { font-size: .84rem; padding: .4rem .6rem; }
.nav-item > .nav-link .chev { margin-left: auto; transition: transform .15s; width: 14px; height: 14px; }
.nav-item.open > .nav-link .chev { transform: rotate(90deg); }
.sidebar .side-foot { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .78rem; color: #7f8aa3; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .menu-btn { display: none; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--ink-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: .6rem; }
.page-head .crumbs { font-size: .8rem; color: var(--ink-3); margin-bottom: .2rem; }
.page-head .crumbs a { color: var(--ink-3); }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 1rem; }

/* KPI and status cards, the 6amTech dashboard look */
.kpi { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.kpi .kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi .kpi-label { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.kpi .kpi-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .kpi-delta { font-size: .78rem; font-weight: 600; }
.kpi .kpi-delta.up { color: var(--ok); } .kpi .kpi-delta.down { color: var(--bad); }
.kpi.tone-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi.tone-warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi.tone-bad .kpi-icon { background: var(--bad-soft); color: var(--bad); }
.kpi.tone-info .kpi-icon { background: var(--info-soft); color: var(--info); }
.status-tile { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--muted-soft); color: var(--ink-2); font-weight: 600; font-size: .88rem; text-decoration: none !important; }
.status-tile strong { font-size: 1.15rem; color: var(--ink); }
.status-tile.tone-ok { background: var(--ok-soft); } .status-tile.tone-warn { background: var(--warn-soft); }
.status-tile.tone-bad { background: var(--bad-soft); } .status-tile.tone-info { background: var(--info-soft); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars .bar span { position: absolute; bottom: -1.4rem; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--ink-3); white-space: nowrap; }
.list-rows > * { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); }
.list-rows > *:last-child { border-bottom: 0; }
.list-rows .grow { flex: 1; min-width: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; font-size: .9rem; margin: 0; }
.dl dt { color: var(--ink-3); } .dl dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.pending::before { background: #cfd6e2; }

/* Modal (native <dialog>) */
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, 94vw); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
dialog.modal .card-head { border-radius: var(--radius) var(--radius) 0 0; }

/* Flash messages */
.flashes { position: fixed; top: 72px; right: 1.25rem; z-index: 60; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, 92vw); }
.flashes .alert { box-shadow: var(--shadow-lg); margin: 0; }

/* POS register */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; height: calc(100vh - 60px - 3rem); }
.pos-products { display: flex; flex-direction: column; min-height: 0; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .65rem; overflow-y: auto; padding: 1rem; }
.pos-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; padding: .5rem; text-align: left; cursor: pointer; font: inherit; }
.pos-item:hover { border-color: var(--brand); }
.pos-item img, .pos-item .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--muted-soft); }
.pos-item strong { display: block; font-size: .82rem; margin-top: .35rem; line-height: 1.25; }
.pos-item span { font-size: .8rem; color: var(--brand); font-weight: 700; }
.pos-cart { display: flex; flex-direction: column; min-height: 0; }
.pos-cart .lines { flex: 1; overflow-y: auto; }
.pos-total { font-size: 1.5rem; font-weight: 800; }

/* Kitchen / order board */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.ticket { border-top: 4px solid var(--warn); }
.ticket.tone-info { border-top-color: var(--info); } .ticket.tone-ok { border-top-color: var(--ok); } .ticket.tone-bad { border-top-color: var(--bad); }
.ticket .items { margin: 0; padding: 0; list-style: none; font-size: .9rem; }
.ticket .items li { padding: .3rem 0; border-bottom: 1px dashed var(--line); }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--brand-soft), var(--bg)); }
.auth .card { width: min(420px, 100%); }
.auth .card-body { padding: 2rem; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; height: auto; }
}
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: min(var(--side-w), 86vw); transform: translateX(-100%); transition: transform .2s; }
  .admin.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .admin.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 40; }
  .topbar { padding: 0 1rem; } .topbar .menu-btn { display: inline-flex; }
  .topbar .user .name { display: none; }
  .content { padding: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem 1rem; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--ink-3); font-size: .78rem; text-align: left; }
  .table-stack td.actions { justify-content: flex-end; }
  .table-stack td.actions::before { content: none; }
}
@media (max-width: 520px) { .grid-4 { grid-template-columns: 1fr 1fr; } .kpi { padding: .9rem; gap: .7rem; } .kpi .kpi-icon { width: 38px; height: 38px; } .kpi .kpi-value { font-size: 1.15rem; } }

/* ================= Storefront ================= */
.store { background: #fff; }
.wrap { width: min(1240px, 100%); margin: 0 auto; padding: 0 1rem; }
.announce { background: var(--brand); color: #fff; font-size: .82rem; text-align: center; padding: .45rem 1rem; }
.announce a { color: #fff; text-decoration: underline; }
.shop-head { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); }
.shop-head > .row { display: flex; align-items: center; gap: 1rem; height: 68px; }
.shop-head .logo { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; flex: none; }
.shop-head .logo img { height: 40px; width: auto; }
.shop-search { flex: 1; position: relative; max-width: 620px; }
.shop-search input { border-radius: 99px; padding: .65rem 1rem .65rem 2.6rem; background: var(--bg); border-color: transparent; }
.shop-search .icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.head-icons { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.head-icon { position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .6rem; border-radius: 10px; color: var(--ink); font-size: .88rem; font-weight: 600; text-decoration: none !important; }
.head-icon:hover { background: var(--bg); }
.head-icon .count { position: absolute; top: 2px; right: 0; background: var(--brand); }
.cat-nav { border-top: 1px solid var(--line); }
.cat-nav .row { display: flex; gap: 1.25rem; overflow-x: auto; height: 46px; align-items: center; scrollbar-width: none; }
.cat-nav .row::-webkit-scrollbar { display: none; }
.cat-nav a { font-size: .88rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; text-decoration: none; }
.cat-nav a:hover, .cat-nav a.active { color: var(--brand); }
.section { padding-block: 2rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head a { font-size: .88rem; font-weight: 600; }
.hero-slider { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 16px; scrollbar-width: none; }
.hero-slider::-webkit-scrollbar { display: none; }
.hero-slide { scroll-snap-align: start; position: relative; min-height: 300px; display: flex; align-items: center; padding: 2.5rem; color: #fff;
  background: linear-gradient(120deg, var(--brand-ink), var(--brand)); background-size: cover; background-position: center; }
.hero-slide.has-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 15, 30, .72), rgba(10, 15, 30, .15)); }
.hero-slide > * { position: relative; max-width: 520px; }
.hero-slide h1, .hero-slide h2 { color: #fff; font-size: clamp(1.6rem, 4vw, 2.6rem); }
.hero-slide p { font-size: 1.05rem; opacity: .92; }
.hero-dots { display: flex; justify-content: center; gap: .4rem; margin-top: .6rem; }
.hero-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; background: #cfd6e2; padding: 0; cursor: pointer; }
.hero-dots button.on { width: 22px; background: var(--brand); }
.chips { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-cat { flex: none; width: 96px; text-align: center; color: var(--ink); font-size: .82rem; font-weight: 600; text-decoration: none !important; }
.chip-cat .ph, .chip-cat img { width: 76px; height: 76px; margin: 0 auto .4rem; border-radius: 50%; object-fit: cover; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .85rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: .85rem; font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.pill.on, .pill:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.p-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.p-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.p-card .media { position: relative; aspect-ratio: 1; background: var(--bg); }
.p-card .media img { width: 100%; height: 100%; object-fit: cover; }
.p-card .media .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--brand);
  background: linear-gradient(135deg, var(--brand-soft), var(--muted-soft)); font-size: 2.6rem; font-weight: 700; letter-spacing: .02em; }
.p-card .tag { position: absolute; top: .6rem; left: .6rem; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; }
.p-card .tag.new { background: var(--ok); }
.p-card .wish { position: absolute; top: .5rem; right: .5rem; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; color: var(--ink-2); }
.p-card .wish.on { color: var(--bad); } .p-card .wish.on .icon { fill: currentColor; }
.p-card .body { padding: .75rem .85rem .9rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.p-card .name { font-weight: 600; font-size: .92rem; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-decoration: none; }
.p-card .meta { font-size: .78rem; color: var(--ink-3); }
.p-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .35rem; }
.price { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.price .old { font-weight: 500; color: var(--ink-3); text-decoration: line-through; font-size: .82em; margin-left: .35rem; white-space: nowrap; }
.p-card .price .old { display: block; margin-left: 0; }
.price-lg { font-size: 1.6rem; }
.stars { display: inline-flex; align-items: center; gap: 1px; color: #f5a524; font-size: .8rem; }
.stars .icon { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.stars .off { color: #d9dee8; }
.stars small { margin-left: .3rem; color: var(--ink-3); }
.add-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.deal-strip { background: linear-gradient(120deg, #1d1530, #3b1f5c); color: #fff; border-radius: 16px; padding: 1.25rem; }
.deal-strip .section-head h2, .deal-strip .section-head a { color: #fff; }
.countdown { display: inline-flex; gap: .35rem; }
.countdown span { min-width: 42px; padding: .3rem .4rem; border-radius: 8px; background: rgba(255,255,255,.14); text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown span small { display: block; font-size: .6rem; font-weight: 600; opacity: .8; color: inherit; }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.promo { border-radius: 14px; padding: 1.5rem; min-height: 150px; background: var(--brand-soft); color: var(--ink); display: flex; flex-direction: column; justify-content: center; background-size: cover; background-position: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.feature { display: flex; gap: .8rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.feature .icon { width: 28px; height: 28px; color: var(--brand); }
.feature strong { display: block; font-size: .92rem; } .feature small { font-size: .8rem; }

/* Product page */
.pdp { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; padding-block: 1.5rem 2rem; }
.gallery .main-img { aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--bg); }
.gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: .5rem; margin-top: .6rem; overflow-x: auto; }
.gallery .thumbs button { flex: none; width: 70px; height: 70px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: var(--bg); }
.gallery .thumbs button.on { border-color: var(--brand); }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.option-group { margin: 1rem 0; }
.option-group .label { display: block; margin-bottom: .45rem; }
.options { display: flex; flex-wrap: wrap; gap: .45rem; }
.options label { cursor: pointer; }
.options input { position: absolute; opacity: 0; }
.options span { display: inline-block; padding: .45rem .85rem; border-radius: 10px; border: 1px solid var(--line); font-size: .88rem; font-weight: 600; }
.options input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.buy-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1.25rem 0; }
.sticky-buy { display: none; }
.review { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.review .who { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9rem; }
.rating-bars { display: grid; gap: .3rem; font-size: .8rem; }
.rating-bars .rb { display: grid; grid-template-columns: 2.2rem 1fr 2.5rem; align-items: center; gap: .5rem; }
.rating-bars .track { height: 8px; border-radius: 99px; background: var(--muted-soft); overflow: hidden; }
.rating-bars .track i { display: block; height: 100%; background: #f5a524; }

/* Listing with filters */
.listing { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.5rem; padding-block: 1.5rem 2rem; }
.filters .card-body { padding: 1rem; }
.filters h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 1rem 0 .5rem; }
.filters h4:first-child { margin-top: 0; }
/* Only a checkbox or radio row sits caption-beside-control. A label that wraps a text box or a select is a
   .field: caption above, control full width (see the "Form polish" block at the end of this file). */
.filters .check, .filters label:has(> input[type=checkbox]), .filters label:has(> input[type=radio]) {
  display: flex; align-items: center; gap: .5rem; font-size: .9rem; padding: .2rem 0; cursor: pointer; }
.sort-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.sort-row select { width: auto; }

/* Cart and checkout */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; padding-block: 1.5rem 2rem; align-items: start; }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.cart-line img, .cart-line .ph { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--bg); }
.summary .row { display: flex; justify-content: space-between; padding: .4rem 0; font-size: .92rem; }
.summary .total { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .8rem; }
.steps { display: flex; gap: .5rem; margin: 1rem 0 1.5rem; flex-wrap: wrap; }
.steps span { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.steps span b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--muted-soft); color: var(--ink-2); font-size: .78rem; }
.steps span.on { color: var(--brand); } .steps span.on b { background: var(--brand); color: #fff; }
.radio-card { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; margin-bottom: .5rem; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.track-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin: 1rem 0; }
.track-steps div { text-align: center; font-size: .8rem; font-weight: 600; color: var(--ink-3); padding-top: 2.2rem; position: relative; }
.track-steps div::before { content: ""; position: absolute; top: .3rem; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--muted-soft); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.track-steps div.done { color: var(--ok); } .track-steps div.done::before { background: var(--ok); }
.track-steps div.now { color: var(--brand); } .track-steps div.now::before { background: var(--brand); }

/* Account */
.account { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; padding-block: 1.5rem 2rem; }
.account-nav a { display: flex; align-items: center; gap: .6rem; padding: .65rem .85rem; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .9rem; text-decoration: none; }
.account-nav a.active, .account-nav a:hover { background: var(--brand-soft); color: var(--brand-ink); }
.wallet-card { border-radius: 16px; padding: 1.25rem; color: #fff; background: linear-gradient(130deg, var(--brand-ink), var(--brand)); }
.wallet-card .amount { font-size: 1.8rem; font-weight: 800; }

/* Footer and mobile bottom nav */
.shop-foot { background: #0f172a; color: #aab4c7; padding-block: 2.5rem 1rem; margin-top: 2rem; font-size: .9rem; }
.shop-foot h4 { color: #fff; font-size: .95rem; }
.shop-foot a { color: #aab4c7; display: block; padding: .2rem 0; }
.shop-foot .cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1.5rem; }
.shop-foot .legal { border-top: 1px solid rgba(255,255,255,.08); margin-top: 1.5rem; padding-top: 1rem; font-size: .8rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .listing, .cart-layout, .account, .pdp { grid-template-columns: minmax(0, 1fr); }
  .filters { order: 2; }
  .shop-foot .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body.store { padding-bottom: 64px; }
  .shop-head > .row { height: auto; flex-wrap: wrap; padding-block: .6rem; gap: .6rem; min-width: 0; }
  .shop-head .logo { font-size: .95rem; min-width: 0; flex: 1 1 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shop-search { order: 3; flex-basis: 100%; max-width: none; }
  .head-icons .label { display: none; }
  .hero-slide { min-height: 220px; padding: 1.5rem; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .p-card .body { padding: .6rem; }
  .section { padding-block: 1.25rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 62px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(16, 24, 40, .06); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; font-weight: 600; color: var(--ink-3); text-decoration: none; position: relative; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .count { position: absolute; top: 6px; left: 54%; }
  .sticky-buy { display: flex; gap: .5rem; position: fixed; left: 0; right: 0; bottom: 62px; z-index: 35; padding: .6rem 1rem; background: #fff; border-top: 1px solid var(--line); }
  .sticky-buy .btn { flex: 1; }
  .shop-foot .cols { grid-template-columns: 1fr; }
}

/* ---------- Form polish ----------
   One rule set for every form in a template, hand-written .field forms and the plain
   <label>Caption<input></label> forms in the admin alike. Rules that make a label and its control share a
   row do not belong here: a caption sits above its control, the control fills the width and is at least
   44px tall (a phone thumb). Checkbox, radio and switch rows are the only captions that sit beside a control. */
form label:not(.check):not(.switch):not(.radio-card):not(.inline):not(:has(> input[type=checkbox])):not(:has(> input[type=radio])) {
  display: flex; flex-direction: column; align-items: stretch; gap: .35rem; margin: 0 0 1rem; width: 100%; min-width: 0;
  font-size: .85rem; font-weight: 600; color: var(--ink-2); cursor: default; }
form label:has(> input[type=checkbox]), form label:has(> input[type=radio]), form .check {
  display: flex; align-items: center; gap: .6rem; margin: 0 0 .75rem; font-size: .92rem; font-weight: 500; color: var(--ink); cursor: pointer; }
form label input[type=checkbox], form label input[type=radio], form .check input { width: 18px; height: 18px; flex: none; margin: 0; }
/* a caption inside a .field has no bottom margin (beats the generic form-label margin above); the field's gap spaces it */
form .field > label, form .field-row > label, .field > label, .field-row > label { margin: 0 !important; }
.field:has(> label) { margin-bottom: 1rem; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]), select, textarea {
  min-height: 44px; font-size: 1rem; line-height: 1.35; }
textarea { min-height: 6.5rem; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.4rem; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238592a6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .9rem center; }
select[multiple] { background-image: none; padding-right: .75rem; min-height: 8rem; }
input::placeholder, textarea::placeholder { color: #a3aec0; }
input[type=color] { width: 64px; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
input[type=file] { width: 100%; padding: .55rem; border: 1px dashed #c4cddc; border-radius: var(--radius-sm); background: var(--bg); font: inherit; font-size: .9rem; color: var(--ink-2); }
input[type=file]::file-selector-button { margin-right: .75rem; padding: .5rem .9rem; border: 0; border-radius: var(--radius-sm); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { background: var(--muted-soft); color: var(--ink-3); cursor: not-allowed; }
.field-error, .error-text { color: var(--bad); font-size: .8rem; font-weight: 500; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--bad); }
form button[type=submit]:not(.btn), form input[type=submit]:not(.btn) { min-height: 44px; padding: .65rem 1.3rem; border: 0; border-radius: var(--radius-sm); background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

/* A form of two or more plain labels in a row is a settings or edit form: a card, two columns when there
   is room, headings, wide fields (textarea, file) and buttons across the full width. */
form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0 1.25rem; align-items: start;
  width: 100%; max-width: 980px; padding: 1.25rem 1.5rem; margin: 0 0 1.5rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) > :is(h1, h2, h3, h4, p, hr, button, input[type=submit], .btn, .form-actions, .hint, .flash, .alert, label:has(textarea), label:has(input[type=file]), label:has(> input[type=checkbox]), label:has(> input[type=radio]), .switch, .check, fieldset, table, div, section) {
  grid-column: 1 / -1; }
form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) > :is(h2, h3) {
  margin: 1rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 1.05rem; }
form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) > :is(h2, h3):first-child { border-top: 0; padding-top: 0; margin-top: 0; }
form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) > :is(button, input[type=submit], .btn) { justify-self: start; margin-top: .5rem; }
form.card:has(> label + label) { max-width: 980px; }

/* Storefront filters: stacked captions, two controls per row only when the sidebar is wide enough */
.filters .field > label, .filters-form .field > label { cursor: default; padding: 0; font-size: .82rem; }
.filters-grid { grid-template-columns: 1fr; gap: 0; }
.filters-actions { display: flex; gap: .5rem; margin-top: .25rem; }
.filters-actions .btn { flex: 1; justify-content: center; text-align: center; }
.shop-filters-sheet .filters-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 1rem; }

@media (max-width: 640px) {
  form:has(> label + label):not(.toolbar):not(.inline-form):not(.filters-form):not(.inline):not(.row-form):not(.auth *):not(.card-body *):not(dialog *):not(.modal *) { padding: 1rem; border-radius: var(--radius-sm); }
}

/* grid children may shrink below their content (a long <option> label must not widen the page) */
.pdp > *, .listing > *, .cart-layout > *, .account > * { min-width: 0; }
select, input, textarea { max-width: 100%; }
.add-form { padding: 1rem 1.15rem; margin: 1rem 0; }
.add-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
