:root {
  --bg: #07080b;
  --bg-elev: #0e1016;
  --bg-card: rgba(18, 20, 28, 0.78);
  --bg-card-solid: #12141c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #edf0f5;
  --muted: #9aa3b5;
  --faint: #636b7a;
  --accent: #6b8cff;
  --accent-2: #8b7cff;
  --accent-soft: rgba(107, 140, 255, 0.14);
  --danger: #ff6b7a;
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.12);
  --warn: #f0b429;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  --font: "Inter", "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 12% -8%, rgba(107, 140, 255, 0.16), transparent 55%),
    radial-gradient(800px 480px at 88% 0%, rgba(139, 124, 255, 0.1), transparent 50%),
    radial-gradient(600px 400px at 50% 100%, rgba(62, 207, 142, 0.04), transparent 45%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: #9bb4ff; }

.wrap {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}
.wrap.narrow { width: min(720px, calc(100% - 2rem)); }

/* —— Topbar —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark, .brand img {
  width: 32px; height: 32px; border-radius: 9px;
  display: block;
}
.brand-mark {
  background: linear-gradient(145deg, #6b8cff, #3a5bdb);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 6px 16px rgba(91,140,255,0.25);
}
.brand span.sub { color: var(--muted); font-weight: 500; font-size: 0.88rem; margin-left: 0.15rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.65rem; }

.locale {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.locale button {
  border: 0; background: transparent; color: var(--muted);
  padding: 0.35rem 0.75rem; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 0.85rem;
  transition: background .15s, color .15s;
}
.locale button.active {
  background: var(--accent-soft); color: var(--text);
}

/* —— Hero —— */
.hero {
  margin-bottom: 1.75rem;
  animation: fadeUp .55s var(--ease) both;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(107,140,255,0.25);
  border-radius: 999px; padding: 0.28rem 0.7rem; margin-bottom: 0.9rem;
}
.hero h1 {
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  letter-spacing: -0.04em;
  margin: 0 0 0.55rem;
  font-weight: 700;
  line-height: 1.15;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
  font-size: 1.02rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Catalog toolbar —— */
.catalog-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: center; margin-bottom: 1.25rem;
  animation: fadeUp .55s var(--ease) .05s both;
}
.search {
  flex: 1 1 240px;
  position: relative;
}
.search input {
  width: 100%;
  padding-left: 2.4rem !important;
}
.search svg {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--faint); pointer-events: none;
}
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  border-radius: 999px; padding: 0.4rem 0.85rem;
  font: inherit; font-size: 0.82rem; cursor: pointer;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  background: var(--accent-soft);
  border-color: rgba(107,140,255,0.4);
  color: var(--text);
}

/* —— Catalog grid —— */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
  animation: fadeUp .55s var(--ease) .1s both;
}
.soft-card {
  position: relative;
  display: flex; flex-direction: column; gap: 0.85rem;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.2rem;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
  overflow: hidden;
}
.soft-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(107,140,255,0.08), transparent 50%);
  opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.soft-card:hover {
  border-color: rgba(107,140,255,0.45);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  text-decoration: none; color: var(--text);
}
.soft-card:hover::before { opacity: 1; }
.soft-card.soon {
  cursor: default; opacity: 0.72;
}
.soft-card.soon:hover {
  transform: none; box-shadow: none;
  border-color: var(--border);
}
.soft-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
}
.soft-card .meta { flex: 1; }
.soft-card strong:not(.product-title) {
  display: block; font-size: 1.05rem; letter-spacing: -0.02em; margin-bottom: 0.2rem;
}
/* Catalog title + Mac os-tag: one baseline (specificity must beat .soft-card strong) */
.soft-card .product-title,
.product-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
  line-height: 1.2;
  max-width: 100%;
  min-width: 0;
}
.soft-card .product-title .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.os-tag {
  display: inline-flex; align-items: center;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem; border-radius: 999px;
  background: rgba(107,140,255,0.16);
  color: #9db4ff;
  border: 1px solid rgba(107,140,255,0.35);
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}
.product .os-tag { font-size: 0.62rem; padding: 0.14rem 0.4rem; flex-shrink: 0; }
.product-meta {
  display: flex; flex-direction: column; gap: 0.12rem; min-width: 0;
}
.product-title-row {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.45rem;
  line-height: 1.2;
}
.product-title-row strong {
  display: inline; margin-bottom: 0; font-size: 0.95rem;
}
.product .product-slug { color: var(--muted); font-size: 0.75rem; }

