/* ============ Tokens ============ */
:root {
  --bg: #f4f3ef;          /* off-white */
  --surface: #fbfaf8;
  --soft: #ebe9e3;        /* light gray */
  --soft-2: #e1ded7;
  --line: #e0ddd6;
  --text: #121211;        /* black */
  --text-2: #5c5a55;
  --text-3: #8d8a83;
  --ink: #121211;
  --on-ink: #f4f3ef;
  --ok: #2f6b3d;
  --err: #9b2c2c;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --header-h: 64px;
  --sb-w: 268px;
  --gutter: clamp(16px, 3vw, 32px);
  --ease: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.i { width: 1.15em; height: 1.15em; flex-shrink: 0; display: inline-block; vertical-align: -0.2em; }
.muted { color: var(--text-2); }
.hint { display: block; margin-top: 6px; color: var(--text-3); font-size: 13px; font-weight: 400; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  background: var(--ink); color: var(--on-ink);
  border: 1px solid var(--ink); border-radius: var(--r);
  font-weight: 500; font-size: 14px; white-space: nowrap;
}
.btn .i { width: 16px; height: 16px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--soft-2); }
.btn-inv { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }
.btn-block { width: 100%; }
.btn:disabled { background: var(--soft); color: var(--text-3); border-color: var(--soft); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--text-2);
}
.icon-btn .i { width: 18px; height: 18px; }
.link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.link .i { width: 14px; height: 14px; }

/* ============ Header ============ */
.topbar {
  background: var(--ink); color: var(--on-ink);
  font-size: 12.5px; text-align: center; padding: 8px var(--gutter);
  letter-spacing: 0.01em;
}
.header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 243, 239, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
}
.logo { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; font-family: "Unbounded", Inter, system-ui, sans-serif; font-size: 18px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; }
.logo .lg-a { padding: 4px 7px 5px; border: 2px solid var(--ink); border-radius: 7px; background: #fff; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; transition: transform .25s var(--ease); }
.logo:hover .lg-a { transform: rotate(-4deg); }
.logo .lg-b { color: var(--text); }
.hbtn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: var(--r);
  font-size: 14px; font-weight: 500;
}
.hbtn .i { width: 20px; height: 20px; }
.sb-toggle { padding: 0; width: 40px; justify-content: center; border: 1px solid var(--line); background: var(--surface); }
.sb-toggle .ic-expand { display: none; }
html.sb-closed .sb-toggle .ic-fold { display: none; }
html.sb-closed .sb-toggle .ic-expand { display: inline-block; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.badge {
  position: absolute; top: 2px; left: 24px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--ink); color: var(--on-ink);
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
  border: 2px solid var(--bg); box-sizing: content-box;
}

.search {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text-3);
}
.search:focus-within { border-color: var(--text-2); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }

/* ============ Layout + Sidebar ============ */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--header-h)); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - var(--header-h)); }
main { flex: 1; padding: 24px var(--gutter) 64px; }

