:root {
  --bg: #07080c;
  --bg-elevated: #10131a;
  --surface: #141821;
  --surface-2: #1a1f2a;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f4;
  --muted: #8b93a7;
  --accent: #5eead4;
  --accent-dim: #2dd4bf;
  --accent-soft: rgba(94, 234, 212, 0.12);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.1);
  --ok: #86efac;
  --ok-soft: rgba(134, 239, 172, 0.1);
  --warn: #fcd34d;
  --radius: 4px;
  --radius-sm: 2px;
  --shadow: none;
  --font: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.5 var(--font);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

.container {
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  border: 1px solid rgba(94, 234, 212, 0.28);
  color: #d8fff7;
}
.brand-text { display: grid; gap: 1px; min-width: 0; }
.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.nav-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.nav-link.active {
  color: #d8fff7;
  background: var(--accent-soft);
  border-color: rgba(94, 234, 212, 0.22);
}
.nav-link.ghost {
  border-color: var(--line);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  letter-spacing: -0.02em;
  font-weight: 700;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 52ch;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  margin-top: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}
.panel-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stack { display: grid; gap: 12px; }
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field.grow { flex: 1; min-width: 180px; }
.field label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.45);
}
.field input:disabled,
.field select:disabled,
.field button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover {
  background: #222836;
  border-color: var(--line-strong);
  color: var(--text);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-dim);
  border-color: transparent;
  color: #042f2e;
}
.btn-primary:hover {
  background: var(--accent);
  color: #042f2e;
}
.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.25);
  color: #fecdd3;
}
.btn-ghost {
  background: transparent;
}
.btn-sm {
  padding: 7px 10px;
  font-size: 0.85rem;
}

.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th {
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
table.data td {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}
table.data tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}
.key-cell {
  display: grid;
  gap: 4px;
}
.key-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.copy-key {
  cursor: pointer;
  color: var(--text);
}
.copy-key:hover { color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-ok {
  color: #bbf7d0;
  background: var(--ok-soft);
  border-color: rgba(134, 239, 172, 0.2);
}
.badge-muted {
  color: #c7d2fe;
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.22);
}
.badge-warn {
  color: #fde68a;
  background: rgba(252, 211, 77, 0.1);
  border-color: rgba(252, 211, 77, 0.22);
}
.badge-danger {
  color: #fecdd3;
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.22);
}

.flash {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.flash.error {
  border-color: rgba(251, 113, 133, 0.28);
  background: var(--danger-soft);
  color: #fecdd3;
}
.flash.success {
  border-color: rgba(134, 239, 172, 0.28);
  background: var(--ok-soft);
  color: #bbf7d0;
}

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(250, 204, 21, 0.28);
  background: rgba(250, 204, 21, 0.08);
  color: #fde68a;
}
.view-as-banner .brand-sub {
  display: block;
  margin-top: 2px;
  color: rgba(253, 230, 138, 0.72);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 360px at 50% 0%, rgba(94, 234, 212, 0.08), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.03em;
  color: var(--text);
}
.login-card p {
  margin: 8px 0 0;
  color: var(--muted);
}
.login-actions {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}
.login-actions .btn {
  width: 100%;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.credit-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}
.credit-inline input {
  width: 88px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  font: inherit;
}
.shop-edit-row td {
  background: var(--bg-elevated);
  border-top: none;
  padding-top: 8px;
  padding-bottom: 14px;
}
table.data tr.is-muted td {
  opacity: 0.55;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.site-footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.85rem;
}
.gen-batch {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  padding: 10px;
}
.gen-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.gen-batch-text {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: 0.82rem/1.45 var(--mono);
}
.empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell-header {
    flex-direction: column;
    align-items: stretch;
  }
  .nav { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
}