.soft-card small { color: var(--muted); font-size: 0.82rem; line-height: 1.4; display: block; }
.soft-card .badge {
  position: absolute; top: 0.85rem; right: 0.85rem;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem; border-radius: 999px;
}
.badge.live {
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid rgba(62,207,142,0.3);
}
.badge.soon {
  background: rgba(255,255,255,0.04); color: var(--faint);
  border: 1px solid var(--border);
}
.soft-card .cta {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; font-weight: 600; color: var(--accent);
  margin-top: 0.15rem;
}
.soft-card.soon .cta { color: var(--faint); }

.catalog-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* —— Cards / forms —— */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 1.4rem 1.45rem;
  animation: fadeUp .45s var(--ease) both;
}

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1fr 1.4fr; }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }

.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.product {
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  font: inherit;
  display: flex; align-items: center; gap: 0.7rem;
  transition: border-color .15s, background .15s, transform .15s;
}
.product img { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.product:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.product.active {
  border-color: rgba(107,140,255,0.55);
  background: var(--accent-soft);
}
.product strong { display: inline; margin-bottom: 0; font-size: 0.95rem; }
.product small { color: var(--muted); font-size: 0.75rem; }

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.9rem 0 0.35rem;
  font-weight: 500;
}
input, select, textarea {
  width: 100%;
  background: #0a0c11;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.9rem;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(107,140,255,0.6);
  box-shadow: 0 0 0 3px rgba(107,140,255,0.15);
}
.hint {
  font-size: 0.8rem;
  color: var(--faint);
  margin-top: 0.4rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  line-height: 1.55;
}
.hint a { color: var(--accent); }
.hint .hint-line { display: block; }

/* Machine-code block: numbered step flow (command → paste) */
.machine-block {
  margin-top: 0.15rem;
}
.machine-block > label {
  margin-top: 0.9rem;
}
.machine-panel {
  margin-top: 0.45rem;
  padding: 0.95rem 1rem 1.05rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.machine-block.has-error .machine-panel {
  border-color: rgba(255, 107, 122, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 0 0 3px rgba(255, 107, 122, 0.12);
}
.machine-help {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.machine-help-intro {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  font-family: var(--font);
}
.machine-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0.65rem;
  align-items: start;
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6b8cff, #5576f0);
  box-shadow: 0 0 0 3px var(--accent-soft);
  margin-top: 0.05rem;
  font-variant-numeric: tabular-nums;
}
.step-body { min-width: 0; }
.step-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin: 0.05rem 0 0.45rem;
}
.machine-help-note {
  margin: 0 0 0.5rem;
  font-size: 0.74rem;
  color: var(--faint);
  line-height: 1.45;
  font-family: var(--font);
}
.machine-help-section + .machine-help-section {
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.machine-help-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
  font-family: var(--font);
}
.machine-help-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}
.machine-help .hint-line {
  display: block;
  font-size: 0.78rem;
  color: var(--faint);
  font-family: var(--mono);
  line-height: 1.55;
  margin-top: 0.35rem;
  word-break: break-word;
}
.machine-help .hint-line a { color: var(--accent); }
.hint-cmd {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: start;
  margin: 0.15rem 0 0;
}
.hint-cmd .curl {
  min-width: 0;
  margin: 0;
  padding: 0.7rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  overflow-x: auto;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}
.machine-step-paste .step-title {
  margin-bottom: 0.4rem;
}
.machine-step-paste input {
  margin: 0;
}
input.is-invalid,
textarea.is-invalid {
  border-color: rgba(255, 107, 122, 0.7) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 122, 0.18) !important;
}
.field-error {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: #ffb3bb;
  line-height: 1.4;
}
.field-error[hidden] { display: none !important; }

