/* Kaku — storefront and admin styles. No external assets; system fonts. */

/* Default palette (简约, light). */
:root {
  --bg: #fafafa;
  --bg-soft: #f4f4f5;
  --card: #ffffff;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-2: #d4d4d8;
  --accent: #0E7490;
  --accent-hover: #155E75;
  --accent-soft: #ECF8FA;
  --accent-ink: #155E75;
  --accent-text: #ffffff;
  --link: #0E7490;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --info: #3f3f46;
  --info-soft: #f4f4f5;
  --code: #f4f4f5;
  --price: #09090b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 232px;
  --font-head: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --ph-fg: 42%; --ph-bg: 93%; --ph-hi: 98%; --ph-sat: 8%;
  --logo-bg: #0E7490; --logo-fg: #ffffff; --logo-leg: #a3e635;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}
/* Theme tokens (palette, dark mode, accent) are written into each page by
   the server (internal/web/theme.go); the values above are the fallback. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1 { font-size: 22px; line-height: 1.3; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 24px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.lg { width: 22px; height: 22px; }
.muted { color: var(--muted); font-size: 13px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- top bar (storefront) ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .row { min-height: 60px; flex-wrap: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; overflow: hidden;
  background: var(--logo-bg); --k-fg: var(--logo-fg); --k-leg: var(--logo-leg);
}
.logo svg { width: 100%; height: 100%; display: block; }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo:has(img) { background: none; }
nav.main { display: flex; gap: 4px; }
nav.main a {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; white-space: nowrap;
}
nav.main a:hover { background: var(--bg-soft); text-decoration: none; }
nav.main a.on { background: var(--bg-soft); color: var(--text); }
main.page { padding-top: 30px; padding-bottom: 32px; min-height: calc(100vh - 160px); }
.foot { color: var(--muted); font-size: 13px; padding: 24px 24px 40px; display: flex; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* ---------- surfaces ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card > h2:first-child, .card > h3:first-child, .card > p:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text-2); padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 14px;
}
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; word-break: break-word; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }
.flash .ic { margin-top: 2px; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > button:not(.block) { align-self: flex-start; min-width: 96px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--card);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 40px; }
input[type=file] { height: 40px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; resize: vertical; }
button, .btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-text); transition: filter .15s, transform .05s, background .15s;
  white-space: nowrap; text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--card); color: var(--text); border-color: var(--line-2); }
button.secondary:hover, .btn.secondary:hover { background: var(--bg-soft); }
button.danger, .btn.danger { background: var(--err); color: #fff; }
button.danger:hover, .btn.danger:hover { background: var(--err); opacity: .9; }
button.link:hover, button.ghost:hover { background: none; text-decoration: underline; }
button.link { background: none; color: var(--link); padding: 0; border: 0; font-weight: 500; }
button.ghost { background: none; color: var(--muted); border: 0; padding: 6px 8px; }
.btn.lg, button.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn.block, button.block { width: 100%; }
form.inline { display: inline; }
.options { display: flex; flex-wrap: wrap; gap: 10px; }
.option {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 14px; cursor: pointer;
  flex-direction: row; align-items: center; gap: 10px; font-weight: 400; color: var(--text); background: var(--card);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.option:hover { border-color: var(--text-2); }
.option:has(input:checked) { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 1px var(--accent); }
.option.disabled { opacity: .45; cursor: not-allowed; }
.option.sku { flex: 1 1 200px; align-items: flex-start; }
.option.sku .name { font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; width: max-content; }
.qty button { background: var(--card); color: var(--text); border: 0; border-radius: 0; padding: 8px 14px; font-size: 16px; }
.qty button:hover { background: var(--bg-soft); }
.qty input { border: 0; border-radius: 0; width: 64px; text-align: center; box-shadow: none !important; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }

/* ---------- code / secrets ---------- */
code, .secret { font-family: var(--mono); background: var(--code); padding: 2px 6px; border-radius: 6px; word-break: break-all; font-size: .92em; }
.secret-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.secret-row .secret { flex: 1; min-width: 0; padding: 10px 12px; border: 1px dashed var(--line-2); font-size: 14px; }
pre { background: var(--code); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 13px; white-space: pre-wrap; word-break: break-all; font-family: var(--mono); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 6px 0; }
.card.table-wrap > h2 { padding: 10px 20px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; background: var(--bg-soft); }
.card.table-wrap th:first-child, .card.table-wrap td:first-child { padding-left: 20px; }
.card.table-wrap th:last-child, .card.table-wrap td:last-child { padding-right: 20px; }
tr:last-child td { border-bottom: 0; }
/* detail (key-value) tables: row headers are muted labels, not column headers */
table.detail th { background: none; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; width: 96px; }
table.detail th, table.detail td { padding: 9px 12px; }
td a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
td a:hover { text-decoration-color: currentColor; }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg-soft); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.paid, .badge.reserved, .badge.issued, .badge.replied { background: var(--blue-soft); color: var(--blue); }
.badge.delivered, .badge.available, .badge.activated, .badge.on { background: var(--ok-soft); color: var(--ok); }
.badge.failed, .badge.refunded, .badge.revoked, .badge.void { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.expired, .badge.sold, .badge.closed { background: var(--bg-soft); color: var(--muted); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 2px; position: relative;
}
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; line-height: 1.3; }
.stat .stat-ic {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--bg-soft); color: var(--text-2);
}
.stat.warn .stat-ic { background: var(--warn-soft); color: var(--warn); }
.stat.err .stat-ic { background: var(--err-soft); color: var(--err); }
.stat.ok .stat-ic { background: var(--ok-soft); color: var(--ok); }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 12px; font-size: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters input, .filters select { width: auto; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; align-items: end; }
.fields .wide { grid-column: span 2; }
.fields > label.check, .fields > button, .filters > label.check { min-height: 40px; }
.fields > button { justify-self: start; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.hint { font-weight: 400; color: var(--muted); }
.section { padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.section h3 { margin: 0 0 4px; font-size: 15px; }
.section > p.muted { margin: 0 0 12px; font-size: 13px; }
.form-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.form-foot .muted { font-size: 13px; }
.action-result { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-soft); font-size: 14px; }
.action-result > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.action-result .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.action-result small { font-size: 12px; }
.action-result.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 9%, var(--card)); }
.action-result.ok .ic, .action-result.ok b { color: var(--ok); }
.action-result.err { border-color: color-mix(in srgb, var(--err) 45%, var(--line)); background: color-mix(in srgb, var(--err) 8%, var(--card)); }
.action-result.err .ic, .action-result.err b { color: var(--err); }
.action-result.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type=file] { padding: 6px; color: var(--muted); cursor: pointer; }
input[type=file]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 600; margin-right: 12px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-soft); color: var(--text);
}
input[type=file]::file-selector-button:hover { background: var(--line); }
.danger-zone { border-color: color-mix(in srgb, var(--err) 30%, var(--line)); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone h3 { margin: 0 0 2px; font-size: 15px; }
.danger-zone p { margin: 0; font-size: 13px; }
td.nowrap, td code { white-space: nowrap; word-break: normal; }
table.mid td { vertical-align: middle; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; }
.seg a { padding: 5px 12px; border-radius: 7px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.md { color: var(--text-2); overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; }
.md ul { padding-left: 20px; margin: 0 0 10px; }
.md h3, .md h4, .md h5 { color: var(--text); }
details summary { cursor: pointer; color: var(--text-2); font-size: 14px; font-weight: 500; }
.qr { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }

/* bars (sales statistics) */
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: 56px 1fr minmax(130px, auto); gap: 10px; align-items: center; font-size: 13px; }
.bar-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { background: var(--bg-soft); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.bar-value { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- storefront: home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 36px 28px; margin-bottom: 20px;
  background-color: var(--card); border: 1px solid var(--line);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px; background-position: -9px -9px;
}
.hero > * { position: relative; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--card) 30%, color-mix(in srgb, var(--card) 40%, transparent));
}
.hero h1 { font-size: 30px; letter-spacing: -.03em; margin-bottom: 6px; }
.hero p { color: var(--muted); margin: 0; max-width: 560px; }
.hero .search {
  margin-top: 20px; display: flex; flex-direction: row; align-items: center; gap: 8px; max-width: 440px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 12px; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.hero .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.hero .search input { background: transparent; border: 0; padding: 11px 0; box-shadow: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px; font-weight: 500;
}
.chip:hover { border-color: var(--text-2); color: var(--text); text-decoration: none; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; font-size: 18px; }
.section-title .count { color: var(--muted); font-size: 13px; font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.product-card {
  display: flex; flex-direction: column; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); text-decoration: none; }
.cover { aspect-ratio: 16 / 9; width: 100%; object-fit: contain; display: block; background: var(--bg-soft); }
.cover.ph {
  display: grid; place-items: center; font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  color: hsl(var(--ph-h, var(--h, 240)) var(--ph-sat) var(--ph-fg));
  background:
    radial-gradient(circle at 30% 20%, hsl(var(--ph-h, var(--h, 240)) var(--ph-sat) var(--ph-hi)), transparent 60%),
    hsl(var(--ph-h, var(--h, 240)) var(--ph-sat) var(--ph-bg));
}
.product-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-card .title { font-weight: 600; font-size: 15px; line-height: 1.4; }
.product-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.price { color: var(--price); font-weight: 700; font-variant-numeric: tabular-nums; }
.price.big { font-size: 26px; letter-spacing: -.02em; }
.price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stock { font-size: 12px; color: var(--muted); }
.stock.out { color: var(--err); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; margin-bottom: 8px; opacity: .6; }

/* ---------- storefront: product ---------- */
.product-layout {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 20px; align-items: start;
  grid-template-areas: "info panel" "desc panel"; grid-template-rows: auto 1fr;
}
.product-layout > .card { margin-bottom: 0; }
.product-layout .info { grid-area: info; }
.product-layout .desc { grid-area: desc; align-self: start; }
.product-layout .info { display: grid; grid-template-columns: minmax(160px, 40%) minmax(0, 1fr); gap: 22px; align-items: start; }
.product-layout .info .cover { border-radius: var(--radius-sm); aspect-ratio: 1; margin: 0; }
.info-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.info-text h1 { margin: 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.info-text { min-width: 0; }
.sku-tiers { display: block; font-size: 12px; color: var(--ok); margin-top: 2px; }
.sku-top .name { min-width: 0; overflow-wrap: anywhere; }
.info-price { font-size: 24px; }
.info-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-2); }
.tag .ic { width: 13px; height: 13px; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--card)); }
.tag.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.info-promise { margin: 0; font-size: 13px; }
.desc-body.clamped { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.desc-more { margin-top: 8px; font-size: 13px; }
.sku-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sku-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sku-top .stock { flex: none; white-space: nowrap; }
.desc-title { font-size: 15px; margin: 0 0 10px; }
.order-panel { grid-area: panel; position: sticky; top: 80px; }
.buy-bar { display: flex; flex-direction: column; gap: 12px; }
.total-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0 4px; border-top: 1px dashed var(--line-2); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

/* ---------- storefront: pay / order ---------- */
.narrow { max-width: 640px; margin: 0 auto; }
.steps { display: flex; align-items: center; gap: 0; margin: 4px 0 22px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-soft); border: 1px solid var(--line-2); font-size: 12px; font-weight: 700; }
.step.done { color: var(--text); }
.step.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.step.now { color: var(--text); font-weight: 600; }
.step.now .dot { background: var(--card); border: 2px solid var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.step-line { flex: 1; height: 2px; background: var(--line); margin: 0 10px; min-width: 16px; }
.step-line.done { background: var(--accent); }
.status-hero { text-align: center; padding: 8px 0 4px; }
.status-hero .icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; background: var(--bg-soft); color: var(--text-2); }
.status-hero .icon .ic { width: 28px; height: 28px; }
.status-hero.ok .icon { background: var(--ok-soft); color: var(--ok); }
.status-hero.warn .icon { background: var(--warn-soft); color: var(--warn); }
.status-hero.err .icon { background: var(--err-soft); color: var(--err); }
.status-hero h1 { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 14px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-all; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--warn); }
.pay-box { text-align: center; padding: 6px 0; }
.amount-tag { display: inline-flex; align-items: baseline; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); background: var(--bg-soft); }
.auth-card { max-width: 400px; margin: 48px auto; }
.auth-card .brand { justify-content: center; margin-bottom: 18px; font-size: 19px; }

