: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 {
  display: block; font-size: 1.05rem; letter-spacing: -0.02em; margin-bottom: 0.2rem;
}
.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: block; margin-bottom: 0.1rem; 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 helpers: separate from the input, sectioned online/offline */
.machine-help {
  margin-top: 0.85rem;
}
.machine-help-intro {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  font-family: var(--font);
}
.machine-help-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.machine-help-section + .machine-help-section {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.machine-help-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-family: var(--font);
}
.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 .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: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
}
.hint-cmd .curl {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  overflow-x: auto;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.hint-cmd .ghost {
  flex-shrink: 0;
  align-self: center;
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.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;
}
/* Dual-column only when both offline + online sections are shown */
@media (min-width: 720px) {
  .machine-help-panel:has(> .machine-help-section + .machine-help-section) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
    align-items: start;
  }
  .machine-help-panel:has(> .machine-help-section + .machine-help-section)
    .machine-help-section + .machine-help-section {
    padding-top: 0;
    border-top: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
  }
}

.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); }

/* —— 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.75rem; }
.cmd-item {
  border: 1px solid var(--border);
  background: #0a0c11;
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  transition: border-color .15s;
}
.cmd-item.primary {
  border-color: rgba(107,140,255,0.4);
  background: linear-gradient(180deg, rgba(107,140,255,0.08), #0a0c11 60%);
}
.cmd-item .cmd-label {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  margin-bottom: 0.45rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.cmd-item.primary .cmd-label { color: var(--accent); }
.cmd-item .cmd-body {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}
.cmd-item .cmd-label .ghost {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.cmd-item .cmd-actions { margin-top: 0.55rem; display: flex; gap: 0.45rem; }

.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; }

.advanced {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}
.advanced summary {
  cursor: pointer; color: var(--faint); font-size: 0.82rem;
  user-select: none;
}
.advanced summary:hover { color: var(--muted); }
.advanced[open] summary { margin-bottom: 0.65rem; color: var(--muted); }

.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-row-exhausted td { opacity: 0.92; }
.seat-row-invalid td { opacity: 0.78; }