/* Square icon copy control — used on machine helper + activate cmds */
.btn-icon {
  appearance: none;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(107, 140, 255, 0.45);
  color: var(--text);
}
.btn-icon:focus-visible {
  outline: none;
  border-color: rgba(107, 140, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(107, 140, 255, 0.2);
  color: var(--text);
}
.btn-icon:active { transform: scale(0.96); }
.btn-icon .icon { display: block; }
.btn-icon.copied {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(62, 207, 142, 0.4);
}
.btn-icon.copy-failed {
  color: var(--danger);
  background: rgba(255, 107, 122, 0.12);
  border-color: rgba(255, 107, 122, 0.4);
}
.hint-cmd .btn-icon {
  margin-top: 0.15rem;
}
.hint .curl {
  display: block;
  margin: 0.45rem 0;
  padding: 0.55rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  overflow-x: auto;
}

.actions {
  display: flex; flex-wrap: wrap; gap: 0.65rem;
  margin-top: 1.2rem; align-items: center;
}
button.primary, a.btn {
  appearance: none; border: 0;
  background: linear-gradient(135deg, #6b8cff, #5576f0);
  color: #fff;
  font: inherit; font-weight: 600;
  padding: 0.72rem 1.2rem; border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(91,140,255,0.28);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
button.primary:hover, a.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(91,140,255,0.35);
  filter: brightness(1.05);
  text-decoration: none; color: #fff;
}
button.primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
button.ghost, a.ghost {
  appearance: none;
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong);
  font: inherit; padding: 0.65rem 1rem; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.ghost:hover, a.ghost:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.22);
  text-decoration: none; color: var(--text);
}