/* ---------- admin shell ---------- */
body.admin { background: var(--bg); }
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--card) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), transparent var(--sidebar)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card);
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand { padding: 4px 8px 14px; font-size: 16px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--bg-soft); text-decoration: none; }
.nav-link.on { background: var(--bg-soft); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav-link .ic { width: 17px; height: 17px; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; line-height: 1; color: var(--accent-text); background: var(--accent); border-radius: 999px; padding: 3px 7px; white-space: nowrap; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-sublink { padding: 6px 10px; border-radius: 7px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.nav-sublink:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-sublink.on { color: var(--text); font-weight: 600; background: var(--bg-soft); }
.tabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 9px 12px; font-size: 14px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.sidebar .bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar .bottom button { width: 100%; justify-content: flex-start; gap: 10px; background: none; color: var(--muted); border: 0; padding: 8px 10px; font-weight: 500; }
.sidebar .bottom button:hover { background: var(--bg-soft); color: var(--err); filter: none; }
.content { padding: 30px 32px 48px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.admin .content > h1:first-child, .admin .content > .flash + h1 { margin-bottom: 18px; }

.mbar, .scrim { display: none; }

@media (max-width: 900px) {
  .product-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "info" "desc" "panel"; grid-template-rows: auto; gap: 14px; }
  .order-panel { position: static; }
  .table-wrap table { min-width: 620px; }

  /* admin: top bar + slide-out menu */
  .shell { display: block; background: none; }
  .mbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 30; height: 56px;
    padding: 0 8px; padding-top: env(safe-area-inset-top); box-sizing: content-box;
    background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line);
  }
  .mbar-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--text); cursor: pointer; flex: none; }
  .mbar-btn:hover, .mbar-btn:active { background: var(--bg-soft); text-decoration: none; }
  .mbar-btn .ic { width: 20px; height: 20px; }
  .mbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; }
  .mbar-title:hover { text-decoration: none; }
  .mbar-title .logo { width: 26px; height: 26px; border-radius: 7px; }
  .mbar-title span:not(.logo) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(280px, 84vw); height: auto;
    padding: calc(16px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; overscroll-behavior: contain;
  }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }
  .nav-link { padding: 10px 10px; }
  .content { padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
  .admin .content > .page-head h1, .admin .content > h1:first-child { font-size: 20px; }
}
@media (max-width: 640px) {
  /* 16px stops iOS Safari from zooming into a focused field */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  .two { grid-template-columns: 1fr; }
  .wrap { padding-left: 14px; padding-right: 14px; }

  /* storefront */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card .body { padding: 10px 12px 12px; gap: 4px; }
  .product-card .title { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .product-card .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .product-card .meta { flex-direction: column; align-items: flex-start; gap: 4px; }
  .product-card .cover { aspect-ratio: 4 / 3; }
  .product-card .cover.ph { font-size: 24px; }
  .product-layout .info { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: start; }
  .info-text { gap: 6px; }
  .info-promise { display: none; }
  .product-layout .info .cover { margin: 0; aspect-ratio: 1; border-radius: var(--radius-sm); font-size: 28px; }
  .info-text h1 { font-size: 18px; }
  .info-price { font-size: 17px; }
  .buy-bar {
    position: sticky; bottom: 0; z-index: 5; margin: 0 -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
    flex-direction: row; align-items: center; gap: 12px;
  }
  .buy-bar .total-line { flex-direction: column; align-items: flex-start; gap: 0; padding: 0; border: 0; margin: 0; min-width: 0; }
  .buy-bar .total-line .muted { font-size: 12px; }
  .buy-bar .price.big { font-size: 20px; }
  .buy-bar button { flex: 1; width: auto; }
  .order-panel + p, .order-panel form > p.muted:last-child { font-size: 12px; }

  /* admin: two stats per row, tables as cards */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 19px; }
  .stat .stat-ic { width: 28px; height: 28px; right: 10px; top: 10px; border-radius: 8px; }
  .stat .stat-ic .ic { width: 15px; height: 15px; }
  .stat > .muted { font-size: 12px; padding-right: 30px; }
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt { min-width: 0 !important; }
  table.rt tr:has(> th) { display: none; }
  table.rt tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.rt tr:last-child { border-bottom: 0; }
  table.rt td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0 !important; border: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  table.rt td.empty-cell { padding: 28px !important; }
  table.rt td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; }
  table.rt td[data-label=""]::before { display: none; }
  table.rt td[data-label=""] { justify-content: flex-end; }
  table.rt td:first-child { justify-content: flex-start; text-align: left; font-weight: 600; padding-bottom: 6px !important; }
  table.rt td:first-child::before { display: none; }
  table.rt td[colspan] { justify-content: center; text-align: center; font-weight: 400; }
  table.rt tr:hover td { background: none; }
  table.rt .cv { min-width: 0; }
  table.rt td.blank { display: none; }
  .page-head .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg a { white-space: nowrap; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .theme-mock { height: 96px; padding: 8px; }
  table.rt td:first-child .cv { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  table.rt td:first-child br { display: none; }
  .filters > input:not([type=checkbox]), .filters > label:has(input:not([type=checkbox])) { flex: 1 1 100%; }
  .filters > input:not([type=checkbox]) { width: 100%; }
  .filters > select, .filters > label:has(select) { flex: 1 1 0; min-width: 0; }
  .filters > label > select { width: 100%; }
  .card.table-wrap:has(table.rt) { overflow: visible; }
  .fields .wide { grid-column: auto; }
  th, td { padding: 9px 10px; }
  h1 { font-size: 20px; }
  .hero { padding: 24px 18px; border-radius: 16px; }
  .hero h1 { font-size: 23px; }
  nav.main { gap: 2px; }
  nav.main a { padding: 7px 7px; gap: 4px; font-size: 13px; }
  .top .brand span:not(.logo) { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  .top .brand { min-width: 0; flex-shrink: 1; }
  nav.main { flex-shrink: 0; }
  nav.main a.admin-entry span { display: none; }
  .bar-row { grid-template-columns: 44px 1fr; }
  .bar-value { display: none; }
  .card { padding: 16px; }
  .card.table-wrap { padding: 4px 0; }
  .steps .step { flex-direction: column; gap: 4px; }
  .steps .step span.label { font-size: 11px; }
  .steps .step-line { margin-bottom: 18px; }
}

/* upgrade page */
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); margin: 0; font-weight: 500; }
.upd-hero { padding: 22px 24px; }
.upd-main { display: flex; gap: 16px; align-items: flex-start; }
.upd-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--bg-soft); color: var(--muted); }
.upd-icon .ic { width: 22px; height: 22px; }
.upd-hero.ok .upd-icon { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.upd-hero.new .upd-icon { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.upd-hero.err .upd-icon { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.upd-text { flex: 1; min-width: 0; }
.upd-text h2 { margin: 0 0 8px; font-size: 20px; }
.upd-versions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font-size: 13px; }
.chip.mono, .mono { font-family: var(--mono); }
.upd-versions .chip { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-soft); font-size: 12.5px; }
.upd-versions .chip.new { border-color: var(--accent); color: var(--accent); }
.upd-arrow { transform: rotate(180deg); width: 14px; height: 14px; color: var(--muted); }
.upd-note { margin: 8px 0 0; font-size: 13px; }
.err-text { color: var(--err); }
.setup-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); margin-bottom: 16px; }
.setup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.setup-list li:first-child { border-top: 0; padding-top: 0; }
.setup-list li > div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setup-list small { font-size: 12.5px; }
.setup-list .ic { flex: none; width: 18px; height: 18px; color: var(--warn); }
.setup-list li.done { opacity: .6; }
.setup-list li.done .ic { color: var(--ok); }
.setup-list li.done b { text-decoration: line-through; font-weight: 500; }
.btn.sm { padding: 5px 10px; font-size: 13px; min-height: 0; }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 5px 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 13px; }
a.plain { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.swatch { box-shadow: 0 0 0 1px var(--line-2); }
.theme-pending { font-size: 13px; color: var(--text-2); }
.product-list td { vertical-align: middle; }
.prod-cell { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.prod-cell:hover b { text-decoration: underline; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: var(--bg-soft); border: 1px solid var(--line); flex: none; }
.thumb.ph { display: grid; place-items: center; font-weight: 700; color: hsl(var(--h) 40% 35%); background: linear-gradient(135deg, hsl(var(--h) 70% 92%), hsl(calc(var(--h) + 40) 70% 85%)); }
.prod-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prod-text small { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; font-size: 13px; background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--line-2); min-height: 0; box-shadow: none; }
.toggle .knob { width: 18px; height: 18px; border-radius: 50%; background: var(--line-2); transition: background .15s; }
.toggle.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.toggle.on .knob { background: var(--ok); }
.list-actions a { font-size: 14px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.cat-picker { display: contents; }
.empty-guide { display: flex; gap: 14px; align-items: flex-start; }
.empty-guide > .ic { width: 28px; height: 28px; color: var(--muted); flex: none; }
.empty-guide p { margin: 4px 0 12px; font-size: 14px; }
.scope-pick summary { cursor: pointer; font-size: 14px; color: var(--text-2); }
.scope-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin-top: 10px; }
.export-box summary { cursor: pointer; }
.todo-card { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.todo-list li { display: flex; gap: 8px; align-items: flex-start; }
.todo-list .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.todo-block .ic { color: var(--err); }
.todo-warn .ic { color: var(--warn); }
.manual-card { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.ask-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ask-box .secret { font-size: 16px; font-weight: 600; }
.op-more summary { cursor: pointer; font-size: 14px; color: var(--text-2); }
.op-more form { margin-top: 10px; }
.op-danger { margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.op-danger h3 { margin: 0; font-size: 14px; color: var(--err); }
.op-danger p { margin: 0; font-size: 13px; }
details.op-danger { display: block; }
details.op-danger > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 40px; list-style: none; }
details.op-danger > summary::-webkit-details-marker { display: none; }
details.op-danger > summary::before { content: "›"; color: var(--err); font-size: 18px; line-height: 1; transition: transform .15s; }
details.op-danger[open] > summary::before { transform: rotate(90deg); }
details.op-danger > summary .muted { font-size: 12.5px; }
details.op-danger[open] > summary .muted { display: none; }
details.op-danger > :not(summary) { margin-top: 8px; }
.upd-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.upd-actions form { margin: 0; }
.upd-foot { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.upd-foot p { margin: 0 0 8px; }
.upd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.card-title { margin: 0 0 14px; font-size: 16px; }
.opt-row { align-items: flex-start; }
.opt-row > span { display: flex; flex-direction: column; gap: 2px; }
.opt-row small { font-size: 12.5px; font-weight: 400; }
.hour-row { display: flex; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.hour-row select { width: auto; min-width: 96px; }
.hour-row .muted { font-size: 12.5px; font-weight: 400; }
.last-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.last-row .muted { font-size: 13px; }
.log { margin-top: 12px; }
.log summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.log pre { margin-top: 8px; max-height: 320px; overflow: auto; }
@media (max-width: 760px) {
  .upd-grid { grid-template-columns: 1fr; }
  .upd-main { flex-wrap: wrap; }
  .upd-actions { width: 100%; justify-content: flex-start; padding-left: 60px; }
}
.upgrading { display: flex; gap: 14px; align-items: flex-start; }
.upgrading p { margin: 4px 0 0; font-size: 13px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.flash.info { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
.update-banner { text-decoration: none; align-items: center; }
.update-banner:hover { text-decoration: none; border-color: var(--line-2); }

/* sign-in with external accounts */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.sso { gap: 10px; }
.ic.sso-ic { width: 18px; height: 18px; }
.sso-list { display: flex; flex-direction: column; gap: 10px; }

/* headings follow the theme's heading font */
h1, h2, h3, .brand, .hero h1, .price.big { font-family: var(--font-head); }

/* theme picker (settings) */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; cursor: pointer; font-weight: 400; color: var(--text); position: relative; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-mock {
  display: flex; flex-direction: column; gap: 7px; padding: 10px; height: 112px; border-radius: 12px;
  background: var(--m-bg); border: 1px solid var(--line-2); transition: box-shadow .15s, border-color .15s;
}
.theme-card:hover .theme-mock { border-color: var(--text-2); }
.theme-card input:checked + .theme-mock { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.theme-card input:focus-visible + .theme-mock { outline: 2px solid var(--accent); outline-offset: 3px; }
.m-top { display: flex; align-items: center; gap: 6px; }
.m-logo { width: 16px; height: 16px; border-radius: 5px; background: var(--m-logo); --k-fg: var(--m-logo-fg); --k-leg: var(--m-leg); display: block; }
.m-logo svg { width: 100%; height: 100%; display: block; }
.m-title { font: 700 11px/1 var(--m-head); color: var(--m-text); }
.m-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 1; }
.m-card { background: var(--m-card); border: 1px solid var(--m-line); border-radius: calc(var(--m-r) * .5); padding: 5px; display: flex; flex-direction: column; gap: 4px; }
.m-card i { flex: 1; border-radius: calc(var(--m-r) * .3); background: var(--m-line); }
.m-card b { height: 4px; width: 60%; border-radius: 2px; background: var(--m-muted); opacity: .6; }
.m-btn { align-self: flex-start; font-size: 10px; font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: calc(var(--m-r) * .5); background: var(--m-accent); color: var(--m-at); }
.theme-name { display: flex; flex-direction: column; line-height: 1.35; }
.theme-name b { font-size: 14px; }
.theme-name .muted { font-size: 12px; }
.swatch.auto { background: conic-gradient(#18181b 0 25%, #4f46e5 0 50%, #059669 0 75%, #e11d48 0); }

@media (max-width: 379px) {
  nav.main a span { display: none; }
  nav.main a { padding: 8px 9px; }
}
@media (max-width: 359px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

/* inline row actions (admin accounts) */
.row-actions { display: inline-block; text-align: left; }
.row-actions > summary { list-style: none; color: var(--link); font-weight: 500; font-size: 14px; }
.row-actions > summary::-webkit-details-marker { display: none; }
.row-actions[open] > summary { margin-bottom: 10px; }
.row-actions-body { display: flex; flex-direction: column; gap: 16px; min-width: 240px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); }
.row-actions-body form.stack { gap: 10px; }
.cover-edit { display: flex; gap: 18px; align-items: flex-start; }
.cover-preview { position: relative; width: 160px; aspect-ratio: 4 / 3; flex: none; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 70% 92%), hsl(calc(var(--h) + 40) 70% 85%)); }
.cover-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cover-preview img[hidden] { display: none; }
.cover-preview:has(img:not([hidden])) { background: var(--bg-soft); }
.logo-preview { width: 96px; aspect-ratio: 1; background: var(--bg-soft); }
.logo-ph { width: 60px; height: 60px; border-radius: 14px; overflow: hidden; display: block; background: var(--logo-bg); --k-fg: var(--logo-fg); --k-leg: var(--logo-leg); }
.logo-ph[hidden] { display: none; }
.logo-ph svg { width: 100%; height: 100%; display: block; }
.cover-ph { font-size: 44px; font-weight: 700; color: hsl(var(--h) 40% 35%); }
.cover-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cover-actions > * { margin: 0; }
.cover-help { margin: 0; font-size: 13px; }
.file-btn { position: relative; cursor: pointer; display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
@media (max-width: 640px) { .cover-edit { flex-direction: column; } .cover-preview:not(.logo-preview) { width: 100%; max-width: 280px; } }
.md-editor { border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.md-editor:focus-within { border-color: var(--accent); }
.md-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--bg-soft); flex-wrap: wrap; }
.md-tools { display: flex; flex-wrap: wrap; gap: 2px; }
.md-tools button { background: transparent; border: 0; color: var(--text-2); padding: 5px 9px; font-size: 13px; font-weight: 500; border-radius: 7px; box-shadow: none; min-height: 0; display: inline-flex; align-items: center; gap: 4px; }
.md-tools button:hover { background: var(--card); color: var(--text); }
.md-tools .ic { width: 14px; height: 14px; }
.md-panes { display: grid; grid-template-columns: 1fr; }
.md-panes textarea { border: 0; border-radius: 0; min-height: 280px; resize: vertical; box-shadow: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; line-height: 1.7; }
.md-panes textarea:focus { outline: none; box-shadow: none; }
.md-preview { padding: 12px 14px; min-height: 280px; overflow: auto; }
.md-preview:empty::before { content: "预览会显示在这里"; color: var(--text-3, var(--text-2)); }
.md-editor[data-tab=edit] .md-preview { display: none; }
.md-editor[data-tab=preview] textarea { display: none; }
.md-editor.dragging { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.md-foot { padding: 6px 12px; border-top: 1px solid var(--line); font-size: 12px; background: var(--bg-soft); }
@media (min-width: 1100px) {
  .md-tabs { display: none; }
  .md-panes { grid-template-columns: 1fr 1fr; }
  .md-editor[data-tab] .md-preview, .md-editor[data-tab] textarea { display: block; }
  .md-preview { border-left: 1px solid var(--line); max-height: 560px; }
}
.md img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 4px 0; }
.md ol { padding-left: 22px; margin: 0 0 10px; }
.md blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--line-2); background: var(--bg-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Polaris SKU settings */
.pc { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pc-modes label { display: inline-flex; flex-direction: row; cursor: pointer; font-weight: 500; color: var(--text-2); }
.pc-modes input { position: absolute; opacity: 0; pointer-events: none; }
.pc-modes span { padding: 5px 12px; border-radius: 7px; font-size: 13px; }
.pc-modes input:checked + span { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.pc-modes input:focus-visible + span { outline: 2px solid var(--accent); }
.pc-pane { display: flex; flex-direction: column; gap: 14px; }
.pc-help { margin: 0; font-size: 13px; }
.pc-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ws-rows { display: flex; flex-direction: column; gap: 8px; }
.ws-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); font-size: 14px; }
.ws-row input { width: 96px; }
.pc details summary { cursor: pointer; color: var(--text-2); }
.pc details p { margin: 8px 0 0; }
.pc-tpl { align-items: flex-start; }
.pc-tpl input { margin-top: 3px; }
.pc-tpl-body { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pc-tpl-body b { font-size: 14px; }
.pc-chips { margin: -6px 0 0; align-items: center; }
.pc-chips .chip { font-size: 12px; padding: 4px 10px; }
.pc-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin-top: 10px; }
.pc-features input:disabled + * , .pc-features label:has(input:disabled) { opacity: .55; }
button.chip { background: var(--card); color: var(--text-2); border: 1px solid var(--line-2); font-weight: 500; }
button.chip:hover { background: var(--card); color: var(--text); }
.secret-input { display: flex; gap: 8px; }
.secret-input input { flex: 1; min-width: 0; }
.secret-input button { flex: none; }

/* long unbroken text (URLs, titles without spaces) wraps instead of widening the page */
.kv dd, .kv dt, .crumbs, .product-card h3, .page-head h1, .card h1, .card h2, table.detail td { overflow-wrap: anywhere; }
td { overflow-wrap: break-word; }
.md pre { white-space: pre-wrap; }

/* delivered net-disk shares, links and articles */
.rich { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 12px; background: var(--card); }
.rich-head { display: flex; gap: 12px; align-items: center; }
.rich-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rich-head b { font-size: 16px; }
.rich-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--bg-soft); }
.rich-url { overflow-wrap: anywhere; }
.rich-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.rich-actions > * { margin: 0; }
.rich-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 14px 0 0; font-size: 14px; align-items: center; }
.rich-kv dt { color: var(--muted); }
.rich-kv dd { margin: 0; display: flex; gap: 10px; align-items: center; min-width: 0; }
.rich-kv .secret { overflow-wrap: anywhere; min-width: 0; }
.rich-kv .code { font-size: 16px; font-weight: 700; letter-spacing: .08em; }
.rich-note { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14px; }
.rich.article { padding: 20px; font-size: 15px; line-height: 1.75; }
.rich.article img { max-width: 100%; border-radius: var(--radius-sm); }

/* Navigation, catalog feedback and compact dashboard setup. Theme tokens
   remain the single source of colors in all six themes. */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.content, .stat, .product-card, .product-card .body { min-width: 0; }
.stat b { overflow-wrap: anywhere; }
.product-card .title { overflow-wrap: anywhere; }
.sidebar-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.sidebar-head .brand { flex: 1; min-width: 0; padding: 4px 8px; }
.sidebar-head .brand > span:not(.logo) { overflow: hidden; text-overflow: ellipsis; }
.nav-close { display: none; }
.hero .search { padding-right: 4px; }
.hero .search input { flex: 1; min-width: 0; }
.search-clear { flex: none; padding: 0; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); }
.search-clear:hover { background: var(--bg-soft); color: var(--text); }
.hero .search-feedback { margin: 8px 0 0; font-size: 13px; }
[data-section] { scroll-margin-top: 84px; }
.setup-summary { display: flex; align-items: center; gap: 12px; min-height: 36px; cursor: pointer; list-style: none; }
.setup-summary::-webkit-details-marker { display: none; }
.setup-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.setup-heading .ic { color: var(--muted); }
.setup-heading b { font-size: 15px; font-weight: 600; }
.setup-progress { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.disclosure-arrow { width: 7px; height: 7px; flex: none; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin: -4px 3px 0 0; }
.setup-card[open] .disclosure-arrow { transform: rotate(225deg); margin-top: 4px; }
.setup-card[open] .setup-list { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  body.nav-open { overflow: hidden; }
  .mbar-btn { width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--text); }
  .nav-close { display: grid; }
  .sidebar { visibility: hidden; }
  .nav-toggle:checked ~ .sidebar { visibility: visible; }
}
@media (max-width: 640px) {
  .top .brand { flex: 1; }
  .top .brand > span:not(.logo) { max-width: none; }
  nav.main { gap: 2px; }
  nav.main a { width: 44px; height: 44px; padding: 0; justify-content: center; }
  nav.main a span { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding: 2px 2px 8px; scrollbar-width: thin; }
  .chip { flex: none; }
  .hero .search input { height: 44px; }
  .search-clear { width: 40px; height: 40px; }
  .setup-summary { gap: 8px; min-height: 40px; }
  .setup-heading { gap: 7px; }
  .setup-progress { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .scrim, .product-card { transition: none; }
  .product-card:hover { transform: none; }
}

/* Clear checkout boundaries and reachable save actions on long edit pages. */
.purchase-jump { display: none; }
#purchase { scroll-margin-top: 76px; }
.purchase-title { margin: 0 0 16px; }
.quantity-hint { margin: 6px 0 0; min-height: 20px; }
.checkout-feedback { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); padding: 10px 12px; font-size: 13px; }
.save-actions { position: sticky; bottom: 12px; z-index: 8; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.save-actions > button { margin-left: auto; min-width: 96px; }
.edit-status { color: var(--warn); font-size: 13px; }
.save-actions .theme-pending { flex-basis: 100%; font-size: 12px; }
.save-actions:has([data-theme-pending]:not([hidden])) [data-edit-status] { display: none; }
[data-edit-form] :is(input, textarea, select) { scroll-margin-bottom: 110px; }
@media (max-width: 900px) {
  .purchase-jump { display: inline-flex; align-self: flex-start; margin-top: 4px; }
}
@media (max-width: 640px) {
  .purchase-jump { font-size: 13px; padding: 8px 12px; }
  .save-actions { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* List filters share a clear field/action hierarchy and retain native controls. */
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 16px; margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar > label { flex: 1 1 140px; min-width: 0; }
.filter-bar > .filter-search { flex: 2 1 280px; }
.filter-bar input, .filter-bar select { width: 100%; min-width: 0; }
.filter-bar select { max-width: 100%; overflow: hidden; appearance: none; -webkit-appearance: none; padding-right: 34px; text-overflow: ellipsis; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.filter-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 40px; }
.filter-actions button { height: 40px; padding-top: 0; padding-bottom: 0; }
.filter-actions a { font-size: 13px; }
.filter-status { margin: 0; padding: 0; border: 0; min-width: 0; flex: 1 1 260px; }
.filter-status legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.seg-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 3px; height: 40px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.seg-picker label { display: block; position: relative; min-width: 0; cursor: pointer; }
.seg-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-picker span { display: flex; align-items: center; justify-content: center; height: 100%; border-radius: 5px; white-space: nowrap; color: var(--text-2); }
.seg-picker label:hover span { color: var(--text); }
.seg-picker input:checked + span { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.list-summary { margin: -4px 0 12px; }
.stock-summary { padding: 16px; }
.stock-context h2 { font-size: 14px; margin: 0 0 4px; }
.import-target { margin: 0; overflow-wrap: anywhere; }
.stock-context p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.stock-context > .muted { display: block; margin-top: 4px; font-size: 12px; }
.stock-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); gap: 12px; }
.stock-counts > div { min-width: 0; }
.stock-counts dt { font-size: 12px; color: var(--muted); }
.stock-counts dd { font-size: 22px; font-weight: 600; line-height: 1.4; margin: 2px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .filter-bar { padding: 12px; gap: 12px 10px; }
  .filter-bar > .filter-search, .filter-status { flex-basis: 100%; }
  .filter-bar > label { flex-basis: 120px; }
  .filter-bar input:not([type=radio]), .filter-bar select, .filter-actions, .filter-actions button, .seg-picker { min-height: 44px; }
  .filter-actions { flex: 1 1 100%; }
  .filter-actions button { flex: 1; }
  .stock-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (forced-colors: active) {
  .filter-bar select { max-width: 100%; overflow: hidden; appearance: auto; background-image: none; }
  .seg-picker input:checked + span { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ---------- utilities (replaces inline styles; single spacing scale) ---------- */
.m0 { margin: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }
/* small muted line directly under a card heading */
.sub-line { margin-top: -4px; font-size: 13px; }
/* small muted note below a block */
.note { margin: 12px 0 0; font-size: 13px; }
.note-indent { margin: 6px 0 0 24px; font-size: 13px; }
/* empty table row */
.empty-cell { text-align: center; padding: 28px; }
.ic.sm { width: 14px; height: 14px; }
input.w-70 { width: 70px; }
input.w-80 { width: 80px; }
input.w-90 { width: 90px; }
input.w-280 { max-width: 280px; }
.grow-wide { flex: 1; min-width: 220px; }
/* identity (brand icon + name) inside table cells */
.identity { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; margin-right: 10px; }
.inline-flex-sm { display: inline-flex; font-size: 12px; }
.card-narrow { max-width: 640px; }
.ta-sm { font-family: inherit; min-height: 60px; }
.ta-md { font-family: inherit; min-height: 80px; }
.ta-plain { font-family: inherit; font-size: 14px; }
.h3-tight { margin: 0 0 2px; font-size: 15px; }
.svg-sprite { position: absolute; }
.auth-card h1 { text-align: center; font-size: 19px; }

/* ---------- mobile checkout & touch targets ---------- */
/* Breadcrumb keeps "全部商品" on one line; the long current title truncates
   (the full title is the page heading right below). */
.crumbs { min-width: 0; }
.crumbs > a, .crumbs > span[aria-hidden] { flex: none; white-space: nowrap; }
.crumb-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { display: block; }
.field-hint { margin: 0; font-size: 12.5px; }
[aria-invalid="true"] { border-color: var(--err); }
.buy-summary { display: none; }
.copy-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.copy-inline { font-size: 13px; }
.delivery-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 6px; }
.order-results h2 { margin-bottom: 8px; }
.order-list { list-style: none; margin: 0; padding: 0; }
.order-list li + li { border-top: 1px solid var(--line); }
.order-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; color: var(--text); font-weight: 400; min-height: 56px; }
.order-link:hover { text-decoration: none; }
.order-link:hover b { text-decoration: underline; }
.order-link-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.order-link-main .mono { font-size: 12.5px; }
.order-link-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row-ops { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.row-ops form { margin: 0; }
button.link.danger-link, .danger-link { color: var(--err); }
.op-danger-link { margin-left: 8px; padding-left: 14px; border-left: 1px solid var(--line); }

@media (max-width: 900px) {
  /* The purchase bar stays on screen while the buyer reads the page; the
     native required-field check scrolls to whatever is still missing. */
  .buy-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0;
    padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: var(--card); border-top: 1px solid var(--line); border-radius: 0;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .06);
    display: flex; flex-direction: row; align-items: center; gap: 12px;
  }
  .buy-bar .total-line { flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 0; padding: 0; border: 0; margin: 0; min-width: 0; }
  .buy-bar .total-line .muted { font-size: 12px; }
  .buy-bar .price.big { font-size: 20px; line-height: 1.25; }
  .buy-bar .buy-summary:not(:empty) { display: block; max-width: 100%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buy-bar button { flex: 0 1 auto; width: auto; min-width: 140px; min-height: 48px; }
  body:has(.buy-bar) .foot { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  form[data-order] :is(input, select, textarea, summary, button) { scroll-margin-bottom: 112px; }
  /* app.js flags an open on-screen keyboard; the bar steps aside so it never
     covers the focused field, and returns as soon as the keyboard closes. */
  html[data-keyboard] .buy-bar { visibility: hidden; }
}
@media (max-width: 640px) {
  .chip { min-height: 40px; display: inline-flex; align-items: center; }
  details > summary:not(.setup-summary) { padding-block: 11px; }
  .secret-input button { min-width: 64px; }
  .copy-inline { min-height: 44px; padding: 0 4px; }
  .delivery-tools button { flex: 1 1 140px; min-height: 44px; }
  .secret-row button, .rich-actions > * { min-height: 44px; }
  /* Row actions and pagers in card-style tables are thumb-sized. */
  table.rt td:not(:first-child) a:not(.badge), table.rt button.link, .list-actions a, .pager a { min-height: 44px; display: inline-flex; align-items: center; }
  table.rt button.link { padding: 0 6px; }
  .pager { gap: 8px 20px; flex-wrap: wrap; }
  .row-ops { justify-content: flex-end; }
  .row-ops .extend-form { display: inline-flex; align-items: center; gap: 6px; }
  .row-ops .extend-form input[type=number] { height: 44px; }
  .op-danger-link { flex-basis: 100%; display: flex; justify-content: flex-end; margin: 4px 0 0; padding: 6px 0 0; border-left: 0; border-top: 1px dashed var(--line-2); }
}
.flash-tip { display: block; margin-top: 2px; font-size: 12.5px; opacity: .85; }
@media (max-width: 640px) {
  .btn.purchase-jump { min-height: 44px; height: auto; }
  button.link.desc-more { min-height: 44px; padding: 0 2px; }
  /* Card rows with a single destination: the whole card is the link. */
  table.rt tr.rt-link { position: relative; padding-right: 34px; }
  table.rt tr.rt-link a.rt-main::after { content: ""; position: absolute; inset: 0; }
  table.rt tr.rt-link::after { content: "›"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 22px; line-height: 1; pointer-events: none; }
  table.rt tr.rt-link:active { background: var(--line); }
  /* Secondary columns stay on desktop; the detail page shows them on phones. */
  table.rt td.rt-minor { display: none !important; }
  table.rt .rt-only { display: inline-flex; }
}
.rt-only { display: none; }
table.rt td:first-child .rt-only { margin-left: auto; font-weight: 500; }
.kv { align-items: baseline; }
/* Dashboard counters that lead somewhere: tap anywhere on the card. */
.stat.stat-link a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stat.stat-link:hover { border-color: var(--line-2); }
.stat.stat-link:active { background: var(--bg-soft); }
@media (max-width: 640px) {
  /* Tabs, row toggles and the Markdown toolbar: thumb-sized. */
  .seg a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; }
  button.toggle { min-height: 40px; }
  .md-tools button { min-height: 40px; padding: 0 11px; }
  .op-more > summary { min-height: 44px; display: flex; align-items: center; }
}
/* 「更多条件」 only exists on phones; desktop always shows every condition. */
.filter-more { display: none; }
@media (max-width: 640px) {
  .filter-more { display: inline-flex; align-items: center; justify-content: center; }
  .filter-bar.folded > .filter-extra { display: none; }
}

/* Product choice: purpose, delivery and price form a readable sequence. */
.product-card-description {
  margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.product-card-specs { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card-specs-label, .product-card-price-label { color: var(--muted); font-size: 11px; font-weight: 500; }
.product-card-price { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.35; }
.info-description { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.purchase-overview {
  display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-soft); overflow-wrap: anywhere;
}
.purchase-product { font-size: 14px; font-weight: 600; line-height: 1.4; }
.purchase-description { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.purchase-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.purchase-fact { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; }
.purchase-fact-label { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  .product-card .body { gap: 7px; }
  .product-card-description { font-size: 12px; }
  .product-card-specs { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .purchase-overview { padding: 12px; }
}

/* Admin: urgent work first, sales overview second. */
.dashboard-section { margin: 20px 0 26px; }
.dashboard-section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 12px; }
.dashboard-section-head h2 { margin: 0 0 2px; font-size: 18px; }
.dashboard-section-head p { margin: 0; }
.dashboard-section-head > a { white-space: nowrap; font-size: 13px; }
.priority-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.priority-stats .stat { border-top: 3px solid var(--accent); }
.priority-stats .stat.err { border-top-color: var(--err); }
.priority-stats .stat.warn { border-top-color: var(--warn); }
.sales-stats .stat { background: color-mix(in srgb, var(--card) 94%, var(--bg-soft)); }
.product-setup { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.product-setup-step {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
}
.product-setup-step.current { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.product-setup-step.done .product-setup-number { background: var(--ok-soft); color: var(--ok); }
.product-setup-step.upcoming { color: var(--muted); }
.product-setup-number { display: grid; place-items: center; flex: none; width: 25px; height: 25px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 13px; font-weight: 700; }
.product-setup-step.upcoming .product-setup-number { background: var(--bg-soft); color: var(--muted); }
.product-setup-step b, .product-setup-step small { display: block; overflow-wrap: anywhere; }
.product-setup-step b { font-size: 13px; line-height: 1.4; }
.product-setup-step small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.product-setup-hint { margin: 0 0 14px; color: var(--text-2); font-size: 13px; }
@media (max-width: 900px) {
  .priority-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dashboard-section-head { align-items: start; }
  .dashboard-section-head p { font-size: 12px; }
  .product-setup { grid-template-columns: 1fr; gap: 6px; }
  .product-setup-step { padding: 9px 12px; align-items: center; }
  .product-setup-step small { margin: 0; }
}

/* Settings categories replace duplicate sidebar and horizontal tab lists. */
.settings-desktop-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.settings-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.settings-group h2 { margin: 0 0 7px; padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.settings-group a { display: block; padding: 7px 9px; border-radius: 7px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.settings-group a:hover { background: var(--bg-soft); text-decoration: none; }
.settings-group a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.settings-mobile-nav { display: none; }
@media (max-width: 900px) {
  .settings-desktop-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .settings-desktop-nav { display: none; }
  .settings-mobile-nav { display: block; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
  .settings-mobile-nav > summary { padding: 12px 14px; min-height: 48px; color: var(--text); font-weight: 600; }
  .settings-mobile-nav[open] > summary { border-bottom: 1px solid var(--line); }
  .settings-mobile-nav nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 8px; }
  .settings-mobile-nav .settings-group { border: 0; padding: 6px; box-shadow: none; }
  .settings-mobile-nav .settings-group a { min-height: 40px; display: flex; align-items: center; }
}