.sidebar {
  position: sticky; top: var(--header-h);
  width: var(--sb-w); flex-shrink: 0;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
html.ready .sidebar { transition: margin-left .38s var(--ease), transform .38s var(--ease); }
html.sb-closed .sidebar { margin-left: calc(var(--sb-w) * -1); }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 8px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3);
}
.sb-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; overscroll-behavior: contain; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav a, .sidebar-foot a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.sidebar-nav a .i, .sidebar-foot a .i { width: 18px; height: 18px; }
.sidebar-nav a span { flex: 1; }
.sidebar-nav small { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sidebar-nav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.sidebar-nav a[aria-current="page"] small { color: var(--text-3); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.scrim { display: none; }

/* ============ Hero ============ */
.hero {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px;
  padding: clamp(24px, 4vw, 48px);
  background: var(--soft); border-radius: var(--r-lg);
}
.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 16px; }
.hero h1 { font-size: clamp(30px, 4.2vw, 52px); letter-spacing: -0.035em; line-height: 1.05; }
.hero p { margin-top: 16px; max-width: 46ch; color: var(--text-2); font-size: 16px; }
.hero-text { display: flex; flex-direction: column; justify-content: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.hero-text { min-width: 0; }
/* Stack the hero when the content column (not the viewport) gets narrow, e.g. with the sidebar open. */
main { container-type: inline-size; }
@container (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  aspect-ratio: 1.15; padding: 18px;
  background: var(--surface); border-radius: var(--r);
  font-weight: 600; font-size: 14px;
}
.tile .i { width: 34px; height: 34px; color: var(--text-2); }
.tile-product { gap: 10px; min-width: 0; }
.tile.tile-product { aspect-ratio: 1.15; } /* keeps room for the product on small screens too */
.tile-product img {
  flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; height: 0; object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(18, 18, 17, .16));
  transition: transform .35s var(--ease);
}
.tile-product span { line-height: 1.25; }
.tile-product:hover img { transform: translateY(-4px) scale(1.03); }
@media (prefers-reduced-motion: reduce) { .tile-product img { transition: none; } }

/* ============ Features ============ */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.feature { display: flex; gap: 14px; padding: 20px; }
.feature + .feature { border-left: 1px solid var(--line); }
.feature > .i { width: 24px; height: 24px; margin-top: 2px; }
.feature strong { font-size: 14px; font-weight: 600; }
.feature p { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ============ Sections ============ */
.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; }


/* ============ Popular brands ============ */
.brands { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.brand {
  display: grid; place-items: center;
  height: 104px; padding: 18px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .2s var(--ease);
}
.brand img {
  max-width: min(140px, 100%); max-height: 56px; width: auto; height: auto; object-fit: contain;
  mix-blend-mode: multiply; /* blends logos that ship with a white background */
  transition: transform .3s var(--ease);
}
.brand:hover { border-color: var(--text); }
.brand:hover img { transform: scale(1.05); }
@media (max-width: 1150px) { .brands { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) {
  .brands { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .brand { height: 80px; padding: 14px 10px; }
  .brand img { max-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .brand, .brand img { transition: none; } }

.cta {
  margin-top: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: clamp(24px, 4vw, 40px);
  background: var(--ink); color: var(--on-ink); border-radius: var(--r-lg);
}
.cta-title { font-size: clamp(20px, 2.4vw, 26px); }
.cta p { margin-top: 6px; color: #a7a49d; }

/* ============ Product grid / card ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px; min-width: 0;
}
.card-media {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 1; background: var(--soft); border-radius: var(--r-sm);
  color: #b9b5ad;
}
.card-media > .i { width: 38%; height: 38%; }
.tag {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.tag-dark { background: var(--ink); color: var(--on-ink); }
.tag-muted { background: var(--soft-2); color: var(--text-2); }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px 12px; flex: 1; }
.card-brand { font-size: 12px; color: var(--text-3); font-weight: 500; }
.card-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.card-pack { font-size: 13px; color: var(--text-2); }
.price { margin-top: 10px; font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.price s, .pd-price s { color: var(--text-3); font-weight: 400; font-size: 13px; margin-left: 4px; }
.price-lock {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.price-lock .i { width: 14px; height: 14px; }
.card .btn { height: 40px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 56px 16px; color: var(--text-2);
  background: var(--surface); border: 1px dashed var(--soft-2); border-radius: var(--r-lg);
}
.empty > .i { width: 40px; height: 40px; color: var(--text-3); }
.empty-lg { padding: 96px 16px; }
.empty-lg h1 { font-size: 28px; color: var(--text); }

/* ============ Listing ============ */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 16px; }
.crumbs .i { width: 12px; height: 12px; }
.crumbs span { color: var(--text-2); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.03em; }
.page-head p { margin-top: 6px; }
.sort { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
select {
  height: 40px; padding: 0 36px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath fill='%235c5a55' d='M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
  font-size: 14px;
}

/* ============ Product detail ============ */
.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); }
.pd-media {
  display: grid; place-items: center; aspect-ratio: 1;
  background: var(--soft); border-radius: var(--r-lg); color: #b9b5ad;
}
.pd-media .i { width: 34%; height: 34%; }
.pd-info h1 { font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -0.03em; margin: 6px 0 4px; }
.pd-price { margin: 22px 0; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pd-price small { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-3); margin-top: 4px; }
.price-lock-lg {
  display: flex; margin: 22px 0; padding: 14px 16px; font-size: 14px;
  background: var(--soft); border-radius: var(--r);
}
.buy { display: flex; gap: 10px; flex-wrap: wrap; }
.buy .btn { flex: 1; min-width: 180px; height: 48px; }
.qty {
  display: inline-flex; align-items: center;
  height: 48px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
}
.qty button { width: 42px; height: 100%; display: grid; place-items: center; color: var(--text-2); }
.qty button .i { width: 14px; height: 14px; }
.qty input {
  width: 48px; height: 100%; border: 0; background: transparent; text-align: center;
  font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: 0; }
.qty-sm { height: 38px; }
.qty-sm button { width: 34px; }
.qty-sm input { width: 38px; }

.specs { margin: 28px 0 0; border-top: 1px solid var(--line); }
.specs div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs dt { color: var(--text-2); }
.specs dd { margin: 0; font-weight: 500; text-align: right; }
.specs dd a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--soft-2); }
.pd-desc { margin-top: 20px; color: var(--text-2); font-size: 14px; }
.pd-perks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; font-size: 14px; }
.pd-perks li { display: flex; align-items: center; gap: 10px; }
.pd-perks .i { width: 18px; height: 18px; color: var(--text-2); }

/* ============ Auth ============ */
body.is-bare .sb-toggle { display: none; }
main.bare { padding: 0; }
.auth { min-height: calc(100vh - var(--header-h) - 34px); display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-card {
  width: 100%; max-width: 440px;
  padding: clamp(24px, 5vw, 40px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.auth-icon {
  width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--soft); border-radius: 50%; margin-bottom: 20px;
}
.auth-icon .i { width: 26px; height: 26px; }
.auth-card h1 { font-size: 26px; letter-spacing: -0.03em; }
.auth-card > .muted { margin-top: 6px; font-size: 14px; }
.auth-alt { margin-top: 20px; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-alt a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.form { display: grid; gap: 16px; margin-top: 24px; }
.form label { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.form label em { font-style: normal; font-weight: 400; color: var(--text-3); }
.form input {
  display: block; width: 100%; height: 46px; margin-top: 6px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg);
  font-size: 15px; outline: 0;
}
.form input:focus { border-color: var(--text); background: var(--surface); }
.form .btn { margin-top: 6px; height: 48px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 46px; }
.pw .icon-btn { position: absolute; right: 5px; top: 5px; }
.pw .icon-btn.on { color: var(--text); }

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 20px; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px;
}
.alert .i { margin-top: 2px; }
.alert-err { background: #f4e6e3; color: var(--err); }
.alert-ok { background: #e5ede4; color: var(--ok); }

/* ============ Account / Cart ============ */
.account { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel .specs { margin-top: 8px; border-top: 0; }
.panel .specs div:last-child { border-bottom: 0; }
.panel-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.quick { display: grid; gap: 6px; margin: 14px 0 18px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); border-radius: var(--r-sm); font-size: 14px; font-weight: 500; }

.cart { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cart-list { display: grid; gap: 10px; }
.cart-list .empty { grid-column: 1 / -1; }
.cart:has(.cart-sum[hidden]) { grid-template-columns: 1fr; }
.cart-sum { position: sticky; top: calc(var(--header-h) + 16px); }
.cart-sum .btn { margin-top: 18px; height: 48px; }
.line {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto auto; align-items: center; gap: 16px;
  padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.line-media { display: grid; place-items: center; aspect-ratio: 1; background: var(--soft); border-radius: var(--r-sm); color: #b9b5ad; }
.line-media .i { width: 40%; height: 40%; }
.line-info { display: flex; flex-direction: column; min-width: 0; }
.line-price { min-width: 100px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }

/* ============ Footer ============ */
.footer { background: var(--ink); color: #a7a49d; padding: 48px var(--gutter) 24px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer h4 { color: var(--on-ink); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.footer p { margin-bottom: 6px; }
.footer .i { width: 14px; height: 14px; margin-right: 4px; }
.logo-inv { color: var(--on-ink); margin-bottom: 14px; }
.logo-inv .lg-a { border-color: #fff; background: #fff; color: var(--ink); }
.logo-inv .lg-b { color: var(--on-ink); }
.muted-inv { max-width: 32ch; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid #2a2927; font-size: 12.5px; color: #75726c; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: var(--r);
  background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 500;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ Responsive ============ */
@media (max-width: 1200px) {
  .features { grid-template-columns: 1fr; }
  .feature + .feature { border-left: 0; border-top: 1px solid var(--line); }
}

/* Mobile / tablet: the category sidebar becomes a sliding drawer */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    height: 100vh; height: 100dvh;
    width: min(86vw, 320px);
    margin-left: 0 !important;
    transform: translateX(-100%);
    background: var(--surface);
    border-right: 1px solid var(--line);
  }
  html.sb-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .12); }
  .sidebar-head { padding: 14px 12px 8px 20px; }
  .sb-close { display: inline-grid; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(18, 18, 17, .35);
    opacity: 0; pointer-events: none;
  }
  html.ready .scrim { transition: opacity .3s var(--ease); }
  html.sb-open .scrim { opacity: 1; pointer-events: auto; }

  /* on mobile the toggle always shows the "expand" icon */
  .sb-toggle .ic-fold { display: none !important; }
  .sb-toggle .ic-expand { display: inline-block !important; }

  .hero { grid-template-columns: 1fr; }
  .pd { grid-template-columns: 1fr; }
  .pd-media { aspect-ratio: 4 / 3; }
  .account, .cart { grid-template-columns: 1fr; }
  .cart-sum { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --header-h: 112px; }
  .header-row { height: auto; flex-wrap: wrap; row-gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .hbtn-label { display: none; }
  .hbtn { padding: 0 10px; }
  .header-actions .hbtn { width: 40px; justify-content: center; padding: 0; }
  .badge { left: 22px; }
  .logo { margin-right: 0; }
  .topbar { font-size: 11.5px; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  main { padding-top: 16px; }
  .hero { padding: 24px 20px; border-radius: var(--r); }
  .hero-tiles { gap: 8px; }
  .tile { aspect-ratio: auto; min-height: 104px; padding: 14px; gap: 16px; font-size: 13px; }
  .tile .i { width: 26px; height: 26px; }
  .hero-actions .btn { flex: 1; }
  .features { grid-template-columns: 1fr; }
  .feature + .feature { border-left: 0; border-top: 1px solid var(--line); }
  .section { margin-top: 36px; }
  .section-head h2 { font-size: 19px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 8px; }
  .card-body { padding: 10px 2px; }
  .card-title { font-size: 13.5px; }
  .card .btn { height: 38px; padding: 0 10px; font-size: 13px; }
  .form-row { grid-template-columns: 1fr; }
  .line { grid-template-columns: 60px minmax(0, 1fr) auto; row-gap: 10px; }
  .line-media { grid-row: span 2; }
  .line .qty { grid-column: 2; justify-self: start; }
  .line-price { grid-column: 3; grid-row: 2; min-width: 0; }
  .line-del { grid-column: 3; grid-row: 1; justify-self: end; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .sort { width: 100%; }
  .sort select { flex: 1; }
}

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

/* ============ Language switch ============ */
.lang {
  display: inline-flex; align-items: center; gap: 2px;
  height: 32px; padding: 2px; margin-right: 6px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
}
.lang a {
  display: grid; place-items: center; height: 26px; min-width: 34px; padding: 0 8px;
  border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0.02em;
}
.lang a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }

/* ============ Cart drawer (slides in from the right) ============ */
.cart-drawer {
  position: fixed; top: 0; right: 0; z-index: 70;
  width: min(100vw, 420px); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%);
  visibility: hidden;
}
html.ready .cart-drawer { transition: transform .38s var(--ease), visibility 0s linear .38s; }
html.cart-open .cart-drawer {
  transform: translateX(0); visibility: visible;
  box-shadow: 0 0 60px rgba(0, 0, 0, .12);
}
html.ready.cart-open .cart-drawer { transition: transform .38s var(--ease), visibility 0s; }
.cart-scrim {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(18, 18, 17, .35);
  opacity: 0; pointer-events: none;
}
html.ready .cart-scrim { transition: opacity .3s var(--ease); }
html.cart-open .cart-scrim { opacity: 1; pointer-events: auto; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); min-height: 64px; padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--line); font-size: 16px;
}
.drawer-head .muted { font-weight: 500; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: grid; gap: 8px; align-content: start; }
.drawer-body .empty { border: 0; background: transparent; padding: 64px 16px; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-foot .specs { margin: 0 0 6px; border-top: 0; }
.drawer-foot .specs div { padding: 8px 0; }
.drawer-foot .specs div:last-child { border-bottom: 0; font-size: 16px; }
.drawer-foot .btn { height: 46px; }

/* compact line layout inside the drawer */
.drawer-body .line { grid-template-columns: 60px minmax(0, 1fr) auto; row-gap: 10px; gap: 12px; }
.drawer-body .line-media { grid-row: span 2; }
.drawer-body .line .qty { grid-column: 2; justify-self: start; }
.drawer-body .line-price { grid-column: 3; grid-row: 2; min-width: 0; }
.drawer-body .line-del { grid-column: 3; grid-row: 1; justify-self: end; }

@media (max-width: 760px) {
  .lang { margin-right: 0; }
  .lang a { min-width: 30px; padding: 0 6px; }
}
@media (max-width: 380px) {
  .logo { font-size: 19px; }
  .header-row { gap: 8px; }
}

/* ============ Product slider ============ */
.slider-nav { display: flex; align-items: center; gap: 8px; }
.slider-nav .link { margin-right: 8px; }
.arrow {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.arrow .i { width: 16px; height: 16px; }
.arrow:disabled { background: transparent; color: var(--soft-2); cursor: default; }

.slider-track {
  --per: 5;
  --gap: 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--per) - 1) * var(--gap)) / var(--per));
  gap: var(--gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  outline-offset: 4px;
}
.slider-track::-webkit-scrollbar { display: none; }
.slide { display: flex; min-width: 0; scroll-snap-align: start; }
.slide .card { flex: 1; }
@media (pointer: fine) { .slider-track { cursor: grab; } }
.slider-track.dragging { scroll-snap-type: none; scroll-behavior: auto; cursor: grabbing; user-select: none; }
.slider-track.dragging a, .slider-track.dragging button { pointer-events: none; }

.slider-progress { height: 2px; margin-top: 20px; background: var(--line); border-radius: 2px; overflow: hidden; }
.slider-progress span { display: block; height: 100%; width: 20%; background: var(--ink); border-radius: 2px; will-change: transform; }
[data-slider].is-static .arrow, [data-slider].is-static .slider-progress { display: none; }

@media (max-width: 1500px) { .slider-track { --per: 4; } }
@media (max-width: 1150px) { .slider-track { --per: 3; } }
@media (max-width: 760px) {
  /* full-bleed track with a peek of the next card */
  .slider-track {
    --per: 2.2; --gap: 8px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .arrow { width: 36px; height: 36px; }
  .slider-nav .link { margin-right: 4px; font-size: 13px; }
  .slider-progress { margin-top: 16px; }
}
@media (max-width: 420px) { .slider-track { --per: 1.7; } }

/* ============ Live search overlay ============ */
.search-overlay { position: fixed; inset: 0; z-index: 90; visibility: hidden; pointer-events: none; }
.search-overlay.open { visibility: visible; }
.so-backdrop {
  position: absolute; inset: 0;
  background: rgba(244, 243, 239, .55);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0; transition: opacity .35s var(--ease);
}
.search-overlay.open .so-backdrop { opacity: 1; pointer-events: auto; }
.so-panel {
  position: relative; height: 100%;
  max-width: 760px; margin: 0 auto;
  padding: 16px var(--gutter) 16px;
  display: flex; flex-direction: column;
  pointer-events: none; /* empty space falls through to the backdrop */
}
.so-bar {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  height: 52px; padding: 0 6px 0 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(18, 18, 17, .07);
  color: var(--text-3);
  max-width: 100%;
  transition: transform .5s var(--ease), width .5s var(--ease);
}
.so-bar .i { width: 18px; height: 18px; }
.so-bar input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 16px; /* 16px avoids iOS zoom-on-focus */
}
.so-bar input::placeholder { color: var(--text-3); }
.so-bar input::-webkit-search-cancel-button { display: none; }
.so-cancel { height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); }

.so-results {
  pointer-events: auto;
  margin-top: 10px; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(18, 18, 17, .06);
  opacity: 0; transform: translateY(10px);
  transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.search-overlay.open .so-results { opacity: 1; transform: none; transition-delay: .08s; }
.search-overlay.closing .so-results { opacity: 0; transform: translateY(10px); transition-delay: 0s; }
.search-overlay.closing .so-backdrop { opacity: 0; }
.so-results:empty { display: none; }

.so-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.so-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 16px;
  animation: so-in .4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.so-item + .so-item { border-top: 1px solid var(--line); }
.so-item:focus-visible { outline-offset: -2px; background: var(--bg); }
.so-thumb {
  width: 52px; height: 52px; border-radius: 10px;
  display: grid; place-items: center; background: var(--soft); color: #b9b5ad;
}
.so-thumb .i { width: 22px; height: 22px; }
.so-text { display: flex; flex-direction: column; min-width: 0; }
.so-name { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-name mark { background: none; color: var(--text); font-weight: 700; }
.so-meta { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-price { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.so-price small { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.so-price small .i { width: 12px; height: 12px; }
.so-all {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 16px; border-top: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
  animation: so-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.so-all .i { width: 14px; height: 14px; }
.so-empty { padding: 36px 20px; text-align: center; color: var(--text-2); font-size: 14px; animation: so-in .4s var(--ease) both; }
.so-empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.so-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 16px; }
.so-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 99px;
  font-size: 13.5px; font-weight: 500;
  animation: so-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.so-chip .i { width: 16px; height: 16px; color: var(--text-2); }

/* skeleton rows */
.sk {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--soft) 0%, var(--soft-2) 40%, var(--soft) 80%);
  background-size: 250% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
.sk-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) 56px; align-items: center; gap: 14px; padding: 10px 16px; }
.sk-item + .sk-item { border-top: 1px solid var(--line); }
.sk-thumb { width: 52px; height: 52px; border-radius: 10px; }
.sk-lines { display: grid; gap: 8px; }
.sk-l1 { height: 12px; width: 70%; }
.sk-l2 { height: 10px; width: 42%; }
.sk-price { height: 12px; width: 56px; }
.sk-item:nth-child(2n) .sk-l1 { width: 55%; }
.sk-item:nth-child(3n) .sk-l1 { width: 80%; }

@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes so-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 760px) {
  .so-panel { padding: 10px 12px 12px; }
  .so-bar { height: 50px; border-radius: 12px; }
  .so-results { border-radius: 12px; }
  .so-item, .sk-item { padding: 10px 12px; gap: 12px; }
}

.order-error { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--r-sm); background: #f6e7e5; color: var(--err); font-size: 13px; line-height: 1.4; }

/* ============ Themed dropdown (enhances the native <select>) ============ */
.dd { position: relative; display: flex; align-items: center; gap: 10px; }
.dd-label { white-space: nowrap; }
.dd-btn, .dd-menu { display: none; }
html.js .dd-native { display: none; }
html.js .dd-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 40px; min-width: 190px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: 14px; white-space: nowrap;
}
.dd-btn:hover, .dd.open .dd-btn { border-color: var(--text-2); }
.dd-caret { width: 14px; height: 14px; color: var(--text-2); transition: transform .2s var(--ease); }
.dd.open .dd-caret { transform: rotate(180deg); }
html.js .dd-menu {
  display: block; position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 100%; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(18, 18, 17, .12);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease), visibility 0s .16s;
}
html.js .dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.dd-menu:focus { outline: none; }
.dd-menu [role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 10px; border-radius: 6px; font-size: 14px; color: var(--text); white-space: nowrap; cursor: pointer;
}
.dd-menu [role="option"].is-active { background: var(--soft); }
.dd-check { width: 14px; height: 14px; visibility: hidden; }
.dd-menu [aria-selected="true"] { font-weight: 600; }
.dd-menu [aria-selected="true"] .dd-check { visibility: visible; }
@media (max-width: 640px) {
  .dd { flex: 1; }
  html.js .dd-btn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .dd-caret, html.js .dd-menu { transition: none; } }

/* ============ Listing toolbar + view switch ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-switch {
  display: inline-flex; gap: 2px; height: 40px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.view-switch button { width: 34px; height: 100%; display: grid; place-items: center; border-radius: 7px; color: var(--text-3); }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.view-switch .i { width: 16px; height: 16px; }

.card-extra, .card-desc { display: none; }

/* ---- List view: compact rows ---- */
html[data-view="list"] .listing { grid-template-columns: 1fr; gap: 8px; }
html[data-view="list"] .listing .card {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) minmax(150px, 190px);
  align-items: center; gap: 16px; padding: 8px;
}
html[data-view="list"] .listing .card-media > .i { width: 44%; height: 44%; }
html[data-view="list"] .listing .tag { top: 4px; left: 4px; padding: 2px 5px; font-size: 9.5px; }
html[data-view="list"] .listing .card-body { padding: 0; }
html[data-view="list"] .listing .price, html[data-view="list"] .listing .price-lock { margin-top: 6px; }

/* ---- Large view: one full-width product card per row ---- */
html[data-view="large"] .listing { grid-template-columns: 1fr; gap: 14px; }
html[data-view="large"] .listing .card {
  display: grid; grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  grid-template-rows: 1fr auto; column-gap: 28px; padding: 14px;
}
html[data-view="large"] .listing .card-media { grid-row: 1 / span 2; }
html[data-view="large"] .listing .card-body { padding: 8px 0 0; gap: 4px; }
html[data-view="large"] .listing .card-brand { font-size: 13px; }
html[data-view="large"] .listing .card-title { font-size: clamp(18px, 2vw, 22px); letter-spacing: -0.02em; }
html[data-view="large"] .listing .card-pack { font-size: 14px; }
html[data-view="large"] .listing .card-extra {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin: 14px 0 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
html[data-view="large"] .listing .card-extra dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
html[data-view="large"] .listing .card-extra dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }
html[data-view="large"] .listing .card-desc { display: block; margin-top: 12px; max-width: 62ch; font-size: 13.5px; color: var(--text-2); }
html[data-view="large"] .listing .price { font-size: 20px; margin-top: 14px; }
html[data-view="large"] .listing .card-buy { justify-self: start; margin-top: 14px; }
html[data-view="large"] .listing .card-buy .btn { min-width: 160px; height: 44px; }
html[data-view="large"] .listing .qty-card { height: 44px; }

/* ============ Mobile: tighter horizontal rhythm ============ */
@media (max-width: 640px) {
  :root { --gutter: 12px; }
  .header-row { gap: 8px; }
  .hero { padding: 22px 16px; }
  .hero-tiles { gap: 6px; }
  .tile { padding: 12px; }
  .feature { padding: 14px 14px; gap: 12px; }
  .cta { padding: 22px 16px; }
  .grid { gap: 6px; }
  .card { padding: 6px; }
  .card-body { padding: 10px 4px; }
  .panel { padding: 16px 14px; }
  .auth { padding: 24px var(--gutter); }
  .auth-card { padding: 22px 16px; }
  .footer { padding-top: 36px; }
  .drawer-body { padding: 10px; }
  .drawer-head { padding: 0 8px 0 14px; }
  .drawer-foot { padding: 14px; }
  .line { padding: 8px; gap: 10px; }
  .sidebar-nav { padding: 4px 8px 12px; }
  .sidebar-foot { padding: 10px 8px; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .toolbar { width: 100%; }
  .toolbar .sort { flex: 1; width: auto; }

  html[data-view="list"] .listing .card { grid-template-columns: 76px minmax(0, 1fr); gap: 4px 12px; padding: 6px; }
  html[data-view="list"] .listing .card-buy { grid-column: 2; }
  html[data-view="list"] .listing .card-body { padding: 2px 0 0; }
  html[data-view="list"] .listing .card-media { grid-row: span 2; align-self: start; }

  html[data-view="large"] .listing .card { grid-template-columns: 1fr; padding: 8px; }
  html[data-view="large"] .listing .card-media { grid-row: auto; aspect-ratio: 4 / 3; }
  html[data-view="large"] .listing .card-body { padding: 12px 4px 0; }
  html[data-view="large"] .listing .card-buy { justify-self: stretch; }
  html[data-view="large"] .listing .card-buy .btn { min-width: 0; flex: 1; }
}
@media (max-width: 380px) { :root { --gutter: 10px; } }

/* ============ Card: quantity + add ============ */
.card-buy { display: flex; gap: 6px; margin-top: auto; }
.card-buy .btn { flex: 1; min-width: 0; height: 40px; padding: 0 12px; }
.qty-card { height: 40px; border-radius: 10px; flex-shrink: 0; }
.qty-card button { width: 30px; }
.qty-card input { width: 32px; font-size: 14px; }
.price small { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* variant hints on the card */
.vbadge {
  position: absolute; left: 8px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface); color: var(--text-2);
  font-size: 11px; font-weight: 600;
}
.vbadge .i { width: 11px; height: 11px; }
.card-variants {
  margin-top: 4px; font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* list view: quantity + add sit on the right */
html[data-view="list"] .listing .card-buy { margin-top: 0; }
html[data-view="list"] .listing .vbadge { display: none; }

/* ============ Variant rows (modal + product page) ============ */
.vm-label { padding: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.vrow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.vrow + .vrow { margin-top: 6px; }
.vrow-thumb {
  display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; flex: none;
  border-radius: var(--r-sm); background: hsl(var(--h, 40) 30% 91%); color: hsl(var(--h, 40) 28% 36%);
}
.vrow-thumb .i { width: 22px; height: 22px; }
.vrow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vrow.is-out .vrow-thumb { filter: grayscale(1); }
.vrow.is-picked { border-color: var(--text); }
.vrow.is-out { opacity: .55; }
.vrow-name { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; min-width: 0; }
.vrow-name small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.vrow-price { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vrow .qty button:disabled { color: var(--soft-2); cursor: not-allowed; }
.vlist { margin-top: 22px; }
.vlist .btn { margin-top: 14px; height: 48px; }

/* ============ Variant modal: bottom sheet (mobile) / dialog (desktop) ============ */
.vmodal { position: fixed; inset: 0; z-index: 85; visibility: hidden; pointer-events: none; }
.vmodal.open { visibility: visible; pointer-events: auto; }
.vm-backdrop {
  position: absolute; inset: 0; background: rgba(18, 18, 17, .35);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .3s var(--ease);
}
.vmodal.open .vm-backdrop { opacity: 1; }
.vm-panel {
  position: absolute; left: 50%; top: 50%;
  width: min(480px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px));
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(18, 18, 17, .18);
  transform: translate(-50%, calc(-50% + 16px)) scale(.98); opacity: 0;
  transition: transform .4s var(--ease), opacity .3s var(--ease);
}
.vmodal.open .vm-panel { transform: translate(-50%, -50%); opacity: 1; }
.vmodal.instant .vm-panel, .vmodal.instant .vm-backdrop { transition: none; }
.vm-head { display: flex; align-items: center; gap: 14px; padding: 16px 12px 16px 16px; border-bottom: 1px solid var(--line); }
.vm-thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: #b9b5ad; }
.vm-thumb .i { width: 26px; height: 26px; }
.vm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vm-info strong { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.vm-panel > .vm-label { padding: 16px 16px 8px; }
.vm-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 8px; }
.vm-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.vm-foot .btn { height: 48px; }

@media (max-width: 640px) {
  .vm-panel {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%;
    max-height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: 0;
    transform: translateY(100%); opacity: 1;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .vmodal.open .vm-panel { transform: translateY(0); }
  .vm-panel::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px;
    margin-left: -18px; border-radius: 2px; background: var(--soft-2);
  }
  .vm-head { padding-top: 20px; }
  .vrow { gap: 10px; padding: 8px 10px; }
  .vrow-thumb { width: 38px; height: 38px; }
}

/* ============ Cart: variant label, totals, delivery ============ */
.line-variant { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.specs .sum-total dt, .specs .sum-total dd { color: var(--text); font-weight: 600; font-size: 16px; }
.delivery-hint { margin: 4px 0 6px; padding: 12px; border-radius: var(--r-sm); background: var(--bg); font-size: 13px; color: var(--text-2); }
.dh-text { display: flex; align-items: flex-start; gap: 8px; }
.dh-text .i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--text); }
.dh-bar { height: 4px; margin-top: 10px; border-radius: 2px; background: var(--soft-2); overflow: hidden; }
.dh-bar span { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .4s var(--ease); }
.cart-sum .delivery-hint { margin-top: 12px; }

/* ============ Lazy loading ============ */
.more { display: flex; justify-content: center; margin-top: 20px; }
.more.is-auto { height: 1px; margin: 0; overflow: hidden; opacity: 0; } /* infinite scroll takes over */
.sk-card { display: flex; flex-direction: column; gap: 8px; }
.sk-card .sk-media { aspect-ratio: 1; border-radius: var(--r-sm); }
.sk-card .sk-t1 { height: 10px; width: 35%; margin-top: 6px; }
.sk-card .sk-t2 { height: 13px; width: 80%; }
.sk-card .sk-t3 { height: 10px; width: 45%; }
.sk-card .sk-btn { height: 40px; margin-top: auto; border-radius: 10px; }
html[data-view="list"] .listing .sk-card { display: grid; grid-template-columns: 88px 1fr; }
html[data-view="list"] .listing .sk-card .sk-media { grid-row: span 4; }
html[data-view="list"] .listing .sk-card .sk-btn { display: none; }

/* ============ Rendering performance ============ */
/* Skip layout/paint for off-screen sections until they scroll near the viewport. */
.section, .footer { content-visibility: auto; contain-intrinsic-size: auto 520px; }
.listing > .card { content-visibility: auto; contain-intrinsic-size: auto 420px; }
html[data-view="list"] .listing > .card { contain-intrinsic-size: auto 110px; }

/* ============ Contact page ============ */
.contact { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.contact .form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 14px;
}
.contact .form textarea:focus { outline: none; border-color: var(--text); background: var(--surface); }
.contact-info p { display: flex; gap: 12px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.contact-info p + p { margin-top: 16px; }
.contact-info .i { width: 20px; height: 20px; margin-top: 1px; color: var(--text); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }

/* =====================================================================
   Admin panel — reuses the storefront header, sidebar and tokens.
   ===================================================================== */
.adm-body .header-row { gap: 14px; }
.adm-body .logo { display: inline-flex; align-items: center; }
.adm-badge { margin-left: 8px; }
.adm-badge { padding: 3px 8px; border-radius: 99px; background: var(--soft); color: var(--text-2); font: 600 11px/1.4 Inter, system-ui, sans-serif; letter-spacing: .02em; }
.adm-search { position: relative; width: min(420px, 38vw); flex: none; }
.adm-search kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--text-3); font: 11px/1.5 ui-monospace, Menlo, monospace; }
.adm-search:focus-within kbd { display: none; }
.gs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; max-height: 420px; overflow: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 40px rgba(18, 18, 17, .14); color: var(--text);
}
.gs-group + .gs-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.gs-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 14px; }
.gs-item .i { width: 16px; height: 16px; color: var(--text-3); }
.gs-item span { display: flex; flex-direction: column; min-width: 0; }
.gs-item small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item:hover, .gs-item.is-active { background: var(--soft); }
.gs-state { display: flex; align-items: center; gap: 10px; padding: 14px 12px; color: var(--text-2); font-size: 14px; }

/* Sidebar nav badges + fixed profile footer */
.adm-body .sidebar-nav .nav-count { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--text); font-size: 11.5px; font-weight: 600; text-align: center; }
.adm-body .sidebar-nav a[aria-current="page"] .nav-count { background: rgba(255, 255, 255, .16); color: var(--on-ink); }
.adm-profile { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--bg); }
.adm-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.adm-who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.adm-who strong { font-size: 14px; }
.adm-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.adm-profile > .icon-btn:hover, .adm-profile > .icon-btn[aria-expanded="true"] { background: var(--soft); color: var(--text); }
.adm-menu {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); z-index: 20; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -12px 36px rgba(18, 18, 17, .12);
}
.adm-menu a, .adm-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); font-size: 14px; font-weight: 500; text-align: left; }
.adm-menu .i { width: 16px; height: 16px; color: var(--text-2); }
.adm-menu a:hover, .adm-menu button:hover { background: var(--soft); }
.adm-menu form { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.adm-menu form button { color: var(--err); }
.adm-menu form button .i { color: var(--err); }

/* Page frame */
.adm-main { padding: 28px var(--gutter) 64px; }
.adm-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-page-head h1 { font-size: clamp(24px, 2.6vw, 30px); letter-spacing: -.03em; }
.adm-page-head p { margin-top: 4px; }
.adm-page-actions { display: flex; gap: 8px; }
.adm-sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }
.adm-sm .i { width: 14px; height: 14px; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.is-danger { color: var(--err) !important; }
.strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h2 { font-size: 16px; letter-spacing: -.01em; }
.adm-alert { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-sm); background: #f6e7e5; color: var(--err); font-size: 13px; line-height: 1.5; }
.adm-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.adm-note .i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.adm-note a { text-decoration: underline; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Loading: spinner + skeleton */
.spin { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--soft-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spin-sm { width: 14px; height: 14px; border-width: 2px; }
.btn .spin { border-color: rgba(255, 255, 255, .35); border-top-color: currentColor; }
.btn-ghost .spin { border-color: var(--soft-2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--soft) 0%, #f3f1ec 50%, var(--soft) 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.sk-lg { height: 26px; width: 55%; margin: 10px 0; }
.sk-chart { height: 200px; margin: 16px 20px 20px; border-radius: var(--r); }
.sk-circle { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-row { display: flex; gap: 16px; align-items: center; padding: 16px 20px; }
.sk-row + .sk-row { border-top: 1px solid var(--line); }
.sk-row .sk { flex: none; }
.sk-block { display: grid; gap: 12px; padding: 4px 0; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, .spin { animation: none; } }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: border-color .2s var(--ease), transform .2s var(--ease); }
a.kpi:hover { border-color: var(--text-2); transform: translateY(-1px); }
.kpi.is-loading .kpi-value, .kpi.is-loading .kpi-sub { opacity: .35; transition: opacity .15s; }
.kpi-ic { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); }
.kpi-ic .i { width: 17px; height: 17px; color: var(--text-2); }
.kpi-warn .kpi-ic { background: #fbeedd; } .kpi-warn .kpi-ic .i { color: #b45309; }
.kpi-info .kpi-ic { background: #e3ecf7; } .kpi-info .kpi-ic .i { color: #1d4f91; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); }
.kpi-delta { font-weight: 600; color: var(--text-2); }
.kpi-delta.up { color: var(--ok); } .kpi-delta.down { color: var(--err); }
.adm-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.adm-grid > .card { height: 100%; }
.adm-grid > .card > .mini-empty { flex: 1; }
.adm-grid .span-2 { grid-column: 1; }
.adm-grid > .card:nth-child(4) { grid-column: 2; grid-row: 2; }

/* Chart */
.chart-head { align-items: flex-start; flex-wrap: wrap; }
.chart-head > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.chart-head .muted { font-size: 13px; }
.seg-sm button { padding: 5px 10px; font-size: 12.5px; }
.chart-box { position: relative; transition: opacity .2s; }
.chart-box.is-loading { opacity: .45; pointer-events: none; }
.chart-box.is-loading::after { content: ""; position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid var(--soft-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
.chart-sum { display: flex; align-items: baseline; gap: 10px; padding: 14px 20px 0; }
.chart-sum strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-sum span { color: var(--text-3); font-size: 13px; }
.chart { position: relative; padding: 16px 20px 12px; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .bar rect { fill: var(--ink); transition: fill .15s; }
.chart .bar.is-zero rect { fill: var(--soft-2); }
.chart .bar:hover rect, .chart .bar:focus rect { fill: #3a3935; }
.chart .bar foreignObject { display: none; overflow: visible; }
.chart .bar:hover foreignObject, .chart .bar:focus foreignObject { display: block; }
.chart .bar:focus { outline: none; }
.chart .tip { display: flex; flex-direction: column; width: max-content; margin: 0 auto; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--on-ink); font: 12px/1.35 Inter, system-ui, sans-serif; }
.chart .tip span { color: #b9b7b0; font-size: 11px; }
.chart-x { position: relative; height: 18px; margin-top: 8px; }
.chart-x span { position: absolute; transform: translateX(-50%); color: var(--text-3); font-size: 11px; white-space: nowrap; }

/* Mini lists on the overview */
.mini-list { margin: 10px 0 0; padding: 0 8px 8px; list-style: none; }
.mini-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); }
.mini-list li.is-link { cursor: pointer; }
.mini-list li.is-link:hover { background: var(--bg); }
.mini-list li.is-done { opacity: .6; }
.mini-list li.is-unread strong { font-weight: 700; }
.mini-list li.is-unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #1d4f91; flex: none; }
.mini-main { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.mini-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-empty { display: flex; align-items: center; gap: 10px; margin: 14px 20px 20px; padding: 18px; border: 1px dashed var(--soft-2); border-radius: var(--r); color: var(--text-2); font-size: 14px; }
.mini-empty .i { width: 18px; height: 18px; color: var(--text-3); }
.mini-table { margin-top: 8px; }

/* Avatars + status badges */
.av { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: hsl(var(--h) 38% 90%); color: hsl(var(--h) 32% 30%); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.av-lg { width: 48px; height: 48px; font-size: 15px; }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--text-2); }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { background: #e3ecf7; color: #1d4f91; }
.st-processing, .st-pending { background: #fbeedd; color: #a3500b; }
.st-completed, .st-active, .st-handled { background: #e3efe6; color: var(--ok); }
.st-cancelled, .st-disabled { background: #f6e7e5; color: var(--err); }

/* ---------- Data table ---------- */
.dt { overflow: hidden; }
.dt-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dt-tabs::-webkit-scrollbar, .mb-folders::-webkit-scrollbar { display: none; }
.dt-tabs button { position: relative; padding: 10px 12px 12px; color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.dt-tabs button[aria-selected="true"] { color: var(--text); }
.dt-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.dt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; }
.dt-search { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-width: 0; height: 38px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-3); }
.dt-search:focus-within { border-color: var(--text-2); background: var(--surface); }
.dt-search .i { width: 15px; height: 15px; }
.dt-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.dt-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-select { position: relative; display: flex; align-items: center; height: 38px; }
.dt-select .i { position: absolute; left: 11px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.dt-select select { height: 38px; padding-left: 32px; font-size: 13.5px; background-color: var(--bg); }
.dt-range { display: inline-flex; align-items: center; gap: 6px; }
.dt-range input { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 13.5px; color: var(--text); }
.dt-icon-btn { width: 38px; height: 38px; padding: 0; }
.dt-icon-btn .i { width: 16px; height: 16px; }
.dt-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--ink); color: var(--on-ink); font-size: 13.5px; font-weight: 500; }
.dt-bulk [data-bulk-n] { margin-right: 8px; }
.dt-bulk .btn-ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: var(--on-ink); }
.dt-bulk .btn-ghost.is-danger { color: #ffb4ab !important; }
.dt-clear { margin-left: auto; color: #cfcdc6; font-size: 13px; }
.dt-wrap { position: relative; overflow-x: auto; }
.dt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dt-table th { position: sticky; top: 0; padding: 10px 14px; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.dt-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-table tr.is-link { cursor: pointer; }
.dt-table tbody tr:hover td { background: var(--bg); }
.dt-table .al-right { text-align: right; } .dt-table .al-center { text-align: center; }
.dt-table .muted { color: var(--text-3); }
.dt-check { width: 44px; padding-right: 0 !important; }
.dt-check input, .mb-row input[type="checkbox"], .mb-check input { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }
.dt-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.dt-sort:hover { color: var(--text); }
.dt-arrow .i { width: 11px; height: 11px; opacity: 0; transition: transform .15s, opacity .15s; }
th[aria-sort="ascending"] .dt-arrow .i { opacity: 1; transform: rotate(180deg); }
th[aria-sort="descending"] .dt-arrow .i { opacity: 1; }
th[aria-sort] .dt-sort:hover .dt-arrow .i { opacity: .5; }
th[aria-sort="ascending"] .dt-sort, th[aria-sort="descending"] .dt-sort { color: var(--text); }
.dt-actions { white-space: nowrap; }
.dt-actions .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
.dt-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(251, 250, 248, .6); backdrop-filter: blur(1px); }
.sk-tr td { padding-top: 16px; padding-bottom: 16px; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person > span:not(.av) { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.cell-person strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-person small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 520px; color: var(--text-2); }
.cell-snippet.strong { color: var(--text); font-weight: 500; }
.dt-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 20px; text-align: center; color: var(--text-2); font-size: 14px; }
.dt-empty strong { color: var(--text); font-size: 16px; }
.dt-empty .btn { margin-top: 8px; }
.dt-empty-ic { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 50%; background: var(--soft); }
.dt-empty-ic .i { width: 22px; height: 22px; color: var(--text-2); }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.dt-pages { display: flex; align-items: center; gap: 4px; }
.dt-pages button { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dt-pages button:hover:not(:disabled) { background: var(--soft); color: var(--text); }
.dt-pages button[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.dt-pages button:disabled { opacity: .35; cursor: default; }
.dt-pages .i { width: 13px; height: 13px; }
.dt-gap { padding: 0 4px; color: var(--text-3); }
.dt-size { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.dt-size select { height: 32px; padding: 0 30px 0 10px; font-size: 13px; background-position: right 8px center; }

/* ---------- Drawer ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(18, 18, 17, .32); opacity: 0; transition: opacity .25s var(--ease); pointer-events: auto; }
.adm-drawer { position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(640px, 100vw); background: var(--surface); box-shadow: -20px 0 60px rgba(0, 0, 0, .12); transform: translateX(100%); transition: transform .3s var(--ease); pointer-events: auto; }
.drawer-wrap.open .drawer-scrim { opacity: 1; }
.drawer-wrap.open .adm-drawer { transform: none; }
html.drawer-open { overflow: hidden; }
.adm-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.adm-drawer-head h2 { font-size: 19px; letter-spacing: -.02em; }
.adm-drawer-head p { margin-top: 2px; font-size: 13px; }
.adm-drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; }
.adm-drawer-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg); }
.dr-section + .dr-section, .dr-section + .adm-note, .adm-note + .dr-section, .dr-section + .reply, .dr-section + .adm-note { margin-top: 22px; }
.dr-label { margin-bottom: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dr-person { display: flex; gap: 14px; align-items: flex-start; }
.dr-person > div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.45; }
.dr-person strong { font-size: 16px; }
.dr-person a { color: var(--text); text-decoration: underline; text-decoration-color: var(--soft-2); text-underline-offset: 3px; }
.dr-person .st { margin-top: 6px; align-self: flex-start; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.seg button { padding: 6px 12px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.dt-table.lines td { padding: 10px 0; }
.dt-table.lines td + td { padding-left: 12px; }
.dt-table.lines small { display: block; color: var(--text-3); font-size: 12.5px; }
.dt-table.lines tbody tr:hover td { background: none; }
.dt-table.lines tfoot td { padding: 6px 0; border: 0; color: var(--text-2); }
.dt-table.lines tfoot tr:first-child td { padding-top: 14px; border-top: 1px solid var(--line); }
.dt-table.lines .grand td { padding-top: 10px; color: var(--text); font-size: 16px; font-weight: 700; }
.msg-bubble { padding: 14px 16px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg-bubble.is-mine { background: #eef3ee; border-color: #d7e4d9; }
.reply { display: grid; gap: 8px; margin-top: 22px; }
.reply textarea, .mb-reply textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font: inherit; font-size: 14px; resize: vertical; }
.reply textarea:focus, .mb-reply textarea:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.reply-actions { display: flex; justify-content: flex-end; }

/* ---------- Customer drawer ---------- */
.av-xl { width: 60px; height: 60px; font-size: 19px; }
.sk-xl { width: 60px !important; height: 60px; }
.cu-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.cu-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 14px; }
.cu-head strong { font-size: 18px; letter-spacing: -.02em; }
.cu-head > div > span:not(.cu-contact) { color: var(--text-2); }
.cu-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cu-contact a { color: var(--text); text-decoration: underline; text-decoration-color: var(--soft-2); text-underline-offset: 3px; overflow-wrap: anywhere; }
.cu-head .st { margin-top: 4px; }
.st-custom { background: #efe7fb; color: #5b3a9b; }
.cu-tabs { display: flex; gap: 4px; margin: 0 -22px 18px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.cu-tabs button { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 10px 12px; color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.cu-tabs button[aria-selected="true"] { color: var(--text); }
.cu-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.cu-tabs small { padding: 0 6px; border-radius: 99px; background: var(--soft); font-size: 11px; font-weight: 600; }
.cu-panel { animation: cu-in .2s var(--ease); }
@keyframes cu-in { from { opacity: 0; transform: translateY(4px); } }
.cu-panel > .adm-note { margin-bottom: 16px; }
.cu-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 22px; }
.cu-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); min-width: 0; }
.cu-stat span { color: var(--text-3); font-size: 12px; font-weight: 500; }
.cu-stat strong { font-size: 18px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-stat small { color: var(--text-3); font-size: 11.5px; }
.cu-skel .cu-head { margin-bottom: 22px; }
.cu-dl { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cu-dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 13.5px; }
.cu-dl div + div { border-top: 1px solid var(--line); }
.cu-dl dt { color: var(--text-2); }
.cu-dl dd { margin: 0; text-align: right; }
.cu-orders { margin: 0 0 10px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cu-orders li + li { border-top: 1px solid var(--line); }
.cu-orders a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 14px; font-size: 14px; }
.cu-orders a:hover { background: var(--bg); }
.cu-orders span:first-child { display: flex; flex-direction: column; min-width: 0; }
.cu-orders small { color: var(--text-3); font-size: 12px; }
.cu-orders b { font-variant-numeric: tabular-nums; }
.cu-form { display: grid; gap: 14px; }
.cu-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cu-form label em { font-style: normal; font-weight: 400; color: var(--text-3); }
.cu-form input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 14.5px; color: var(--text); font-weight: 400; }
.cu-form input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.cu-form .hint { display: flex; align-items: center; gap: 6px; margin: 0; }
.cu-form .hint .i { width: 13px; height: 13px; }
.cu-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.cu-price-lead { margin: 0 0 12px; }
.cu-price-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.cu-price-bar .dt-search { flex: 1 1 200px; }
.cu-only { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.cu-only input { width: 16px; height: 16px; accent-color: var(--ink); }
.cu-prices { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cu-prices li { display: grid; grid-template-columns: minmax(0, 1fr) 84px 210px 90px; align-items: center; gap: 12px; padding: 10px 12px; font-size: 13.5px; transition: background .15s; }
.cu-prices li + li { border-top: 1px solid var(--line); }
.cu-prices li.is-on { background: #f6f2fc; }
.cu-prices li.is-bad { background: #fbeeec; }
.cu-p-info { display: flex; flex-direction: column; min-width: 0; }
.cu-p-info strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-p-info small, .cu-p-list small, .cu-p-new small { color: var(--text-3); font-size: 11.5px; }
.cu-p-list, .cu-p-new { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.cu-p-new { text-align: right; }
.cu-p-new b { color: #5b3a9b; }
.cu-p-ctl { display: flex; gap: 6px; }
.cu-p-ctl select { height: 34px; padding: 0 28px 0 10px; font-size: 13px; background-position: right 8px center; flex: 1; min-width: 0; }
.cu-p-ctl input { width: 78px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-size: 13.5px; text-align: right; }
.cu-p-ctl input:disabled { background: var(--bg); color: var(--text-3); }
.cu-p-ctl input:focus { outline: none; border-color: var(--text-2); }
.cu-price-foot { position: sticky; bottom: -20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px -22px -24px; padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.cu-price-foot div { display: flex; gap: 8px; }
@media (max-width: 640px) {
  .cu-tabs { margin: 0 -14px 14px; padding: 0 8px; }
  .cu-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .cu-prices li { grid-template-columns: minmax(0, 1fr) auto; }
  .cu-p-info { grid-column: 1 / -1; }
  .cu-p-ctl { grid-column: 1 / -1; order: 3; }
  .cu-p-list { order: 1; }
  .cu-p-new { order: 2; }
  .cu-price-foot { margin: 12px -14px -20px; padding: 10px 14px; }
  .cu-price-foot div { width: 100%; }
  .cu-price-foot .btn { flex: 1; }
}

/* ---------- Modal + toasts ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(18, 18, 17, .4); opacity: 0; transition: opacity .18s var(--ease); }
.modal.open { opacity: 1; }
.modal-panel { width: min(420px, 100%); padding: 24px; background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(0, 0, 0, .2); transform: translateY(8px) scale(.98); transition: transform .2s var(--ease); }
.modal.open .modal-panel { transform: none; }
.modal-ic { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 50%; background: #e3efe6; color: var(--ok); }
.modal-ic.is-danger { background: #f6e7e5; color: var(--err); }
.modal-ic .i { width: 22px; height: 22px; }
.modal-panel h2 { font-size: 18px; letter-spacing: -.02em; }
.modal-panel p { margin-top: 6px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--on-ink); font-size: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast .i { width: 18px; height: 18px; flex: none; color: #9fd3a8; }
.toast-err { background: var(--err); }
.toast-err .i { color: #fff; }

/* ---------- Mail client ---------- */
.mailbox { display: grid; grid-template-columns: 190px minmax(300px, 400px) minmax(0, 1fr); gap: 12px; height: calc(100vh - var(--header-h) - 150px); min-height: 520px; }
.mb-folders { display: flex; flex-direction: column; gap: 2px; padding: 8px; align-self: start; }
.mb-folder { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-size: 14px; font-weight: 500; text-align: left; }
.mb-folder .i { width: 17px; height: 17px; }
.mb-folder span { flex: 1; }
.mb-folder small { color: var(--text-3); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mb-folder:hover { background: var(--soft); color: var(--text); }
.mb-folder[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.mb-folder[aria-current="page"] small { color: #b9b7b0; }
.mb-list { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.mb-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px; border-bottom: 1px solid var(--line); }
.mb-toolbar .dt-search { flex: 1 1 100%; order: -1; }
.mb-toolbar .dt-select { flex: 1; }
.mb-toolbar .dt-select select { width: 100%; height: 34px; font-size: 13px; }
.mb-toolbar .dt-select { height: 34px; }
.mb-check { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.mb-bulk { display: flex; align-items: center; gap: 2px; padding: 6px 10px; background: var(--ink); color: var(--on-ink); font-size: 13px; }
.mb-bulk [data-bulk-n] { margin-right: auto; font-weight: 500; }
.mb-bulk .icon-btn { color: #d8d6cf; }
.mb-bulk .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.mb-bulk .icon-btn.is-danger { color: #ffb4ab !important; }
.mb-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.mb-rows { margin: 0; padding: 0; list-style: none; }
.mb-row { position: relative; display: grid; grid-template-columns: 16px 20px 34px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s, opacity .2s, transform .2s; }
.mb-row > input, .mb-row > .mb-star { margin-top: 9px; }
.mb-row:hover { background: var(--bg); }
.mb-row.is-open { background: var(--soft); }
.mb-row.is-unread::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ink); }
.mb-row.is-leaving { opacity: 0; transform: translateX(-12px); }
.mb-row.sk-row { grid-template-columns: 34px 1fr; cursor: default; }
.mb-sk-lines { display: grid; gap: 8px; padding-top: 4px; }
.mb-star { display: grid; place-items: center; width: 20px; height: 20px; color: var(--soft-2); }
.mb-star .i { width: 17px; height: 17px; }
.mb-star:hover { color: var(--text-2); }
.mb-star.is-on { color: #d99a06; }
.mb-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.mb-top { display: flex; align-items: center; gap: 6px; }
.mb-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--text-2); }
.mb-top time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.mb-att .i { width: 13px; height: 13px; color: var(--text-3); }
.mb-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-2); }
.mb-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-3); }
.mb-row.is-unread .mb-from, .mb-row.is-unread .mb-subj { color: var(--text); font-weight: 700; }
.mb-row.is-unread time { color: var(--text); font-weight: 600; }
.mb-more { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px; color: var(--text-3); font-size: 13px; }
.mb-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; text-align: right; }
.mb-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 20px; color: var(--text-2); font-size: 13.5px; text-align: center; }
.mb-empty .i { width: 28px; height: 28px; margin-bottom: 6px; color: var(--text-3); }
.mb-empty strong { color: var(--text); font-size: 15px; }
.mb-read { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.mb-placeholder { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px; color: var(--text-2); font-size: 14px; text-align: center; }
.mb-placeholder .i { width: 40px; height: 40px; margin-bottom: 6px; color: var(--soft-2); }
.mb-placeholder strong { color: var(--text); font-size: 16px; }
.mb-read-bar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mb-read-bar .icon-btn:hover { background: var(--soft); color: var(--text); }
.mb-read-bar .btn { margin-left: 4px; }
.mb-back { display: none; margin-right: auto; }
.mb-read-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.mb-read-head h2 { margin-bottom: 14px; font-size: 20px; letter-spacing: -.02em; line-height: 1.3; }
.mb-sender { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.45; }
.mb-sender > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mb-sender time { align-self: flex-start; font-size: 12.5px; white-space: nowrap; }
.mb-atts-head { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.mb-atts-head .link { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--text); }
.mb-atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.mb-atts li > a, .mb-atts li.is-off { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font-size: 13px; transition: border-color .15s, background .15s; }
.mb-atts li > a:hover { border-color: var(--text-2); background: var(--surface); }
.mb-atts li.is-off { opacity: .6; }
.mb-att-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; background: var(--soft); }
.mb-att-ic .i { width: 16px; height: 16px; color: var(--text-2); }
.mb-att-name { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mb-att-name small { color: var(--text-3); font-weight: 400; }
.mb-att-dl { width: 14px; height: 14px; color: var(--text-3); }
.mb-atts a:hover .mb-att-dl { color: var(--text); }
.mb-read-head .hint { margin-top: 6px; }
.mb-read-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px; }
.mb-frame { display: block; width: 100%; height: 100%; min-height: 360px; border: 0; background: transparent; border-radius: var(--r-sm); }
.mb-text { margin: 0; white-space: pre-wrap; word-break: break-word; font: 14.5px/1.65 Inter, system-ui, sans-serif; color: var(--text); }
.mb-reply { padding: 12px 22px 18px; border-top: 1px solid var(--line); }
.mb-reply form { display: grid; gap: 8px; }

/* Full view: the reader covers the page content, below the header and beside the sidebar */
.mailbox.is-full .mb-read {
  position: fixed; z-index: 35; top: var(--header-h); right: 0; bottom: 0; left: var(--sb-w);
  border-radius: 0; border-width: 0 0 0 1px; animation: mb-full-in .22s var(--ease);
}
html.sb-closed .mailbox.is-full .mb-read { left: 0; border-left: 0; }
.mailbox.is-full .mb-read-head, .mailbox.is-full .mb-read-body, .mailbox.is-full .mb-reply { padding-left: max(22px, calc((100% - 900px) / 2)); padding-right: max(22px, calc((100% - 900px) / 2)); }
.mb-full-btn { margin-left: auto; }
.mb-full-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink) !important; }
@keyframes mb-full-in { from { opacity: 0; transform: scale(.985); } }
@media (prefers-reduced-motion: reduce) { .mailbox.is-full .mb-read { animation: none; } }
@media (max-width: 1023px) { .mailbox.is-full .mb-read { left: 0; border-left: 0; } }

/* ---------- Settings ---------- */
.set-list { margin: 8px 0 0; padding: 0 8px 8px; list-style: none; }
.set-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 12px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row > div { flex: 1; min-width: 0; }
.set-row strong { font-size: 14.5px; }
.set-row p { margin-top: 2px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.set-ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; }
.set-ic.ok { background: #e3efe6; color: var(--ok); } .set-ic.warn { background: #fbeedd; color: #a3500b; }
.set-ic .i { width: 16px; height: 16px; }
.set-p { padding: 12px 20px 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.set-p:last-child { padding-bottom: 20px; }
.set-code { margin: 10px 20px 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ink); color: var(--on-ink); font: 12.5px ui-monospace, Menlo, monospace; overflow-x: auto; }

/* ---------- Admin login ---------- */
.adm-auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.adm-login { width: min(400px, 100%); padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 20px 50px rgba(18, 18, 17, .06); }
.adm-login .logo { display: inline-flex; align-items: center; }
.adm-login h1 { margin: 22px 0 4px; font-size: 22px; letter-spacing: -.02em; }
.adm-login > p.muted { margin-bottom: 18px; font-size: 14px; }
.adm-form { display: grid; gap: 8px; }
.adm-form label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.adm-form input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 15px; }
.adm-form input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.adm-form .btn { margin-top: 8px; }

/* ---------- Admin responsive ---------- */
@media (max-width: 1280px) {
  .mailbox { grid-template-columns: 170px minmax(280px, 340px) minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-grid { grid-template-columns: 1fr; }
  .adm-grid .span-2, .adm-grid > .card:nth-child(4) { grid-column: auto; grid-row: auto; }
}
@media (max-width: 1100px) {
  .mailbox { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .mb-folders { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .mb-folder { flex: none; }
  .mb-list { height: calc(100vh - var(--header-h) - 240px); min-height: 420px; }
  .mb-read { display: none; }
  .mailbox.is-reading .mb-list, .mailbox.is-reading .mb-folders { display: none; }
  .mailbox.is-reading .mb-read { display: flex; min-height: calc(100vh - var(--header-h) - 150px); }
  .mb-back { display: grid; }
}
@media (max-width: 760px) {
  .adm-search { width: auto; flex: 1; }
  .adm-search kbd { display: none; }
  .adm-body .header-actions { flex: 1; margin-left: 0; }
  .adm-body .header-actions .hbtn { display: none; }
  .adm-body .logo .adm-badge { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-ic { display: none; }
  .dt-table .hide-sm { display: none; }
  .dt-bar { padding: 12px; }
  .dt-dates, .dt-select, .dt-select select { flex: 1; }
  .dt-foot { justify-content: center; }
  .dt-foot [data-info] { width: 100%; text-align: center; }
  .adm-drawer-head, .adm-drawer-body { padding-left: 16px; padding-right: 16px; }
}
/* Phones: edge-to-edge content, tables become stacked cards */
@media (max-width: 640px) {
  .adm-main { padding: 14px 6px 40px; }
  .adm-page-head { padding: 0 6px; margin-bottom: 14px; gap: 10px; }
  .adm-page-head h1 { font-size: 23px; }
  .adm-page-head p { font-size: 13.5px; }
  .card, .kpi { border-radius: var(--r); }
  .kpis { gap: 6px; margin-bottom: 6px; }
  .kpi { padding: 12px; }
  .kpi-label { font-size: 12px; }
  .kpi-value { font-size: 20px; }
  .kpi-sub { font-size: 11.5px; }
  .adm-grid { gap: 6px; }
  .card-head { padding: 14px 12px 0; }
  .chart { padding: 12px 12px 10px; }
  .chart svg { height: 160px; }
  .chart-sum { padding: 10px 12px 0; }
  .chart-head .seg { width: 100%; }
  .chart-head .seg button { flex: 1; }
  .mini-list { padding: 0 4px 6px; }
  .mini-list li { padding: 10px 8px; }
  .mini-empty { margin: 12px; }

  .dt-tabs { padding: 4px 6px 0; }
  .dt-tabs button { padding: 10px 10px 12px; font-size: 13.5px; }
  .dt-bar { padding: 10px; gap: 6px; }
  .dt-search { flex-basis: 100%; }
  .dt-dates { flex: 1; }
  .dt-bulk { padding: 8px 10px; }
  .dt-foot { padding: 10px; }
  .dt-wrap { overflow: visible; }
  .dt-table thead { display: none; }
  .dt-table tbody tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .dt-table tbody tr:last-child { border-bottom: 0; }
  .dt-table tbody td { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .dt-table tbody tr:hover td { background: none; }
  .dt-table tbody tr.is-link:active { background: var(--bg); }
  .dt-table tbody td[data-label]::before { content: attr(data-label); margin-bottom: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
  .dt-table tbody td.dt-primary { grid-column: 1 / -1; padding-right: 32px; }
  .dt-table tbody td.dt-check { position: absolute; top: 14px; right: 12px; width: auto; }
  .dt-table tbody td:has(> .cell-person) { grid-column: 1 / -1; }
  .dt-table tbody td:has(> .cell-person)::before { display: none; }
  .dt-table tbody td.dt-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; }
  .dt-table tbody td.dt-actions .btn { height: 34px; flex: 1; justify-content: center; }
  .dt-table tbody td .st { align-self: flex-start; }
  .dt-table .hide-sm { display: none !important; }
  .dt-table.lines tbody tr { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; }
  .dt-table.lines tbody td { padding: 0 !important; }
  .dt-table.lines tbody td:first-child { grid-column: 1 / -1; }
  .dt-table.lines tfoot tr { display: flex; justify-content: space-between; }
  .sk-tr { display: grid !important; grid-template-columns: 1fr 1fr; }
  .sk-tr td:nth-child(n+5) { display: none !important; }
  .cell-snippet { max-width: none; }

  .mailbox { gap: 6px; }
  .mb-folders { padding: 4px; }
  .mb-folder { padding: 8px 10px; font-size: 13.5px; }
  .mb-toolbar { padding: 8px; }
  .mb-row { grid-template-columns: 16px 20px 32px minmax(0, 1fr); gap: 8px; padding: 12px 10px; }
  .mb-row .av { width: 32px; height: 32px; }
  .mb-read-head, .mb-read-body, .mb-reply { padding-left: 12px; padding-right: 12px; }
  .mb-read-head h2 { font-size: 18px; }
  .mb-sender { flex-wrap: wrap; }
  .mb-sender time { width: 100%; padding-left: 60px; }
  .mb-atts li > a, .mb-atts li.is-off { min-width: 0; max-width: none; flex: 1 1 100%; }
  .mailbox.is-full .mb-read-head, .mailbox.is-full .mb-read-body, .mailbox.is-full .mb-reply { padding-left: 12px; padding-right: 12px; }

  .adm-drawer-head { padding: 14px 14px 12px; }
  .adm-drawer-body { padding: 14px 14px 20px; }
  .adm-drawer-foot { padding: 10px 14px; }
  .adm-drawer-foot .btn { flex: 1; }
  .set-row { padding: 12px 8px; flex-wrap: wrap; }
  .set-row .st { margin-left: 46px; }
  .set-p { padding-left: 12px; padding-right: 12px; }
  .set-code { margin-left: 12px; margin-right: 12px; }
  .toasts { left: 8px; right: 8px; bottom: 8px; align-items: stretch; }
  .toast { max-width: none; }
}
@media print {
  .header, .sidebar, .adm-main, .drawer-scrim, .adm-drawer-foot, .adm-drawer-head .icon-btn, .toasts { display: none !important; }
  .adm-drawer { position: static; width: auto; box-shadow: none; transform: none; }
}

/* ============ Customer-specific prices (storefront) ============ */
.pd-price .price-tag { display: inline-block; margin-left: 10px; padding: 3px 9px; border-radius: 99px; background: #efe7fb; color: #5b3a9b; font-size: 12px; font-weight: 600; vertical-align: middle; }
.vrow-price s { margin-left: 4px; color: var(--text-3); font-size: 12px; font-weight: 400; }
.nowrap { white-space: nowrap; }

/* ============ Product photos ============ */
.card-media.has-img, .pd-media.has-img, .line-media.has-img, .so-thumb.has-img, .vm-thumb:has(img) { background: #fff; overflow: hidden; }
.card-media.has-img img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.pd-media.has-img { position: relative; }
.pd-media.has-img img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; }
.line-media.has-img img, .so-thumb.has-img img, .vm-thumb img { width: 88%; height: 88%; object-fit: contain; }
.card:hover .card-media.has-img img { transform: scale(1.03); }
.card-media.has-img img { transition: transform .3s var(--ease); }
.pd-gallery { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pd-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pd-thumbs::-webkit-scrollbar { display: none; }
.pd-thumbs button { flex: none; width: 68px; height: 68px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.pd-thumbs button[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pd-about h2 { margin-bottom: 12px; font-size: 20px; }
.pd-rich { max-width: 820px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text-2); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.pd-rich > :first-child { margin-top: 0; }
.pd-rich p, .pd-rich ul, .pd-rich ol { margin: 0 0 12px; }
.pd-rich ul, .pd-rich ol { padding-left: 20px; }
.pd-rich h2, .pd-rich h3, .pd-rich h4 { margin: 18px 0 8px; color: var(--text); font-size: 16px; }
.pd-rich strong, .pd-rich b { color: var(--text); }
.pd-rich img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
.pd-rich table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; }
.pd-rich td, .pd-rich th { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
@media (max-width: 640px) { .pd-rich { padding: 16px; font-size: 14.5px; } .pd-thumbs button { width: 56px; height: 56px; } }

/* Card badges sit above the photo */
.card-media .tag, .card-media .vbadge { z-index: 2; }

/* Lazy photos: shimmer until loaded, then fade in */
.card-media.has-img, .pd-media.has-img, .line-media.has-img, .so-thumb.has-img { background: linear-gradient(90deg, #f3f1ec 0%, #fbfaf8 50%, #f3f1ec 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.card-media.has-img.is-loaded, .pd-media.has-img.is-loaded, .line-media.has-img.is-loaded, .so-thumb.has-img.is-loaded { background: #fff; animation: none; }
html.js .card-media.has-img img, html.js .pd-media.has-img img, html.js .line-media.has-img img, html.js .so-thumb.has-img img { opacity: 0; transition: opacity .35s ease, transform .3s var(--ease); }
html.js .is-loaded > img { opacity: 1 !important; }
@media (prefers-reduced-motion: reduce) { .card-media.has-img, .pd-media.has-img { animation: none; } }

/* ============ Sign-up: address group + phone prefix ============ */
.form-group { margin: 4px 0 0; padding: 14px 14px 4px; border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 12px; }
.form-group legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.form-group legend em { font-style: normal; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.form-row-wide { grid-template-columns: 2fr 1fr; }
.form-row-3 { grid-template-columns: 1.2fr 1.2fr 1fr; }
.form select { display: block; width: 100%; margin-top: 6px; }
.input-prefix { display: flex; align-items: stretch; margin-top: 6px; }
.input-prefix > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--soft); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.form .input-prefix input { margin-top: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; }
@media (max-width: 640px) { .form-row-wide, .form-row-3 { grid-template-columns: 1fr; } .form-group { padding: 12px 10px 2px; } }
.form select { height: 46px; font-size: 15px; background-color: var(--bg); }
.cu-address { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font-size: 14px; line-height: 1.6; }
.cu-tax { margin-top: 8px; font-size: 13.5px; }
.cu-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cu-form select { height: 42px; margin: 0; }
@media (max-width: 640px) { .cu-form-row { grid-template-columns: 1fr; } }

/* ============ Login / sign-up: wider card, slimmer fields ============ */
.auth { padding: 28px var(--gutter); }
.auth-card { width: min(640px, 100%); max-width: 640px; padding: 30px 32px; }
.auth-card:has(input[name="password"][autocomplete="current-password"]) { width: min(460px, 100%); }
.auth-icon { margin-bottom: 14px; }
.auth-card h1 { font-size: 24px; }
.auth-card .form { gap: 10px; margin-top: 18px; }
.auth-card .form label { font-size: 12.5px; }
.auth-card .form input, .auth-card .form select { height: 40px; margin-top: 4px; padding: 0 12px; font-size: 14.5px; }
.auth-card .form select { padding-right: 32px; }
.auth-card .form .input-prefix { margin-top: 4px; }
.auth-card .form .input-prefix input { margin-top: 0; }
.auth-card .pw .icon-btn { top: 2px; right: 2px; }
.auth-card .form .btn { height: 44px; margin-top: 4px; }
.auth-card .form-row { gap: 10px; }
.auth-card .form-group { gap: 10px; padding: 10px 12px 12px; margin: 2px 0 0; }
.auth-card .hint { margin-top: 4px; font-size: 12px; }
.auth-alt { margin-top: 14px; }
@media (max-width: 640px) { .auth-card { padding: 22px 16px; } .auth { padding: 16px 10px; } }

/* Sign-up: titled sections separated by hairlines */
.auth-card .form-sections { gap: 0; }
.form-section { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); }
.form-section:first-child { padding-top: 4px; border-top: 0; }
.form-section-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.form-section-title small { font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.form-sections > .btn { margin-top: 6px; }

/* ============ Admin: products ============ */
.cell-product { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-product img, .cell-product .cp-noimg { width: 44px; height: 44px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.cp-noimg { display: grid; place-items: center; color: var(--text-3); background: var(--soft) !important; }
.cp-noimg .i { width: 18px; height: 18px; }
.cell-product > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.cell-product strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.cell-product small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code.sku { font-size: 12px; color: var(--text-2); }
.dt-table td .was { display: block; color: var(--text-3); font-size: 12px; text-decoration: line-through; }
.adm-drawer.is-wide { width: min(780px, 100vw); }
.pe-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.pe-head img, .pe-head .cp-noimg { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; background: #fff; flex: none; }
.pe-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 14px; }
.pe-head strong { font-size: 17px; letter-spacing: -.01em; }
.pe-head .link { font-size: 13px; margin-left: 6px; }
.pe-form select { height: 42px; margin: 0; }
.pe-form .is-ro { background: var(--soft); color: var(--text-3); }
.pe-checks { display: grid; gap: 8px; }
.pe-check { display: flex !important; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font-weight: 400 !important; }
.pe-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--ink); }
.pe-check span { display: flex; flex-direction: column; gap: 2px; }
.pe-check strong { color: var(--text); font-size: 14px; }
.pe-check small { color: var(--text-3); font-size: 12.5px; }
.pe-variants { display: grid; gap: 6px; }
.pe-variant { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) 110px auto 34px 34px; gap: 6px; align-items: center; }
.pe-variant input { height: 38px !important; }
.pe-mini { display: flex !important; align-items: center; gap: 6px; font-size: 12.5px !important; font-weight: 500 !important; white-space: nowrap; }
.pe-mini input { width: 15px; height: 15px !important; accent-color: var(--ink); }
.pe-variant [data-move] .i { transform: rotate(90deg); }
.pe-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.pe-photos li { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; cursor: grab; }
.pe-photos img { width: 100%; height: 100%; object-fit: contain; }
.pe-main { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-size: 11px; font-weight: 600; }
.pe-photo-tools { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.pe-photos li:hover .pe-photo-tools, .pe-photos li:focus-within .pe-photo-tools { opacity: 1; }
.pe-photo-tools button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .95); border: 1px solid var(--line); }
.pe-photo-tools .i { width: 13px; height: 13px; }
.pe-add-photo { display: grid; gap: 10px; margin-top: 12px; }
.pe-drop { display: flex !important; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--soft-2); border-radius: var(--r); background: var(--bg); cursor: pointer; font-weight: 400 !important; }
.pe-drop.is-over { border-color: var(--ink); background: var(--surface); }
.pe-drop.is-busy { opacity: .6; pointer-events: none; }
.pe-drop > .i { width: 26px; height: 26px; color: var(--text-2); }
.pe-drop span { display: flex; flex-direction: column; }
.pe-drop strong { color: var(--text); font-size: 14px; }
.pe-drop small { color: var(--text-3); font-size: 12.5px; }
.pe-url { display: flex; gap: 6px; }
.pe-url input { flex: 1; height: 38px !important; }
.rte { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.rte-bar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.rte-bar button { min-width: 32px; height: 30px; padding: 0 8px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.rte-bar button:hover { background: var(--soft); color: var(--text); }
.rte-body { min-height: 320px; max-height: 60vh; overflow: auto; padding: 14px 16px; font-size: 14.5px; line-height: 1.65; outline: none; }
.rte-body:focus { box-shadow: inset 0 0 0 2px var(--soft-2); }
.rte-body ul, .rte-body ol { padding-left: 20px; }
.rte-body img { max-width: 100%; height: auto; }
.pc-select { width: 100%; height: 42px; margin-top: 14px; }
@media (max-width: 640px) {
  .pe-variant { grid-template-columns: 1fr 1fr; }
  .pe-variant input[name="vNameEn"] { grid-column: 1 / -1; }
}
.cu-form .lbl { display: block; line-height: 1.3; }
.cu-form .lbl em { margin-left: 4px; font-style: normal; font-weight: 400; color: var(--text-3); }

/* ============ Admin: custom prices page ============ */
.pr-customer { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px; }
.pr-pick { display: flex; gap: 8px; flex: 1 1 420px; min-width: 0; }
.pr-search { flex: 0 1 240px; }
.pr-pick select { flex: 1; min-width: 0; height: 38px; }
.pr-who { flex: 1 1 360px; }
.pr-who-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pr-who-card > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pr-who-card small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-who-card .btn { margin-left: auto; }
.pr-ctl { display: flex; gap: 6px; }
.pr-ctl select { height: 34px; padding: 0 28px 0 10px; font-size: 13px; background-position: right 8px center; }
.pr-ctl input { width: 90px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-size: 13.5px; text-align: right; }
.pr-ctl input:disabled { background: var(--bg); color: var(--text-3); }
.pr-ctl input:focus { outline: none; border-color: var(--text-2); }
.pr-new { color: #5b3a9b; }
.dt-table tr.has-rule td { background: #f8f5fd; }
.dt-table tr.is-saving { opacity: .6; }
.dt-table tr.is-saved td { background: #eaf4ec !important; transition: background .2s; }
.tab-n { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--soft); font-size: 11px; font-weight: 600; }
.cu-tab-link { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 10px 8px 12px; color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.cu-tab-link:hover { color: var(--text); }
.cu-tab-link .i { width: 14px; height: 14px; }
.cu-tab-link small { padding: 0 6px; border-radius: 99px; background: #efe7fb; color: #5b3a9b; font-size: 11px; font-weight: 600; }
.av-field { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.av-field input { flex: 1; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; font-size: 16px; }
.av-field span { font-size: 16px; font-weight: 600; color: var(--text-2); }
@media (max-width: 640px) { .pr-pick { flex-direction: column; } .pr-search { flex: none; } .pr-ctl input { width: 70px; } }

/* Bulk reprice dialog */
.rp-panel { width: min(460px, 100%); }
.rp-seg { display: flex; width: 100%; margin-top: 12px; }
.rp-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; }
.rp-seg .i { width: 13px; height: 13px; }
.rp-preview { margin-top: 12px; }
.rp-preview:empty { display: none; }
.rp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 14px auto; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.rp-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-row .i { width: 12px; height: 12px; color: var(--text-3); }
.rp-row strong { font-variant-numeric: tabular-nums; }

/* Social links (footer, contact page) */
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.socials a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); color: var(--text-2); transition: color .15s, border-color .15s, background .15s; }
.socials a:hover { color: var(--text); border-color: var(--text-2); }
.socials svg { width: 17px; height: 17px; }
.socials-inv a { border-color: #3a3935; color: #a7a49d; }
.socials-inv a:hover { color: var(--on-ink); border-color: #75726c; background: #22211f; }
.footer a { color: inherit; }
.footer a:hover { color: var(--on-ink); }

/* Admin settings */
.set-card { padding: 0 22px 22px; }
.set-tabs { margin: 0 -22px 20px; }
.set-form { max-width: 820px; gap: 16px; }
.set-form textarea, .set-soc-row input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 14.5px; font-weight: 400; color: var(--text); resize: vertical; line-height: 1.5; }
.set-form textarea:focus, .set-soc-row input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.set-block { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.set-block-head { padding: 14px 16px; }
.set-block-body { display: grid; gap: 12px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.set-block-title { font-size: 14.5px; color: var(--text); }
.set-switch { display: flex !important; grid-template-columns: none !important; align-items: flex-start; gap: 12px !important; cursor: pointer; font-weight: 400 !important; }
.set-switch > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.set-switch strong { color: var(--text); font-size: 14.5px; font-weight: 600; }
.set-switch small { color: var(--text-3); font-size: 12.5px; }
.set-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 99px; background: var(--line); transition: background .18s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .18s; }
.set-switch input:checked + .sw { background: var(--ink); }
.set-switch input:checked + .sw::after { transform: translateX(16px); }
.set-switch input:focus-visible + .sw { outline: 2px solid var(--text-2); outline-offset: 2px; }
.set-block-body .pe-checks .set-switch { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.set-social { display: grid; gap: 8px; }
.set-soc-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.set-soc-row input { height: 38px; padding-block: 0; }
.set-list-flat { margin: 0 0 16px; padding: 0; border: 1px solid var(--line); border-radius: var(--r); }
.set-form .set-code { margin: 0; }
.set-form code { font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--soft); }
.contact-info .socials { margin-top: 18px; }
@media (max-width: 720px) {
  .set-card { padding: 0 14px 16px; }
  .set-tabs { margin: 0 -14px 16px; }
  .set-soc-row { grid-template-columns: 1fr; }
  .set-form .cu-form-row { grid-template-columns: 1fr; }
}

/* Overview: customer map */
.map-card { margin-top: 12px; }
.map-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgb(18 18 17 / .12); }
.lg-dot.is-pending { background: #c7700f; box-shadow: 0 0 0 3px rgb(199 112 15 / .15); }
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 0; border-top: 1px solid var(--line); }
.map-box { position: relative; height: 460px; min-width: 0; background: transparent; overflow: hidden; }
.map-box .maplibregl-canvas { opacity: 0; transition: opacity .5s; }
.map-box.is-ready .maplibregl-canvas { opacity: 1; }
.map-sk { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(90deg, transparent, rgb(235 233 227 / .6), transparent) 0 0 / 200% 100%; animation: sk-shimmer 1.4s linear infinite; }
.map-box .mini-empty { height: 100%; }
.map-list { margin: 0; padding: 6px; list-style: none; border-left: 1px solid var(--line); max-height: 460px; overflow-y: auto; scrollbar-width: thin; }
.map-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; }
.map-list button:hover, .map-list button.is-active { background: var(--soft); }
.map-list .av { width: 30px; height: 30px; font-size: 11px; flex: none; }
.map-list .mini-main { flex: 1; min-width: 0; }
.map-list .mini-main strong, .map-list .mini-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-list .mini-main strong { font-size: 13.5px; }
.map-list .mini-main small { font-size: 12px; color: var(--text-3); }
.map-rev { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.map-li-sk { display: grid; gap: 6px; padding: 12px 10px; }
.map-box .maplibregl-ctrl-group { border-radius: var(--r-sm); background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgb(0 0 0 / .05); }
.map-box .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.map-box .maplibregl-ctrl-attrib { background: rgb(251 250 248 / .8); font-size: 10.5px; }
.map-box .maplibregl-ctrl-attrib a { color: var(--text-3); }
.map-pop .maplibregl-popup-content { display: grid; gap: 3px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgb(0 0 0 / .12); font: 13px/1.45 inherit; font-family: inherit; color: var(--text-2); }
.map-pop .maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.map-pop strong { color: var(--text); font-size: 14px; }
.map-pop .map-pop-stats { color: var(--text); font-weight: 500; }
.map-pop em.is-pending { font-style: normal; color: #a3500b; }
.map-pop a { margin-top: 4px; color: var(--text); font-weight: 600; }
@media (max-width: 900px) {
  .map-body { grid-template-columns: 1fr; }
  .map-box { height: 360px; }
  .map-list { border-left: 0; border-top: 1px solid var(--line); max-height: 280px; }
}
.map-card { margin: 0 0 12px; }

/* Settings: cart & taxes */
.set-sub { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.set-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.set-money { position: relative; display: block; }
.set-money > span { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--text-3); font-weight: 500; pointer-events: none; }
.set-money input { width: 100%; padding-left: 26px !important; font-variant-numeric: tabular-nums; }
.set-money.is-pct > span { left: auto; right: 12px; }
.set-money.is-pct input { padding-left: 12px !important; padding-right: 28px !important; }
.set-taxes { display: grid; gap: 8px; }
.set-taxes:empty { display: none; }
.set-tax { display: grid; grid-template-columns: 1fr 1fr 110px 1.4fr 36px; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.set-tax input { width: 100%; }
.set-tax .icon-btn { margin-bottom: 3px; }
.set-tax-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.set-preview { padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg); }
.set-preview dl { max-width: 340px; margin-top: 6px; }
.set-preview dl div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.set-preview dl .grand { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text); font-weight: 700; }
@media (max-width: 720px) {
  .set-3 { grid-template-columns: 1fr; }
  .set-tax { grid-template-columns: 1fr 1fr; }
  .set-tax .icon-btn { justify-self: end; }
}

/* ============ Admin themed select menu (src/admin/select.ts) ============ */
select.is-open { border-color: var(--text-2); background-color: var(--surface); }
.sel-pop {
  position: fixed; z-index: 1000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(18, 18, 17, .14), 0 2px 6px rgba(18, 18, 17, .06);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top left;
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.sel-pop.is-up { transform: translateY(4px) scale(.98); transform-origin: bottom left; }
.sel-pop.in { opacity: 1; transform: none; }
.sel-pop:not(.in) { pointer-events: none; }
.sel-search { position: relative; flex: none; padding: 6px; border-bottom: 1px solid var(--line); }
.sel-search .i { position: absolute; left: 16px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%); color: var(--text-3); }
.sel-search input { width: 100%; height: 34px; padding: 0 10px 0 30px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 13.5px; }
.sel-search input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.sel-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px; scrollbar-width: thin; }
.sel-list:focus { outline: none; }
.sel-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 8px 10px; border-radius: 6px; font-size: 13.5px; line-height: 1.35; color: var(--text); cursor: pointer; user-select: none;
}
.sel-opt > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-opt.is-active { background: var(--soft); }
.sel-opt.is-empty { color: var(--text-2); }
.sel-opt[aria-selected="true"] { font-weight: 600; }
.sel-opt[aria-disabled="true"] { color: var(--text-3); cursor: default; }
.sel-check { flex: none; width: 13px; height: 13px; visibility: hidden; }
.sel-opt[aria-selected="true"] .sel-check { visibility: visible; }
.sel-none { padding: 14px 10px; color: var(--text-3); font-size: 13px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .sel-pop { transition: none; } }

/* Order editing (admin drawer) */
.oe-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oe-head .btn { text-transform: none; letter-spacing: 0; }
.oe-edited { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: #efe7fb; color: #5b3a9b; font-style: normal; font-size: 10.5px; letter-spacing: .04em; }
.oe .hint { margin: 0 0 12px; }
.oe-add { position: relative; }
.oe-search { position: relative; }
.oe-search .i { position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--text-3); }
.oe-search input { width: 100%; height: 40px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 14px; }
.oe-search input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.oe-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 320px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 16px 40px rgba(18, 18, 17, .14); }
.oe-res { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 6px; text-align: left; }
.oe-res:hover, .oe-res:focus-visible { background: var(--soft); outline: none; }
.oe-res img, .oe-res .cp-noimg { flex: none; width: 36px; height: 36px; border-radius: 6px; object-fit: contain; background: #fff; }
.oe-res-main { flex: 1; min-width: 0; }
.oe-res-main strong, .oe-res-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-res-main strong { font-size: 13.5px; }
.oe-res-main small { color: var(--text-3); font-size: 12px; }
.oe-res-price { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.oe-res-note { display: flex; align-items: center; gap: 8px; padding: 12px; color: var(--text-3); font-size: 13px; }
.oe-list { display: grid; margin-top: 12px; border-top: 1px solid var(--line); }
.oe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 104px 84px 32px; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.oe-row.is-new { background: linear-gradient(90deg, rgb(47 107 61 / .06), transparent 60%); }
.oe-row.is-new b { color: var(--ok); font-weight: 600; }
.oe-name strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-name small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.oe-qty .icon-btn { width: 30px; height: 32px; border-radius: 0; }
.oe-qty .i { width: 12px; height: 12px; }
.oe-qty input { width: 42px; height: 32px; border: 0; background: transparent; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.oe-qty input::-webkit-inner-spin-button, .oe-price input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.oe-qty input:focus { outline: none; }
.oe-price { position: relative; display: block; }
.oe-price span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.oe-price input { width: 100%; height: 34px; padding: 0 8px 0 22px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.oe-price input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.oe-total { text-align: right; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.oe-del { width: 32px; height: 32px; color: var(--text-3); }
.oe-del:hover { color: var(--err); }
.oe-delivery { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.oe-delivery .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); margin-right: auto; }
.oe-delivery .oe-price { width: 110px; }
.oe [data-oe-err] { margin-top: 12px; }
.oe-sum tfoot { transition: opacity .15s; }
.oe-sum tfoot.is-loading { opacity: .45; }
@media (max-width: 640px) {
  .oe-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name del" "qty total" "price price"; }
  .oe-name { grid-area: name; } .oe-del { grid-area: del; } .oe-qty { grid-area: qty; justify-self: start; }
  .oe-row .oe-price { grid-area: price; } .oe-total { grid-area: total; }
}

/* Settings: supplier sync */
.sync-status { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.sync-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sync-kpis > div { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.sync-kpis span { color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sync-kpis strong { font-size: 18px; letter-spacing: -.01em; }
.sync-kpis small { color: var(--text-2); font-size: 12.5px; }
.sync-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sync-bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.sync-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ink); transition: width .4s var(--ease); }
@media (max-width: 720px) { .sync-kpis { grid-template-columns: 1fr; } }
.pe-lock { margin-top: 2px; }
.pe-lock strong { display: inline-flex; align-items: center; gap: 6px; }
.pe-lock strong .i { width: 13px; height: 13px; }

/* logo: white "Top" tag */

/* ============ Product photo zoom ============ */
.pd-zoom { display: grid; width: 100%; padding: 0; border: 0; cursor: zoom-in; overflow: hidden; }
.pd-zoom img { transition: transform .25s var(--ease); will-change: transform; }
.pd-zoom.is-zooming img { transform: scale(2.2); transition: transform .12s linear; }
.pd-zoom-hint { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgb(255 255 255 / .92); box-shadow: 0 1px 4px rgb(0 0 0 / .12); color: var(--text); opacity: .9; transition: opacity .2s; pointer-events: none; }
.pd-zoom-hint .i { width: 16px; height: 16px; }
.pd-zoom.is-zooming .pd-zoom-hint { opacity: 0; }
.pd-zoom:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
html.zv-open { overflow: hidden; }
.zv { position: fixed; inset: 0; z-index: 200; display: grid; background: rgb(251 250 248 / .97); opacity: 0; transition: opacity .2s; touch-action: none; }
.zv.in { opacity: 1; }
.zv-stage { position: relative; display: grid; place-items: center; overflow: hidden; padding: 56px 16px; }
.zv-stage img { max-width: min(1100px, 100%); max-height: calc(100dvh - 112px); object-fit: contain; cursor: zoom-in; user-select: none; transition: transform .25s var(--ease), opacity .2s; }
.zv.is-zoomed .zv-stage img { cursor: zoom-out; transition: transform .25s var(--ease), transform-origin .08s linear; }
.zv.is-loading .zv-stage img { opacity: .35; }
.zv-btn { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: 0 2px 10px rgb(0 0 0 / .08); }
.zv-btn:hover { border-color: var(--text-2); }
.zv-btn svg { width: 20px; height: 20px; }
.zv-close { top: 14px; right: 14px; }
.zv-prev, .zv-next { top: 50%; transform: translateY(-50%); }
.zv-prev { left: 14px; } .zv-next { right: 14px; }
.zv-count { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.zv.is-zoomed .zv-prev, .zv.is-zoomed .zv-next, .zv.is-zoomed .zv-count { opacity: 0; pointer-events: none; }
@media (max-width: 640px) { .zv-prev, .zv-next { top: auto; bottom: 10px; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pd-zoom img, .zv-stage img, .zv { transition: none; } }

/* ============ Top Distro Chat (storefront widget) ============ */
.tdc-launch {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 120;
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 30px rgb(18 18 17 / .28), 0 2px 6px rgb(18 18 17 / .16);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.tdc-launch:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 36px rgb(18 18 17 / .32), 0 2px 6px rgb(18 18 17 / .16); }
.tdc-launch:focus-visible { outline: 3px solid var(--text-3); outline-offset: 3px; }
.tdc-launch-ic { grid-area: 1 / 1; display: grid; transition: transform .3s var(--ease), opacity .2s; }
.tdc-launch svg { width: 26px; height: 26px; }
.tdc-ic-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.tdc-launch.is-open .tdc-ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.tdc-launch.is-open .tdc-ic-close { opacity: 1; transform: none; }
.tdc-badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #d93025; color: #fff; border: 2px solid var(--bg); font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; animation: tdc-pop .35s var(--ease); }
@keyframes tdc-pop { from { transform: scale(.4); } to { transform: scale(1); } }

.tdc {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 72px); z-index: 121;
  display: flex; flex-direction: column; width: 384px; height: min(620px, calc(100dvh - 120px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 60px rgb(18 18 17 / .22), 0 4px 14px rgb(18 18 17 / .08);
  opacity: 0; transform: translateY(14px) scale(.97); transform-origin: bottom right; pointer-events: none; visibility: hidden;
  transition: opacity .22s var(--ease), transform .28s var(--ease), visibility 0s .28s;
}
.tdc.in { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.tdc-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: var(--ink); color: var(--on-ink); }
.tdc-avatar { position: relative; display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: #fff; color: var(--ink); font: 800 14px/1 "Unbounded", Inter, system-ui, sans-serif; letter-spacing: -.02em; }
.tdc-dot { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: #9a978f; border: 2px solid var(--ink); }
.tdc.is-online .tdc-dot { background: #34c759; }
.tdc-who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tdc-who strong { font-size: 15.5px; letter-spacing: -.01em; }
.tdc-who small { color: #b9b6ae; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdc-x { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--on-ink); }
.tdc-x:hover { background: rgb(255 255 255 / .1); }
.tdc-x svg { width: 20px; height: 20px; }
.tdc-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; background: var(--bg); scroll-behavior: smooth; }
.tdc-day { display: flex; justify-content: center; margin: 14px 0 8px; }
.tdc-day span { padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.tdc-msg { display: grid; grid-template-columns: auto; justify-items: end; margin-top: 3px; }
.tdc-msg.is-first { margin-top: 12px; }
.tdc-msg.is-admin { grid-template-columns: 28px minmax(0, 1fr); justify-items: start; column-gap: 8px; }
.tdc-msg.is-admin time { grid-column: 2; }
.tdc-mini { align-self: end; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--ink); color: #fff; font: 800 9.5px/1 "Unbounded", Inter, sans-serif; }
.tdc-mini:empty { background: none; }
.tdc-bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; animation: tdc-in .22s var(--ease); }
@keyframes tdc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tdc-msg.is-visitor .tdc-bubble { background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.tdc-msg.is-admin .tdc-bubble { max-width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.tdc-bubble a { color: inherit; text-decoration: underline; }
.tdc-bubble.is-emoji { padding: 0; background: none !important; border: 0 !important; font-size: 34px; line-height: 1.15; }
.tdc-msg time { margin: 3px 4px 0; color: var(--text-3); font-size: 11px; }
.tdc-msg:not(.is-first) time, .tdc-msg time:empty { display: none; }
.tdc-msg:last-child time, .tdc-msg.is-failed time { display: block; }
.tdc-msg.is-pending .tdc-bubble { opacity: .6; }
.tdc-msg.is-failed .tdc-bubble { background: #9b2c2c; cursor: pointer; }
.tdc-msg.is-failed time { color: var(--err); }
.tdc-contact { margin: 14px 0 6px 36px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: grid; gap: 8px; animation: tdc-in .25s var(--ease); }
.tdc-contact p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.tdc-contact div { display: grid; grid-template-columns: 1fr 1.3fr; gap: 6px; }
.tdc-contact input { min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font: inherit; font-size: 13.5px; }
.tdc-contact input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.tdc-contact button { justify-self: start; height: 34px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 13px; }
.tdc-err { color: var(--err) !important; }
.tdc-note { margin: 12px 0 0 36px; color: var(--ok); font-size: 13px; }
.tdc-compose { display: flex; align-items: flex-end; gap: 6px; padding: 10px 10px 10px 8px; border-top: 1px solid var(--line); background: var(--surface); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.tdc-compose textarea { flex: 1; min-width: 0; max-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); font: inherit; font-size: 15px; line-height: 1.35; resize: none; }
.tdc-compose textarea:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.tdc-tool, .tdc-send { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); }
.tdc-tool:hover { background: var(--soft); color: var(--text); }
.tdc-tool svg { width: 22px; height: 22px; }
.tdc-send { background: var(--ink); color: var(--on-ink); transition: transform .15s, opacity .15s; }
.tdc-send:disabled { opacity: .3; }
.tdc-send:not(:disabled):active { transform: scale(.92); }
.tdc-send svg { width: 18px; height: 18px; margin-left: 2px; }
@media (max-width: 520px) {
  .tdc { inset: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; transform: translateY(24px); }
  .tdc-head { padding-top: max(16px, env(safe-area-inset-top)); }
  html.tdc-open { overflow: hidden; }
  html.tdc-open .tdc-launch { display: none; }
  .tdc-compose textarea { font-size: 16px; } /* no zoom-on-focus in iOS */
}
@media print { .tdc, .tdc-launch { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .tdc, .tdc-launch, .tdc-launch-ic, .tdc-bubble { transition: none; animation: none; } }

/* ============ Emoji picker (store + admin) ============ */
.ep { position: fixed; z-index: 1100; width: 320px; max-width: calc(100vw - 16px); height: 330px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 48px rgb(18 18 17 / .2); overflow: hidden; opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .15s var(--ease), transform .15s var(--ease); }
.ep.in { opacity: 1; transform: none; }
.ep-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ep-tabs button { flex: none; width: 36px; height: 34px; border: 0; border-radius: 9px; background: none; font-size: 19px; opacity: .55; filter: grayscale(.6); transition: opacity .15s, background .15s; }
.ep-tabs button[aria-selected="true"], .ep-tabs button:hover { opacity: 1; filter: none; background: var(--soft); }
.ep-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 10px; scrollbar-width: thin; }
.ep-body h4 { position: sticky; top: 0; margin: 0; padding: 8px 4px 4px; background: var(--surface); color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-grid button { aspect-ratio: 1; border: 0; border-radius: 9px; background: none; font-size: 23px; line-height: 1; transition: transform .1s, background .1s; }
.ep-grid button:hover { background: var(--soft); transform: scale(1.18); }

/* ============ Admin: Live chat ============ */
.chat-app { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; height: calc(100dvh - var(--header-h) - 120px); min-height: 480px; }
.chat-side, .chat-main { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-search { position: relative; padding: 12px 12px 8px; }
.chat-search .i { position: absolute; left: 24px; top: 50%; width: 14px; height: 14px; margin-top: 2px; transform: translateY(-50%); color: var(--text-3); }
.chat-search input { width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 14px; }
.chat-search input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.chat-tabs { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.chat-tabs button { padding: 5px 10px; border-radius: 99px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.chat-tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.chat-list { flex: 1; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }
.chat-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: var(--r-sm); text-align: left; }
.chat-item:hover { background: var(--soft); }
.chat-item.is-active { background: var(--soft); box-shadow: inset 3px 0 0 var(--ink); }
.chat-item .av { flex: none; }
.chat-item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.chat-item-top time { flex: none; color: var(--text-3); font-size: 11.5px; }
.chat-item-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 13px; }
.chat-item.is-unread .chat-item-top strong, .chat-item.is-unread .chat-item-last { color: var(--text); font-weight: 700; }
.chat-count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.chat-closed { flex: none; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--text-3); font-size: 10.5px; font-weight: 600; }
.chat-sk { display: flex; gap: 10px; padding: 12px 10px; }
.chat-sk > span:last-child { flex: 1; display: grid; gap: 6px; }
.chat-none, .chat-empty { display: grid; justify-items: center; gap: 8px; margin: auto; padding: 40px 20px; color: var(--text-3); text-align: center; font-size: 13.5px; }
.chat-empty .i, .chat-none .i { width: 34px; height: 34px; opacity: .6; }
.chat-empty strong { color: var(--text); font-size: 15px; }
.chat-loading { display: grid; place-items: center; flex: 1; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-back { display: none; }
.chat-head-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-head-main strong { font-size: 15px; }
.chat-head-main small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-main small a { color: var(--text-2); }
.chat-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px 20px; background: var(--bg); }
.chat-day { display: flex; justify-content: center; margin: 14px 0 8px; }
.chat-day span { padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.chat-msg { display: grid; justify-items: start; margin-top: 3px; }
.chat-msg.is-first { margin-top: 12px; }
.chat-msg.is-admin { justify-items: end; }
.chat-bubble { max-width: min(70%, 560px); padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chat-msg.is-admin .chat-bubble { background: var(--ink); color: var(--on-ink); border-color: var(--ink); border-radius: 16px 16px 5px 16px; }
.chat-bubble a { color: inherit; text-decoration: underline; }
.chat-bubble.is-emoji { padding: 0; background: none !important; border: 0 !important; font-size: 32px; }
.chat-msg time { margin: 3px 4px 0; color: var(--text-3); font-size: 11px; }
.chat-msg.is-pending .chat-bubble { opacity: .6; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-compose textarea { flex: 1; min-width: 0; max-height: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font: inherit; font-size: 14.5px; line-height: 1.4; resize: none; }
.chat-compose textarea:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.chat-emoji { width: 40px; height: 40px; font-size: 20px; }
.chat-compose .btn { height: 42px; }
@media (max-width: 860px) {
  .chat-app { grid-template-columns: 1fr; height: calc(100dvh - var(--header-h) - 96px); }
  .chat-app .chat-main { display: none; }
  .chat-app.is-thread .chat-side { display: none; }
  .chat-app.is-thread .chat-main { display: flex; }
  .chat-back { display: grid; }
  .chat-log { padding: 12px; }
  .chat-bubble { max-width: 85%; }
  .chat-compose .btn { width: 42px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
}

/* Chat: "typing…" dots (store widget + admin) */
.tdc-dots, .chat-dots { display: inline-flex !important; align-items: center; gap: 4px; padding: 13px 14px !important; }
.tdc-dots i, .chat-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: chat-dot 1.2s infinite ease-in-out; }
.tdc-dots i:nth-child(2), .chat-dots i:nth-child(2) { animation-delay: .15s; }
.tdc-dots i:nth-child(3), .chat-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-typing-txt { color: var(--ok); font-style: normal; font-weight: 600; }
[data-push].is-on { border-color: var(--ok); color: var(--ok); }
@media (prefers-reduced-motion: reduce) { .tdc-dots i, .chat-dots i { animation: none; opacity: .7; } }
.chat-tag { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--soft); color: var(--text-3); font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; vertical-align: 1px; }
.chat-tag.is-customer { background: #e3efe6; color: var(--ok); }
.chat-card { display: grid; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2); }
.chat-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.chat-card-row > span, .chat-card-row > a { display: inline-flex; align-items: center; gap: 5px; }
.chat-card-row .i { width: 13px; height: 13px; color: var(--text-3); }
.chat-card-row a { color: var(--text); }
.chat-card-row strong { color: var(--text); }
.chat-card-link { margin-left: auto; font-weight: 600; }
.chat-card.is-guest { background: var(--bg); }
.update-bar { position: fixed; left: 50%; bottom: 18px; z-index: 300; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 99px; background: var(--ink); color: var(--on-ink); box-shadow: 0 12px 30px rgb(0 0 0 / .25); font-size: 13.5px; transform: translate(-50%, 140%); transition: transform .3s var(--ease); }
.update-bar.in { transform: translate(-50%, 0); }
.update-bar .i { width: 15px; height: 15px; }
.update-bar .btn { background: #fff; color: var(--ink); border-color: #fff; }

/* ---- Live chat: customer card + composer (all sizes) ---- */
.chat-card-sum { display: none; }
.chat-send { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--ink); color: var(--on-ink); transition: opacity .15s, transform .12s; }
.chat-send .i { width: 18px; height: 18px; }
.chat-send:disabled { opacity: .3; }
.chat-send:not(:disabled):active { transform: scale(.92); }
.chat-compose { align-items: flex-end; }
.chat-compose textarea { border-radius: 21px; padding: 10px 14px; }

/* ---- Live chat on phones: an app-like, keyboard-aware conversation ---- */
@media (max-width: 860px) {
  .chat-app { height: calc(100dvh - var(--header-h) - 84px); min-height: 0; }
  .chat-side { border-radius: var(--r-lg); }
  .chat-item { min-height: 64px; padding: 10px 8px; }
  .chat-item .av { width: 44px; height: 44px; font-size: 14px; }
  .chat-item-top strong { font-size: 15px; }
  .chat-item-last { font-size: 13.5px; }
  .chat-tabs { overflow-x: auto; scrollbar-width: none; }
  .chat-tabs button { flex: none; padding: 7px 12px; }

  /* Open conversation = full screen, sized to the visible area above the keyboard. */
  html.chat-thread-open, html.chat-thread-open body { overflow: hidden; overscroll-behavior: none; }
  .chat-app.is-thread .chat-main {
    position: fixed; left: 0; right: 0; top: var(--chat-top, 0px); z-index: 160;
    height: var(--chat-vh, 100dvh); border: 0; border-radius: 0; box-shadow: none; background: var(--surface);
  }
  .chat-head { gap: 10px; padding: max(8px, env(safe-area-inset-top)) 8px 8px 4px; min-height: 56px; background: var(--surface); }
  .chat-head .av { width: 38px; height: 38px; font-size: 13px; }
  .chat-back { display: grid; width: 40px; height: 40px; }
  .chat-head-main strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-head-main small { font-size: 12px; }
  .chat-status-btn { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%; }
  .chat-status-btn span { display: none; }
  .chat-head-actions .icon-btn { width: 38px; height: 38px; }

  .chat-card { padding: 0; gap: 0; }
  .chat-card-sum { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 14px; color: var(--text-2); font-size: 13px; text-align: left; }
  .chat-card-sum > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-card-sum .i { width: 14px; height: 14px; flex: none; color: var(--text-3); transition: transform .2s; }
  .chat-card.is-open .chat-card-sum .i:last-child { transform: rotate(180deg); }
  .chat-card .chat-card-row { display: none; padding: 0 14px 10px; }
  .chat-card.is-open .chat-card-row { display: flex; }
  .chat-card.is-guest .chat-card-row { display: flex; padding: 9px 14px; }
  .chat-card-link { margin-left: 0; }

  .chat-log { padding: 12px 10px 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .chat-bubble { max-width: 82%; font-size: 15.5px; padding: 9px 13px; }
  .chat-msg time { font-size: 10.5px; }
  .chat-compose { gap: 6px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); background: var(--surface); }
  html.chat-kb .chat-compose { padding-bottom: 8px; }
  .chat-compose textarea { font-size: 16px; min-height: 42px; max-height: 120px; background: var(--bg); }
  .chat-emoji { width: 42px; height: 42px; }
}

/* ---- Live chat customer card (v2: structured) ---- */
.chat-card { display: block; padding: 0; background: var(--surface); }
.chat-card-sum { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 16px; color: var(--text-2); font-size: 13px; text-align: left; }
.chat-card-sum > span:not(.st) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-card-sum > .st { flex: none; }
.chat-card-sum em { font-style: normal; font-weight: 600; color: var(--text); font-size: 12.5px; }
.chat-card-sum .i { width: 14px; height: 14px; flex: none; color: var(--text-3); transition: transform .2s var(--ease); }
.chat-card.is-open .chat-card-sum .i { transform: rotate(180deg); }
.chat-card-body { display: none; padding: 2px 16px 12px; }
.chat-card.is-open .chat-card-body { display: grid; gap: 10px; }
.chat-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 18px; margin: 0; }
.chat-facts > div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.chat-facts dt { color: var(--text-3); font-size: 12px; font-weight: 600; }
.chat-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.chat-facts dd a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.chat-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-card-actions .btn { flex: 1 1 auto; justify-content: center; }
.chat-guest { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 9px 16px; font-size: 13px; color: var(--text-2); background: var(--bg); }
.chat-guest .i { width: 14px; height: 14px; color: var(--text-3); }
.chat-guest strong { color: var(--text); }
.chat-guest a { margin-left: auto; color: var(--text); }
@media (max-width: 860px) {
  .chat-card .chat-card-row { display: none !important; }
  .chat-card-sum { padding: 9px 14px; }
  .chat-card-body { padding: 0 14px 12px; max-height: 46vh; overflow-y: auto; }
  .chat-facts { grid-template-columns: 1fr; }
  .chat-facts > div { grid-template-columns: 70px minmax(0, 1fr); padding: 8px 0; }
  .chat-guest { padding: 9px 14px; }
}

/* ============ Admin: Email (chat-style mail client) ============ */
.mail-app { position: relative; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 12px; height: calc(100dvh - var(--header-h) - 120px); min-height: 500px; }
.mail-side, .mail-main { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.mail-search { position: relative; padding: 12px 12px 8px; }
.mail-search .i { position: absolute; left: 24px; top: 50%; width: 14px; height: 14px; margin-top: 2px; transform: translateY(-50%); color: var(--text-3); }
.mail-search input { width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 14px; }
.mail-search input:focus { outline: none; border-color: var(--text-2); background: var(--surface); }
.mail-folders { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.mail-folders button { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.mail-folders button .i { width: 13px; height: 13px; }
.mail-folders button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.mail-folders small { min-width: 16px; padding: 0 5px; border-radius: 99px; background: var(--soft); color: var(--text); font-size: 10.5px; font-weight: 700; text-align: center; }
.mail-folders small:empty { display: none; }
.mail-folders button[aria-selected="true"] small { background: rgb(255 255 255 / .18); color: var(--on-ink); }
.mail-scroll { flex: 1; overflow-y: auto; }
.mail-list { margin: 0; padding: 6px; list-style: none; }
.mail-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; border-radius: var(--r-sm); text-align: left; }
.mail-item:hover { background: var(--soft); }
.mail-item.is-active { background: var(--soft); box-shadow: inset 3px 0 0 var(--ink); }
.mail-item .av { flex: none; margin-top: 2px; }
.mail-item-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mail-item-top { display: flex; justify-content: space-between; gap: 8px; }
.mail-item-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.mail-item-top time { flex: none; color: var(--text-3); font-size: 11.5px; }
.mail-item-subj, .mail-item-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mail-item-subj { color: var(--text); }
.mail-item-snip { color: var(--text-3); }
.mail-item-snip .i { width: 11px; height: 11px; vertical-align: -1px; }
.mail-item.is-unread .mail-item-top strong, .mail-item.is-unread .mail-item-subj { font-weight: 700; }
.mail-item.is-unread::before { content: ""; flex: none; width: 8px; height: 8px; margin: 18px -4px 0 -2px; border-radius: 50%; background: var(--ink); }
.mail-starred { margin-right: 4px; color: #c7700f; font-style: normal; }
.mail-more { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 8px; padding: 8px; color: var(--text-3); font-size: 13px; }
.mail-head .chat-head-main strong { font-size: 15.5px; }
.mail-thread { flex: 1; overflow-y: auto; padding: 14px 18px; background: var(--bg); display: grid; align-content: start; gap: 10px; }
.mail-msg { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.mail-msg.is-out { border-color: #d6d3cb; background: #fbfaf6; }
.mail-msg-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; text-align: left; }
.mail-msg-who { flex: 1; min-width: 0; display: grid; }
.mail-msg-who strong { font-size: 14px; }
.mail-msg-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.mail-msg-head time { flex: none; color: var(--text-3); font-size: 12px; }
.mail-msg-snip { padding: 0 14px 12px 64px; margin-top: -6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 13px; }
.mail-msg-body { display: none; padding: 0 16px 16px; }
.mail-msg.is-open .mail-msg-body { display: block; }
.mail-msg.is-open .mail-msg-snip { display: none; }
.mail-frame { display: block; width: 100%; height: 120px; border: 0; background: transparent; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.mail-atts li a, .mail-atts li.is-off { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font-size: 13px; }
.mail-atts li.is-off { opacity: .55; }
.mail-atts span { min-width: 0; display: grid; }
.mail-atts small { color: var(--text-3); font-size: 11.5px; }
.mail-atts .i { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.mail-reply textarea { max-height: 180px; }
.mail-fab { display: none; }
.icon-btn.is-on { color: #c7700f; }

/* Compose sheet */
.mail-sheet { position: fixed; inset: 0; z-index: 400; display: grid; place-items: end center; padding: 16px; background: rgb(18 18 17 / .32); opacity: 0; transition: opacity .2s; }
.mail-sheet.in { opacity: 1; }
.mail-sheet-panel { display: flex; flex-direction: column; width: min(680px, 100%); height: min(640px, calc(100dvh - 32px)); border-radius: 18px; background: var(--surface); box-shadow: 0 30px 80px rgb(0 0 0 / .3); overflow: hidden; transform: translateY(24px); transition: transform .25s var(--ease); }
.mail-sheet.in .mail-sheet-panel { transform: none; }
html.mail-sheet-open { overflow: hidden; }
.mail-sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mail-sheet-head strong { flex: 1; font-size: 15.5px; }
.mail-sheet-body { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.mail-field { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line); min-height: 46px; }
.mail-field .lbl { flex: none; width: 56px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.mail-field > input { flex: 1; min-width: 0; height: 34px; border: 0; background: none; font-size: 15px; outline: none; }
.mail-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: text; }
.mail-chips input { flex: 1; min-width: 140px; height: 32px; border: 0; background: none; font-size: 15px; outline: none; }
.mail-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--soft); font-size: 13.5px; overflow-wrap: anywhere; }
.mail-chip.is-bad { background: #f6e3e3; color: var(--err); }
.mail-chip button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-2); font-size: 15px; line-height: 1; }
.mail-chip button:hover { background: rgb(0 0 0 / .08); }
.mail-suggest { position: absolute; left: 12px; right: 12px; top: 92px; z-index: 5; padding: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: 0 16px 40px rgb(0 0 0 / .14); }
.mail-suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--r-sm); text-align: left; }
.mail-suggest button:hover { background: var(--soft); }
.mail-suggest span { flex: 1; min-width: 0; display: grid; }
.mail-suggest small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.mail-body { flex: 1; min-height: 180px; padding: 14px 16px; border: 0; background: none; font: inherit; font-size: 15px; line-height: 1.6; resize: none; outline: none; }
.mail-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0 16px 12px; list-style: none; }
.mail-files:empty { display: none; }
.mail-files li { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 13px; }
.mail-files li span { min-width: 0; display: grid; }
.mail-files small { color: var(--text-3); font-size: 11.5px; }
.mail-files .i { width: 14px; height: 14px; color: var(--text-3); }
.mail-files .icon-btn { width: 28px; height: 28px; }
.mail-sheet-foot { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); }
.mail-sheet-foot label.icon-btn { cursor: pointer; }
.mail-sheet-foot .hint { margin-left: auto; color: var(--text-3); font-size: 12px; }

@media (max-width: 860px) {
  .mail-app { grid-template-columns: 1fr; height: calc(100dvh - var(--header-h) - 84px); min-height: 0; }
  .mail-app .mail-main { display: none; }
  .mail-app.is-reading .mail-side { display: none; }
  .mail-app.is-reading .mail-main { display: flex; position: fixed; left: 0; right: 0; top: var(--chat-top, 0px); z-index: 160; height: var(--chat-vh, 100dvh); border: 0; border-radius: 0; box-shadow: none; }
  .mail-item { min-height: 72px; }
  .mail-item .av { width: 42px; height: 42px; }
  .mail-thread { padding: 10px 8px; }
  .mail-msg-snip { padding-left: 14px; margin-top: 0; }
  .mail-msg-body { padding: 0 12px 14px; }
  .mail-reply { background: var(--surface); }
  .mail-fab { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 120; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 28px rgb(0 0 0 / .28); }
  .mail-fab .i { width: 22px; height: 22px; }
  html.chat-thread-open .mail-fab { display: none; }
  .mail-sheet { padding: 0; place-items: stretch; }
  .mail-sheet-panel { width: 100%; height: var(--chat-vh, 100dvh); margin-top: var(--chat-top, 0px); border-radius: 0; }
  .mail-sheet-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .mail-sheet-foot { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  html.chat-kb .mail-sheet-foot { padding-bottom: 8px; }
  .mail-sheet-foot .hint { display: none; }
  .mail-field > input, .mail-chips input, .mail-body { font-size: 16px; }
}
.mail-suggest .av { flex: none; width: 34px; height: 34px; }

/* ============ Admin tables on phones: app-style list cards (desktop unchanged) ============ */
@media (min-width: 641px) { .mini-table .cell-person .av { display: none; } }
@media (max-width: 640px) {
  .dt-table tbody tr.dt-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
    padding: 13px 14px; border-bottom: 1px solid var(--line); grid-template-columns: none;
  }
  .dt-table tbody tr.dt-row:last-child { border-bottom: 0; }
  .dt-table tbody tr.dt-row.is-link:active { background: var(--soft); }
  .dt-table tbody tr.dt-row > td {
    display: block; position: static; grid-column: auto; padding: 0; border: 0; min-width: 0; text-align: left; background: none !important;
  }
  .dt-table tbody tr.dt-row > td::before { display: none !important; }
  .dt-table tbody tr.dt-row > td.hide-sm, .dt-table tbody tr.dt-row > td.m-hide { display: none !important; }

  /* line 1 */
  .dt-table tbody tr.dt-row > td.dt-check { order: 0; align-self: flex-start; margin-top: 2px; }
  .dt-table tbody tr.dt-row > td.m-title { order: 1; flex: 1 1 60%; font-weight: 600; font-size: 15px; overflow: hidden; }
  .dt-table tbody tr.dt-row > td.m-value + td, .dt-table tbody tr.dt-row::after { }
  .dt-table tbody tr.dt-row > td.m-badge { flex-basis: auto; }
  .dt-table tbody tr.dt-row > td.m-title strong, .dt-table tbody tr.dt-row > td.m-title .cell-product strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .dt-table tbody tr.dt-row > td.m-value { order: 2; flex: none; margin-left: auto; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
  .dt-table tbody tr.dt-row > td.m-value small, .dt-table tbody tr.dt-row > td.m-value .was { display: inline; margin-left: 4px; }

  /* line 2: small grey facts · separated, badge on the right */
  .dt-table tbody tr.dt-row > td.m-meta { order: 3; flex: none; max-width: 100%; color: var(--text-3); font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dt-table tbody tr.dt-row > td.m-meta strong { font-weight: 600; color: var(--text-2); }
  .dt-table tbody tr.dt-row > td.m-badge { order: 4; flex: none; margin-left: auto; }
  .dt-table tbody tr.dt-row > td.m-badge .st { font-size: 11.5px; }
  .dt-table tbody tr.dt-row > td.m-sub { order: 5; flex: 1 1 100%; color: var(--text-2); font-size: 13.5px; line-height: 1.45; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dt-table tbody tr.dt-row > td.m-full { order: 6; flex: 1 1 100%; margin-top: 6px; }
  .dt-table tbody tr.dt-row > td.dt-actions { order: 7; flex: 1 1 100%; display: flex; gap: 6px; margin-top: 8px; }
  .dt-table tbody tr.dt-row > td.dt-actions .btn { flex: 1; height: 36px; justify-content: center; }

  /* person / product cells inside the title */
  .dt-table tbody tr.dt-row .cell-person, .dt-table tbody tr.dt-row .cell-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .dt-table tbody tr.dt-row .cell-person .av { width: 38px; height: 38px; flex: none; font-size: 12.5px; }
  .dt-table tbody tr.dt-row .cell-person > span:not(.av), .dt-table tbody tr.dt-row .cell-product > span { min-width: 0; display: grid; }
  .dt-table tbody tr.dt-row .cell-person small, .dt-table tbody tr.dt-row .cell-product small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12.5px; font-weight: 400; }
  .dt-table tbody tr.dt-row .cell-product img, .dt-table tbody tr.dt-row .cell-product .cp-noimg { width: 46px; height: 46px; flex: none; border-radius: 10px; }
  /* meta starts under the text, not under the avatar */
  .dt-table tbody tr.dt-row:has(> td.m-title .av) > td.m-meta:not(.hide-sm):not(.m-meta:not(.hide-sm) ~ td) { margin-left: 48px; }
  .dt-table tbody tr.dt-row:has(> td.m-title img, > td.m-title .cp-noimg) > td.m-meta:not(.hide-sm):not(.m-meta:not(.hide-sm) ~ td) { margin-left: 56px; }

  /* Overview "Recent orders" card */
  .mini-table thead { display: none; }
  .mini-table tbody tr.dt-row { padding: 12px 4px; }
}
@media (max-width: 640px) {
  .dt-table tbody tr.dt-row:has(> td.dt-check):has(> td.m-title .av) > td.m-meta:not(.hide-sm):not(.m-meta:not(.hide-sm) ~ td) { margin-left: 80px; }
  .dt-table tbody tr.dt-row:has(> td.dt-check):has(> td.m-title img, > td.m-title .cp-noimg) > td.m-meta:not(.hide-sm):not(.m-meta:not(.hide-sm) ~ td) { margin-left: 88px; }
  .dt-table tbody tr.dt-row > td.dt-check input { width: 18px; height: 18px; }
}

/* ---- Scrolling fix: flex/grid children must be allowed to shrink so their own scrollbars work (desktop + mobile) ---- */
.chat-list, .chat-log, .mail-scroll, .mail-thread, .chat-side, .chat-main, .mail-side, .mail-main { min-height: 0; }
.mail-thread { grid-template-columns: minmax(0, 1fr); overscroll-behavior: contain; }
.mail-msg { min-width: 0; }
.mail-frame { max-width: 100%; }

/* ---- Email reply bar (chat-style pill) ---- */
.mail-reply { gap: 8px; align-items: flex-end; }
.mail-plus { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); }
.mail-plus:hover { color: var(--text); border-color: var(--text-2); }
.mail-plus .i { width: 18px; height: 18px; }
.mail-reply-box { flex: 1; min-width: 0; display: flex; align-items: flex-end; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); transition: border-color .15s, background .15s; }
.mail-reply-box:focus-within { border-color: var(--text-2); background: var(--surface); }
.mail-reply-box textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 160px; padding: 11px 4px 11px 16px; border: 0 !important; background: none !important; border-radius: 0; font: inherit; font-size: 15px; line-height: 1.35; resize: none; outline: none; }
.mail-reply-emoji { flex: none; width: 40px; height: 42px; display: grid; place-items: center; font-size: 19px; opacity: .75; }
.mail-reply-emoji:hover { opacity: 1; }

/* ---- Email on phones: an app, not a web page ---- */
@media (max-width: 860px) {
  body.adm-body:has(.mail-app) .adm-page-head { display: none; }
  .mail-app { height: calc(100dvh - var(--header-h) - 66px); }
  .mail-side { border-radius: var(--r-lg); }
  .mail-search { padding: 10px 10px 6px; }
  .mail-folders { padding: 0 10px 8px; }
  .mail-folders button { padding: 7px 12px; font-size: 13.5px; }
  .mail-list { padding: 2px 4px 80px; }
  .mail-item { gap: 12px; padding: 12px 10px; border-radius: 12px; }
  .mail-item-top strong { font-size: 15px; }
  .mail-item-subj { font-size: 14px; }
  .mail-item-snip { font-size: 13px; }

  /* reader */
  .mail-head { gap: 6px; padding: max(6px, env(safe-area-inset-top)) 6px 6px 2px; min-height: 54px; }
  .mail-head .chat-head-main { padding-left: 2px; }
  .mail-head .chat-head-main strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-head .chat-head-actions { gap: 0; }
  .mail-head .chat-head-actions .icon-btn { width: 40px; height: 40px; }
  .mail-thread { padding: 0; gap: 0; background: var(--surface); }
  .mail-msg { border: 0; border-bottom: 8px solid var(--bg); border-radius: 0; background: var(--surface); }
  .mail-msg.is-out { background: var(--surface); }
  .mail-msg-head { padding: 14px 14px 10px; gap: 12px; }
  .mail-msg-head .av { width: 40px; height: 40px; }
  .mail-msg-who strong { font-size: 15px; }
  .mail-msg-snip { padding: 0 14px 14px 66px; }
  .mail-msg-body { padding: 2px 14px 18px; }
  .mail-text { font-size: 16px; line-height: 1.55; }
  .mail-atts li a, .mail-atts li.is-off { max-width: 100%; flex: 1 1 100%; }
  .mail-atts { flex-direction: column; }
  .mail-reply { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
  html.chat-kb .mail-reply { padding-bottom: 8px; }
  .mail-reply-box textarea { font-size: 16px; }
  .mail-reply-emoji { display: none; }
  .mail-reply-box textarea { padding-right: 14px; }
}
/* Thread = vertical flex column: each message keeps its full height and the thread scrolls (desktop + mobile). */
.mail-thread { display: flex !important; flex-direction: column; align-items: stretch; }
.mail-thread > .mail-msg { flex: none; }
/* Admin sign-in: show / hide password */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 48px !important; }
.pw-eye { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-3); }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--text); background: var(--soft); outline: none; }
.pw-eye .i { width: 18px; height: 18px; }
.pw-eye .pw-hide, .pw-eye[aria-pressed="true"] .pw-show { display: none; }
.pw-eye[aria-pressed="true"] .pw-hide { display: grid; }
.pw-eye .pw-show { display: grid; }
/* In-app viewer for invoices / pick lists (installed app & phones) */
.doc-view { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; background: var(--bg); opacity: 0; transform: translateY(16px); transition: opacity .2s, transform .25s var(--ease); }
.doc-view.in { opacity: 1; transform: none; }
html.doc-open { overflow: hidden; }
.doc-bar { display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 8px 4px; border-bottom: 1px solid var(--line); background: var(--surface); }
.doc-bar strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; }
.doc-frame-wrap { position: relative; flex: 1; min-height: 0; }
.doc-frame-wrap .spin { position: absolute; top: 40%; left: 50%; margin-left: -10px; }
.doc-view.is-loaded .doc-frame-wrap .spin { display: none; }
.doc-frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
a.is-busy { opacity: .55; pointer-events: none; }
/* Share pick list sheet */
.share-panel { width: min(480px, 100%); }
.share-link { display: flex; gap: 6px; margin-top: 14px; }
.share-link input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }
.share-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; margin: 14px 0 0; padding: 0; list-style: none; text-align: left; }
.share-list li { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.share-id { flex: 1; min-width: 0; display: grid; }
.share-id strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.share-id small { color: var(--text-3); font-size: 12px; }
.share-list .icon-btn { width: 36px; height: 36px; flex: none; }