.msg {
  margin-top: 1rem; padding: 0.8rem 0.95rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; display: none;
}
.msg.error { display: block; background: rgba(255,107,122,0.12); color: #ffb3bb; border: 1px solid rgba(255,107,122,0.25); }
.msg.ok { display: block; background: var(--ok-soft); color: #9aecc3; border: 1px solid rgba(62,207,142,0.25); }

/* —— Seat quota + multi-device list (?seat=) —— */
.seat-quota {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(107, 140, 255, 0.08);
  border: 1px solid rgba(107, 140, 255, 0.28);
  display: block;
}
.seat-quota .quota-main {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.45;
}
.seat-quota .quota-remain { display: none; }
.seat-quota.is-full {
  background: rgba(255, 107, 122, 0.08);
  border-color: rgba(255, 107, 122, 0.28);
}
.seat-quota.is-full .quota-main {
  color: #ffc2c8;
}
.seat-quota.is-empty {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.device-panel {
  margin-top: 1.15rem;
}
.device-panel-title {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.device-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.device-card {
  border: 1px solid var(--border);
  background: #0a0c11;
  border-radius: 14px;
  padding: 1rem 1.05rem;
  transition: border-color .15s, box-shadow .15s;
}
.device-card.is-highlight {
  border-color: rgba(107, 140, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(107, 140, 255, 0.22), 0 8px 24px rgba(0, 0, 0, 0.25);
  background: linear-gradient(180deg, rgba(107, 140, 255, 0.1), #0a0c11 55%);
}
.device-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.device-card-meta {
  min-width: 0;
  flex: 1;
}
.device-index {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.device-card.is-highlight .device-index {
  color: var(--accent);
}
.device-machine {
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  line-height: 1.45;
  color: var(--text);
}
.device-activated-at {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.device-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(62, 207, 142, 0.14);
  color: #9aecc3;
  border: 1px solid rgba(62, 207, 142, 0.3);
  white-space: nowrap;
}
.device-card .cmd-list {
  margin-top: 0.15rem;
}
.device-card .more-notes {
  margin-top: 0.85rem;
}
#generateSection.is-hidden {
  display: none;
}
#generateSection .machine-block {
  margin-top: 1rem;
}

/* —— Activate result (commands) —— */
.result { margin-top: 1.35rem; display: none; }
.result.show { display: block; animation: fadeUp .4s var(--ease) both; }
.result-head {
  display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem;
}
.result-head .check {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--ok-soft); border: 1px solid rgba(62,207,142,0.3);
  display: grid; place-items: center; color: var(--ok); font-size: 1.1rem;
}
.result h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.result .result-sub { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.88rem; }

.cmd-list { display: flex; flex-direction: column; gap: 0.85rem; }
.cmd-item {
  border: 1px solid rgba(107,140,255,0.4);
  background: linear-gradient(180deg, rgba(107,140,255,0.08), #0a0c11 60%);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  transition: border-color .15s;
}
/* primary class kept as no-op alias for older payloads — no visual distinction */
.cmd-item.primary { }
.cmd-item .cmd-label {
  display: flex; align-items: center; justify-content: space-between; gap: 0.65rem;
  font-size: 0.72rem; font-weight: 650; color: var(--accent);
  margin-bottom: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.cmd-item.primary .cmd-label { color: var(--accent); }
.cmd-body-wrap {
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.cmd-item .cmd-body {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}
.cmd-item .cmd-label .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.cmd-item .cmd-actions { margin-top: 0.55rem; display: flex; gap: 0.45rem; }

.cmd-label-text {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.cmd-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(107, 140, 255, 0.16);
  color: #9bb4ff;
  border: 1px solid rgba(107, 140, 255, 0.35);
  white-space: nowrap;
}
.cmd-seq, .note-seq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.95;
}
.note-seq {
  font-size: 0.9rem;
  margin-right: 0.25rem;
}
.cmd-tips {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cmd-tips li {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.cmd-tips li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  margin-bottom: 0.1rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  opacity: 0.85;
}

.more-notes {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.55rem 0.85rem 0.7rem;
}
.more-notes[hidden] { display: none !important; }
.more-notes-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.more-items {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.more-note {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.more-note-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.more-note-text strong { color: var(--text); font-weight: 700; }
.more-note-text .note-em { font-weight: 600; }
.more-note-text .note-em--accent { color: #9bb4ff; }
.more-note-text .note-em--violet { color: #b5a8ff; }
.more-note-text .note-em--warn { color: var(--warn); }
.more-note-text .note-em--danger { color: var(--danger); }
.more-note-text .note-em--ok { color: var(--ok); }

.more-note-text::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  margin-bottom: 0.1rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  opacity: 0.85;
}
.more-items .cmd-item.optional {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  margin: 0;
}
.more-items .cmd-item.optional .cmd-label {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
}
.more-items .cmd-badge {
  background: rgba(255, 184, 77, 0.14);
  color: #ffd08a;
  border-color: rgba(255, 184, 77, 0.35);
}

.keybox {
  background: #0a0b0f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  line-height: 1.45;
}
.steps { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.steps li { margin: 0.35rem 0; }

.footer {
  margin-top: 2.75rem; color: var(--faint); font-size: 0.8rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-top: 1.25rem; border-top: 1px solid var(--border);
}

/* —— Admin —— */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border); padding: 0.6rem 0.45rem; text-align: left;
}
.admin-table th { color: var(--muted); font-weight: 500; }
.mono { font-family: var(--mono); font-size: 0.8rem; }
.tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer; font: inherit;
  transition: all .15s;
}
.tabs button.active { background: var(--accent-soft); color: var(--text); border-color: transparent; }

.section-label {
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); margin: 1.5rem 0 0.75rem;
}

/* —— Admin seat status badges —— */
.seat-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.seat-badge.available {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(62,207,142,0.3);
}
.seat-badge.exhausted {
  background: rgba(255, 186, 73, 0.14);
  color: #ffc86b;
  border: 1px solid rgba(255, 186, 73, 0.35);
}
.seat-badge.invalid {
  background: rgba(255,107,122,0.14);
  color: #ffb3bb;
  border: 1px solid rgba(255,107,122,0.3);
}
.seat-badge.test {
  background: rgba(167, 139, 250, 0.16);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.4);
}
.seat-badge.formal {
  background: rgba(62, 207, 142, 0.1);
  color: #86efac;
  border: 1px solid rgba(62, 207, 142, 0.28);
}
.seat-row-exhausted td { opacity: 0.92; }
.seat-row-invalid td { opacity: 0.78; }
.seat-row-test td { background: rgba(167, 139, 250, 0.04); }
.seat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.65rem 0 0.35rem;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.35;
}
.check-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-2, #a78bfa);
  flex-shrink: 0;
}

/* —— Admin list toolbar + pager —— */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.55rem;
  align-items: center;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
}
.list-toolbar .list-search {
  flex: 1 1 180px;
  min-width: 140px;
}
.list-toolbar .list-search input,
.list-toolbar select,
.list-toolbar input[type="date"],
.list-toolbar input[type="text"],
.list-toolbar input[type="search"] {
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
}
.list-toolbar select,
.list-toolbar input[type="date"],
.list-toolbar input[type="text"] {
  flex: 0 1 auto;
  width: auto;
  min-width: 7.5rem;
  max-width: 12rem;
}
.list-toolbar input[type="date"] {
  min-width: 8.5rem;
  color-scheme: dark;
}
.list-toolbar .ghost {
  flex: 0 0 auto;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}
.list-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.list-pager-info {
  font-size: 0.8rem;
  color: var(--muted);
}
.list-pager-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.list-pager-controls .ghost {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}
.list-pager-controls .ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.list-page-size {
  width: auto !important;
  min-width: 5.5rem;
  margin: 0 !important;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
}
.list-pager-page {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 3.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* —— Admin product activate_result editor —— */
.product-editor label { margin-top: 0.65rem; }
.pe-editor-top {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.pe-dirty-badge {
  font-size: 0.72rem; font-weight: 650;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  background: rgba(255, 186, 73, 0.16);
  color: #ffc86b;
  border: 1px solid rgba(255, 186, 73, 0.4);
}
.pe-section {
  margin-top: 1.25rem;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.14);
}
.pe-section-title {
  font-size: 0.92rem; font-weight: 700;
  margin: 0 0 0.85rem; letter-spacing: -0.01em;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem;
}
.pe-section-hint {
  font-size: 0.75rem; font-weight: 500; color: var(--muted);
}
.pe-cmd {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.75rem;
  background: rgba(0,0,0,0.22);
}
.pe-cmd.primary {
  border-color: rgba(107,140,255,0.4);
  background: linear-gradient(180deg, rgba(107,140,255,0.08), rgba(0,0,0,0.22) 55%);
}
.pe-cmd-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.pe-cmd-spacer { flex: 1; min-width: 0.5rem; }
.pe-sort-label {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0 !important; font-size: 0.82rem; color: var(--muted);
  font-weight: 600;
}
.pe-sort {
  width: 4.2rem !important;
  margin: 0 !important;
  padding: 0.35rem 0.45rem !important;
  font-family: var(--mono);
  font-weight: 650;
  text-align: center;
}
.pe-check {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.85rem; color: var(--muted); margin: 0 !important;
}
.pe-place-label {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; color: var(--muted); margin: 0 !important;
  white-space: nowrap;
}
.pe-place-label select {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0a0c11;
  color: var(--text);
}
.pe-cmd.placement-more,
.pe-more-item.pe-cmd {
  border-style: dashed;
  border-color: rgba(255, 184, 77, 0.35);
}
.pe-more-item {
  margin-bottom: 0.75rem;
}
.pe-more-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.pe-kind-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.pe-kind-badge.note {
  background: rgba(107, 140, 255, 0.14);
  color: #9bb4ff;
  border: 1px solid rgba(107, 140, 255, 0.35);
}
.pe-kind-badge.cmd {
  background: rgba(255, 184, 77, 0.14);
  color: #ffd08a;
  border: 1px solid rgba(255, 184, 77, 0.35);
}
.pe-note-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.pe-note-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.2rem 0 0.45rem;
}
.pe-em-btn {
  font-weight: 800;
  font-style: normal;
  min-width: 2rem;
  padding: 0.22rem 0.5rem !important;
  line-height: 1.2;
}
.pe-em-sep {
  width: 1px;
  height: 1rem;
  background: var(--border-strong);
  margin: 0 0.15rem;
}
.pe-swatch {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  padding: 0;
  cursor: pointer;
  background: var(--muted);
}
.pe-swatch:hover { transform: scale(1.08); }
.pe-swatch--none {
  background:
    linear-gradient(135deg, transparent 46%, var(--danger) 46%, var(--danger) 54%, transparent 54%),
    rgba(255,255,255,0.08);
}
.pe-swatch--accent { background: #6b8cff; }
.pe-swatch--violet { background: #8b7cff; }
.pe-swatch--warn { background: var(--warn); }
.pe-swatch--danger { background: var(--danger); }
.pe-swatch--ok { background: var(--ok); }
.pe-note-locale textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.88rem;
  background: #0a0c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
  min-height: 2.6rem;
  line-height: 1.45;
}
.pe-note-live {
  margin: 0.4rem 0 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  min-height: 1.5rem;
}
.pe-note-live[hidden] { display: none !important; }
.pe-note-live strong { color: var(--text); font-weight: 700; }
.pe-note-live .note-em { font-weight: 600; }
.pe-note-live .note-em--accent { color: #9bb4ff; }
.pe-note-live .note-em--violet { color: #b5a8ff; }
.pe-note-live .note-em--warn { color: var(--warn); }
.pe-note-live .note-em--danger { color: var(--danger); }
.pe-note-live .note-em--ok { color: var(--ok); }

.pe-more-item.pe-note {
  display: block;
  padding: 0.85rem 1rem 1rem;
}
.pe-icon-btn {
  padding: 0.3rem 0.55rem !important;
  min-width: 2rem;
}
.pe-danger { color: #ffb3bb !important; }
.pe-field-hint {
  margin: 0.35rem 0 0; font-size: 0.72rem; color: var(--muted);
}
.pe-cmd textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: #0a0c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
}
.pe-cmd-meta { margin-top: 0.15rem; }
.pe-tip {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
  align-items: center;
}
.pe-note {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
}
.pe-sticky-actions {
  position: sticky; bottom: 0;
  margin-top: 1.25rem;
  padding: 0.85rem 0 0.25rem;
  background: linear-gradient(180deg, transparent, var(--bg, #0b0d12) 28%);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem;
}
.pe-sticky-actions .msg { margin: 0; flex: 1 1 12rem; }
@media (max-width: 720px) {
  .pe-tip, .pe-note-fields { grid-template-columns: 1fr; }
}


/* —— Admin multi-page nav (anchors) —— */
.tabs.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
}
.tabs.admin-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.tabs.admin-nav a:hover {
  color: var(--text);
  border-color: rgba(107,140,255,0.35);
}
.tabs.admin-nav a.active {
  color: var(--text);
  background: rgba(107,140,255,0.16);
  border-color: rgba(107,140,255,0.45);
}
.admin-table a.ghost {
  display: inline-flex;
  text-decoration: none;
  padding: 0.3rem 0.65rem;
}

/* —— Activate-result dedicated page —— */
.ar-page .ar-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ar-hint { margin: 0.65rem 0 1rem; }
.ar-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.ar-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  cursor: pointer;
}
.ar-tab:hover { color: var(--text); }
.ar-tab.active {
  color: var(--text);
  background: rgba(107,140,255,0.16);
  border-color: rgba(107,140,255,0.45);
}
.ar-panel { margin-bottom: 0.5rem; }

.pe-locale-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.1rem;
}
.pe-locale-block {
  padding: 0.85rem 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.16);
}
.pe-locale-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.pe-locale-block label { margin-top: 0.55rem; }

/* Compact sortable rows */
.pe-compact-list { display: flex; flex-direction: column; gap: 0.55rem; }
.pe-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  overflow: hidden;
}
.pe-row.is-primary {
  border-color: rgba(107,140,255,0.4);
  background: linear-gradient(180deg, rgba(107,140,255,0.08), rgba(0,0,0,0.22) 70%);
}
.pe-row.pe-note-row { border-style: solid; }
.pe-row.pe-cmd-row[data-list="more"] {
  border-style: dashed;
  border-color: rgba(255, 184, 77, 0.35);
}
.pe-row.dragging {
  opacity: 0.55;
  border-color: rgba(107,140,255,0.55);
}
.pe-row.drag-over {
  box-shadow: 0 0 0 1px rgba(107,140,255,0.45);
}
.pe-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  user-select: none;
}
.pe-drag-handle {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  cursor: grab;
  letter-spacing: -0.05em;
}
.pe-drag-handle:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}
.pe-drag-handle:active { cursor: grabbing; }
.pe-preview-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 1.6rem;
  text-align: center;
  color: #9bb4ff;
}
.pe-preview-main {
  flex: 1 1 10rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.pe-preview-title {
  font-weight: 650;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.pe-preview-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--muted);
}
.pe-preview-badge.primary-badge {
  background: rgba(107,140,255,0.16);
  border-color: rgba(107,140,255,0.4);
  color: #9bb4ff;
}
.pe-sort-compact {
  width: 3.4rem !important;
  margin: 0 !important;
  padding: 0.3rem 0.35rem !important;
  font-size: 0.8rem !important;
}
.pe-editor {
  padding: 0 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
}
.pe-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0 0.35rem;
}
.pe-field-group { margin-top: 0.65rem; }
.pe-template-group textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: #0a0c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
}
.pe-tips-group {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,0.12);
}
.pe-sticky-actions a.ghost {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  padding: 0.45rem 0.85rem;
}

