:root {
  --bg: #0c0d10;
  --side: #101114;
  --card: #16181d;
  --ink: #f4f5f7;
  --muted: #9aa0ab;
  --line: #2a2d34;
  --orange: #ff7a18;
  --orange-deep: #f06500;
  --green: #3dcc7a;
  --gold: #e2b15a;
  --gold-bg: #3a2c14;
  --gold-line: #6d5224;
  --active: #4a3016;
  --good: #8ee0b0;
  --bad: #ffb4b4;
  --warn: #f0cb86;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.5 ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}
a { color: #ffb27a; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.92em; }
h1, h2, p { margin: 0; }
h2 { font-size: 1rem; font-weight: 650; }
button, input, textarea { font: inherit; color: inherit; }
svg { width: 1.05rem; height: 1.05rem; display: block; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  border-right: 1px solid #1c1e24;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.75rem 0.8rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0.15rem 0.55rem 1rem;
}
.mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.45rem;
  background: var(--orange);
  color: #fff;
  display: grid;
  place-items: center;
}
.mark svg { width: 0.95rem; height: 0.95rem; }
.side-nav, .side-foot { display: grid; gap: 0.15rem; }
.side-nav a, .side-foot a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #c5c8d0;
  text-decoration: none;
  border-radius: 0.6rem;
  padding: 0.48rem 0.7rem;
}
.side-nav a.active {
  background: var(--active);
  color: #fff;
}
.side-nav a:hover, .side-foot a:hover { color: #fff; }
.side-foot { margin-top: auto; padding-top: 0.8rem; border-top: 1px solid #23262d; }
.side-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding: 0.7rem 0.45rem 0.2rem;
}
.side-user div { min-width: 0; flex: 1; }
.side-user strong, .side-user span { display: block; }
.side-user strong {
  font-size: 0.78rem;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-user span { color: var(--muted); font-size: 0.75rem; }
.icon-btn {
  border: 0;
  background: transparent;
  color: #c5c8d0;
  cursor: pointer;
  padding: 0.25rem;
}
.main {
  position: relative;
  padding: 1.35rem 1.6rem 3rem;
  min-width: 0;
}
.credit-pill {
  position: absolute;
  top: 1.2rem;
  right: 1.6rem;
  border: 1px solid #3a3d46;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  color: #eceff4;
  font-size: 0.86rem;
  background: #14161b;
}
.billing-title {
  font-size: 1.15rem;
  font-weight: 650;
  min-height: 2rem;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  padding-right: 8rem;
}
.promo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #f3d7bf;
  background: #2a1c12;
  border: 1px solid #5a3b1d;
  border-radius: 0.7rem;
  padding: 0.62rem 0.85rem;
  margin-bottom: 0.85rem;
}
.promo-mark {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 122, 24, 0.18);
  flex: none;
}
.promo-read { margin-left: auto; color: #d7dbe3; white-space: nowrap; }
.billing-note { color: var(--muted); margin: 0 0 1.15rem; }

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; align-items: stretch; }
.plan {
  background: #12141a;
  border: 1px solid #2c3038;
  border-radius: 0.95rem;
  padding: 1.15rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 28rem;
}
.plan-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: flex-start; }
.plan-top h2 { font-size: 1.35rem; }
.plan-top p { color: var(--muted); margin-top: 0.15rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.badge {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  white-space: nowrap;
}
.plan-price { margin-top: 1.5rem; font-size: 2rem; font-weight: 750; letter-spacing: -0.03em; }
.plan-price span { font-size: 0.95rem; font-weight: 560; color: #d5d8e0; margin-right: 0.15rem; }
.plan-credits { color: var(--green); font-weight: 650; margin: 0.2rem 0 1.1rem; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: 0.55rem; color: #d7dbe3; }
.plan-features li { display: flex; gap: 0.45rem; align-items: flex-start; }
.plan-features svg { width: 1rem; height: 1rem; margin-top: 0.15rem; color: #b7bdc8; flex: none; }
.plan-btn {
  margin-top: auto;
  width: 100%;
  border-radius: 999px;
  min-height: 2.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 650;
}
.plan-btn svg { width: 0.9rem; height: 0.9rem; }
.plan-btn-solid { border: 0; background: linear-gradient(180deg, #ff8d34, var(--orange-deep)); color: #fff; }
.plan-btn-solid:hover { filter: brightness(1.05); }
.plan-btn-ghost { background: transparent; color: #eee; border: 1px solid #4a4e57; }
.plan-btn-ghost:hover { border-color: #8b909b; }

.pay-box, .card, .auth-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  padding: 1rem 1.05rem 1.1rem;
}
.pay-box { margin-top: 1.1rem; display: grid; gap: 0.8rem; }
.pay-method { max-width: 28rem; margin-bottom: 1rem; }
.history-card { margin-top: 1rem; }
.instructions { white-space: pre-wrap; font-family: inherit; margin: 0.6rem 0 0; color: #d7dbe3; }
.prose { display: grid; gap: 0.7rem; }
.prose h2 { margin-top: 0.4rem; }
.prefs { display: grid; gap: 0.75rem; margin: 0; }
.prefs div { display: grid; grid-template-columns: 9rem 1fr; gap: 0.6rem; }
.prefs dt { color: var(--muted); }
.prefs dd { margin: 0; }

.catalog-tools { display: grid; gap: 0.7rem; margin-bottom: 0.8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip, .ghost, .primary, .button, .plan-btn { }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: #d7dbe3;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
}
.chip.active { background: var(--active); border-color: #8a5a2b; color: #fff; }
.picked {
  border: 1px dashed #3a3e48;
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.9rem;
  color: #d7dbe3;
}
.model-group { margin-bottom: 1rem; }
.model-group h2 { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.model-list { display: grid; gap: 0.35rem; }
.model-row {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: #12141a;
  border: 1px solid #2c3038;
  border-radius: 0.7rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}
.model-row code { color: var(--ink); }
.model-row span { color: var(--muted); font-size: 0.8rem; }
.model-row.selected { border-color: var(--orange); }
.model-row:hover { border-color: #6a512f; }

.page-head, .card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1rem; padding-right: 8rem; }
.eyebrow { margin: 0 0 0.25rem; color: var(--orange); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.lead, .hint, .empty, .muted { color: var(--muted); }
.page-head h1 { font-size: 1.7rem; line-height: 1.2; }
.card, .auth-panel { margin-bottom: 1rem; }
.auth-panel { width: min(460px, 100%); }
.guest { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.guest-wrap { width: min(460px, 100%); }
.guest-brand { margin-bottom: 1rem; padding-left: 0; }
.stack, .inline { display: grid; gap: 0.8rem; }
.inline { grid-template-columns: 1fr auto; align-items: end; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0e1014;
  color: var(--ink);
  border-radius: 0.7rem;
  padding: 0.65rem 0.7rem;
}
textarea { resize: vertical; }
.primary, .button {
  background: linear-gradient(180deg, #ff8d34, var(--orange-deep));
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.flash { border-radius: 0.8rem; padding: 0.8rem 1rem; margin-bottom: 1rem; background: #171a20; border: 1px solid var(--line); }
.flash-ok { border-color: #215c3b; }
.flash-bad { border-color: #7a3030; }
.flash-warn { border-color: #6d5424; }
.secret { margin-top: 0.6rem; }
.banner { background: #2a1c12; border: 1px solid #5a3b1d; padding: 0.8rem 1rem; border-radius: 0.8rem; margin-bottom: 1rem; }
.banner.quiet { background: #171a20; border-color: var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.stats article { background: var(--card); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.9rem 1rem; }
.stats span { display: block; color: var(--muted); font-size: 0.85rem; }
.stats strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.pill { display: inline-block; border-radius: 999px; padding: 0.1rem 0.5rem; background: #242830; font-size: 0.85rem; }
.pill-approved { background: #163524; color: var(--good); }
.pill-rejected { background: #3a1c1c; color: var(--bad); }
.pill-pending { background: #3a2e16; color: var(--warn); }
.review { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.review input { min-width: 10rem; }
.pager { display: flex; gap: 1rem; align-items: center; }
.bare { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.narrow { width: min(480px, calc(100% - 2rem)); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .plans, .stats, .grid-2, .inline, .prefs div { grid-template-columns: 1fr; }
  .plan { min-height: 0; }
  .page-head { flex-direction: column; align-items: start; }
}