@media (max-width: 720px) {
  .pe-locale-grid { grid-template-columns: 1fr; }
  .pe-compact { gap: 0.35rem; }
  .pe-preview-title { white-space: normal; }
}

/* —— Optional Typora email (credential display only) —— */
.email-field { margin-top: 0.15rem; }
.email-field .opt-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  vertical-align: middle;
}
.field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--faint);
  line-height: 1.45;
  font-family: var(--font);
}



.product-row-off td { opacity: 0.72; }
.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.pe-basic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.pe-basic-grid textarea,
#panel-basic textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.88rem;
  background: #0a0c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
  line-height: 1.45;
}
.pe-enabled-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  font-weight: 600;
}
@media (max-width: 720px) {
  .pe-basic-grid { grid-template-columns: 1fr; }
}

/* —— Product shelf switch (状态列) —— */
.product-status-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.product-row-off .product-status-cell {
  opacity: 1; /* keep switch readable on dimmed off rows */
}
.product-shelf-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.28rem 0.55rem 0.28rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.product-shelf-switch:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}
.product-shelf-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.product-shelf-switch:disabled,
.product-shelf-switch.is-loading {
  cursor: wait;
  opacity: 0.72;
}
.product-shelf-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(154, 163, 181, 0.28);
  border: 1px solid rgba(154, 163, 181, 0.35);
  flex-shrink: 0;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.product-shelf-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e8ecf4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.product-shelf-switch.is-on {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(62, 207, 142, 0.35);
}
.product-shelf-switch.is-on:hover:not(:disabled) {
  background: rgba(62, 207, 142, 0.18);
  border-color: rgba(62, 207, 142, 0.5);
}
.product-shelf-switch.is-on .product-shelf-track {
  background: rgba(62, 207, 142, 0.55);
  border-color: rgba(62, 207, 142, 0.65);
}
.product-shelf-switch.is-on .product-shelf-thumb {
  transform: translateX(14px);
  background: #fff;
}
.product-shelf-switch.is-off {
  color: #ffb3bb;
  background: rgba(255, 107, 122, 0.1);
  border-color: rgba(255, 107, 122, 0.28);
}
.product-shelf-switch.is-off:hover:not(:disabled) {
  background: rgba(255, 107, 122, 0.16);
  border-color: rgba(255, 107, 122, 0.42);
}
.product-shelf-switch.is-loading .product-shelf-thumb {
  animation: shelf-pulse 0.7s ease-in-out infinite;
}
@keyframes shelf-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.product-shelf-label {
  min-width: 2em;
  text-align: left;
}

/* —— Admin toast —— */
.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 1000;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  background: #1a1d27;
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.admin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.admin-toast.is-ok {
  border-color: rgba(62, 207, 142, 0.4);
  color: var(--ok);
}
.admin-toast.is-err {
  border-color: rgba(255, 107, 122, 0.45);
  color: #ffb3bb;
}

/* —— Admin dashboard —— */
.dash-wrap { width: min(1180px, calc(100% - 2rem)); }
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.15rem;
}
.dash-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.dash-sub { margin: 0.35rem 0 0; max-width: 48rem; }
.dash-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.dash-range {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.dash-range select {
  margin: 0;
  min-width: 7.5rem;
  padding: 0.4rem 0.65rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.kpi-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.95rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.85;
}
.kpi-card.tone-ok::before { background: var(--ok); }
.kpi-card.tone-accent::before { background: var(--accent); }
.kpi-card.tone-accent2::before { background: var(--accent-2); }
.kpi-card.tone-warn::before { background: var(--warn); }
.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.kpi-value {
  margin-top: 0.35rem;
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi-value.sm { font-size: 1.35rem; }
.kpi-sub {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--faint);
}

.dash-section {
  margin-bottom: 0.85rem;
}
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.2rem;
}
.dash-section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prod-stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.55rem;
}
.prod-stock-card {
  --prod-accent: var(--ok);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 0.95rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.prod-stock-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--prod-accent);
}
.prod-stock-card.is-low {
  border-color: rgba(240, 180, 41, 0.35);
  box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.12), var(--shadow);
}
.prod-stock-card.is-off { opacity: 0.72; }
.psc-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.psc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}
.psc-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  min-width: 0;
  flex: 1;
}
.psc-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--prod-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--prod-accent) 22%, transparent);
}
.psc-name strong {
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}
.psc-slug {
  font-size: 0.75rem;
  color: var(--faint);
  font-family: var(--mono);
}
.psc-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.psc-badge.low {
  color: var(--warn);
  background: rgba(240, 180, 41, 0.12);
  border-color: rgba(240, 180, 41, 0.28);
}
.psc-badge.off {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.psc-badge.test {
  background: rgba(167, 139, 250, 0.16);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.35);
}
.psc-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
.psc-m { min-width: 0; }
.psc-v {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.psc-v small {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--faint);
  letter-spacing: 0;
}
.psc-bar {
  display: flex;
  height: 6px;
  margin-top: 0.85rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.psc-seg { display: block; height: 100%; min-width: 0; }
.psc-seg.avail { background: var(--ok); }
.psc-seg.issued { background: var(--accent-2); }
.psc-seg.other { background: rgba(255, 255, 255, 0.14); }

.dist-block { margin-top: 0.35rem; }
.dist-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}
.dist-total {
  margin-top: 0.2rem;
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.dist-total.sm { font-size: 1.25rem; }
.dist-hbars {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.dist-hbar { min-width: 0; }
.dist-hbar-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  margin-bottom: 0.28rem;
}
.dist-hbar-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}
.dist-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.dist-nums {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  color: var(--text);
  flex-shrink: 0;
}
.dist-nums strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.dist-pct { color: var(--muted); font-size: 0.78rem; }
.dist-today { color: var(--faint); font-size: 0.75rem; }
.dist-hbar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.dist-hbar-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  transition: width .25s var(--ease);
}
/* kept for 访问→发码 TOP rows */
.dist-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.dash-charts-secondary { opacity: 0.98; }
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.dash-chart-card { min-width: 0; }
.dash-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}
.dash-chart-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.dash-caption { margin: 0 0 0.85rem; font-size: 0.78rem; }
.dash-link {
  font-size: 0.8rem !important;
  padding: 0.25rem 0.55rem !important;
}
.dash-legend {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.dash-legend .lg {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.dash-legend .lg.uv { background: #6b8cff; }
.dash-legend .lg.pv { background: #8b7cff; }
.dash-legend .lg.act { background: #3ecf8e; }

.bar-chart { min-height: 140px; }
.bar-track {
  display: flex;
  align-items: flex-end;
  gap: 0.28rem;
  height: 140px;
  padding: 0.25rem 0 0;
}
.bar-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 0.35rem;
}
.bar-stack {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: calc(100% - 1.1rem);
}
.bar {
  display: block;
  width: 42%;
  max-width: 12px;
  min-height: 2px;
  border-radius: 3px 3px 1px 1px;
  background: var(--accent);
  opacity: 0.92;
  transition: height .25s var(--ease);
}
.bar-stack.stacked-col {
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 0;
  justify-content: flex-start;
  width: 70%;
  max-width: 18px;
  min-height: 2px;
}
.bar.stacked {
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  min-height: 0;
  height: auto !important;
}
.bar-stack.stacked-col > .bar.stacked:first-child { border-radius: 0 0 2px 2px; }
.bar-stack.stacked-col > .bar.stacked:last-child { border-radius: 3px 3px 0 0; }
.bar.stacked.empty {
  background: rgba(255, 255, 255, 0.06);
  opacity: 0.5;
  border-radius: 2px;
}
.bar.uv { background: linear-gradient(180deg, #8eabff, #6b8cff); }
.bar.pv { background: linear-gradient(180deg, #a99cff, #8b7cff); width: 38%; }
.bar.act { background: linear-gradient(180deg, #5ee0a8, #3ecf8e); width: 55%; max-width: 14px; }
.bar-label {
  font-size: 0.62rem;
  color: var(--faint);
  white-space: nowrap;
  transform: scale(0.95);
}

.script-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.55rem;
}
.script-kpi {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
}
.stock-warn { color: var(--warn); font-weight: 700; }
.prod-cell { letter-spacing: -0.01em; }


.psc-metrics-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.psc-metrics-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-alert {
  margin: 0 0 0.85rem;
  border: 1px solid rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-alert-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
}
.dash-alert-inner strong {
  color: var(--warn);
  font-weight: 700;
}
.dash-alert-inner em {
  font-style: normal;
  font-weight: 750;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.dash-alert-inner .dash-link { margin-left: auto; }

.conv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.35rem;
}
.conv-cell {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}
.conv-top { margin-top: 0.95rem; }
.conv-top-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.conv-top-row {
  display: grid;
  grid-template-columns: 0.55rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
}
.conv-top-row strong { font-variant-numeric: tabular-nums; }

.dash-metric-notes {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.dash-metric-notes li { margin-bottom: 0.4rem; }
.dash-metric-notes strong { color: var(--text); }
.dash-metric-notes code {
  font-family: var(--mono);
  font-size: 0.78em;
  color: var(--faint);
}

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-charts, .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpi-row { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.55rem; }
  .bar-label { font-size: 0.55rem; }
  .psc-metrics, .psc-metrics-3, .psc-metrics-4 { grid-template-columns: 1fr 1fr; }
  .conv-grid { grid-template-columns: 1fr 1fr; }
  .dist-hbar-meta { flex-wrap: wrap; }
  .dist-nums { margin-left: auto; }
  .dash-alert-inner .dash-link { margin-left: 0; }
}
