:root {
  color-scheme: dark;
  --bg: #130d0b;
  --panel: rgba(255, 247, 237, .075);
  --panel-strong: rgba(255, 247, 237, .13);
  --text: #fff2df;
  --muted: #cbbca6;
  --line: rgba(255,255,255,.13);
  --brand: #f1b56b;
  --brand-2: #ffdf9e;
  --danger: #ff7c7c;
  --ok: #7cf0b6;
  --warn: #ffd36f;
  --shadow: 0 24px 80px rgba(0,0,0,.36);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #fff7ec;
  --panel: rgba(79, 50, 25, .07);
  --panel-strong: rgba(79, 50, 25, .12);
  --text: #241912;
  --muted: #715f4d;
  --line: rgba(60,30,10,.16);
  --brand: #b86d26;
  --brand-2: #3b2414;
  --shadow: 0 24px 80px rgba(92,56,22,.13);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 5%, rgba(241,181,107,.22), transparent 35%), var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.18);
  padding: 13px 14px;
  outline: none;
}
textarea { resize: vertical; line-height: 1.6; }
select[multiple] { min-height: 112px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
button, .link-button {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  background: var(--panel-strong);
  text-decoration: none;
  color: var(--text);
  transition: transform .14s ease, background .14s ease, opacity .14s ease;
}
button:hover, .link-button:hover { transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #231306; font-weight: 900; }
.danger { background: rgba(255,124,124,.15); color: var(--danger); border: 1px solid rgba(255,124,124,.25); }
.ghost { border: 1px solid var(--line); background: rgba(255,255,255,.05); }
.glass { border: 1px solid var(--line); background: linear-gradient(140deg, var(--panel-strong), var(--panel)); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.bg-orb { position: fixed; border-radius: 999px; filter: blur(50px); opacity: .35; pointer-events: none; z-index: -1; }
.orb-a { width: 360px; height: 360px; background: #a763ff; top: 8%; right: 12%; }
.orb-b { width: 300px; height: 300px; background: #f1b56b; bottom: 10%; left: 12%; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.gate-card { width: min(720px, 100%); padding: 44px; border-radius: 32px; }
.brand-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 24px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #231306; font-weight: 900; font-size: 34px; box-shadow: 0 16px 40px rgba(241,181,107,.25); }
.brand-mark.small { width: 44px; height: 44px; border-radius: 16px; font-size: 22px; }
.eyebrow { margin: 18px 0 6px; color: var(--brand); font-weight: 900; font-size: 12px; letter-spacing: .16em; }
.eyebrow.compact { margin: 0 0 4px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(34px, 7vw, 64px); letter-spacing: -.04em; }
h2 { font-size: clamp(26px, 3vw, 42px); letter-spacing: -.035em; }
h3 { font-size: 22px; }
.big-line { font-size: 16px; }
.muted { color: var(--muted); line-height: 1.75; }
.msg { min-height: 24px; color: var(--brand-2); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin-top: 10px; }
.tiny-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.tiny-grid span { border: 1px solid var(--line); border-radius: 16px; padding: 12px; color: var(--muted); font-size: 13px; }
.shell { display: grid; grid-template-columns: 286px 1fr; min-height: 100vh; gap: 22px; padding: 22px; }
.sidebar { position: sticky; top: 22px; height: calc(100vh - 44px); border-radius: 28px; padding: 18px; display: flex; flex-direction: column; }
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
nav { display: grid; gap: 8px; }
.nav { width: 100%; text-align: left; color: var(--muted); }
.nav.active { background: linear-gradient(135deg, rgba(241,181,107,.24), rgba(255,223,158,.08)); color: var(--text); border: 1px solid rgba(241,181,107,.35); }
.license-pill { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 20px; }
.license-pill span:first-child, #licenseStatusDot { width: 12px; height: 12px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 6px rgba(124,240,182,.12); flex: none; }
.license-pill small { display: block; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.admin-link { margin-top: 10px; color: var(--brand); font-size: 13px; text-decoration: none; }
.workspace { min-width: 0; display: grid; gap: 18px; align-content: start; }
.topbar { border-radius: 28px; padding: 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.top-actions, .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view { display: none; }
.view.active { display: grid; gap: 18px; }
.hero, .panel { border-radius: 28px; padding: 24px; }
.cards { display: grid; gap: 18px; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tool-card { display: grid; gap: 8px; text-align: left; padding: 20px; min-height: 132px; align-content: center; border: 1px solid var(--line); background: rgba(255,255,255,.06); }
.tool-card b { font-size: 18px; }
.tool-card span { color: var(--muted); line-height: 1.55; }
.form-grid { display: grid; gap: 14px; margin: 14px 0; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.five { grid-template-columns: 2fr 1.2fr .8fr .8fr .8fr; }
.checkbox-line { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 12px; }
.checkbox-line input { width: auto; }
.section-title { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 14px; }
.codebox { white-space: pre-wrap; overflow: auto; max-height: 360px; min-height: 90px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--brand-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; }
.codebox.tall { min-height: 260px; }
.logbox { min-height: 180px; max-height: 280px; }
.progress { height: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.18); border-radius: 999px; overflow: hidden; margin: 16px 0; }
.progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--ok)); transition: width .2s ease; }
.download-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.download-list a, .download-chip { display: inline-flex; align-items: center; gap: 8px; color: #231306; background: var(--brand-2); border-radius: 999px; padding: 9px 12px; text-decoration: none; font-weight: 800; font-size: 13px; }
.payload-box { margin-top: 12px; }
.clean-list { color: var(--muted); line-height: 1.9; padding-left: 18px; }
.image-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.image-card { border: 1px solid var(--line); border-radius: 20px; padding: 10px; background: rgba(255,255,255,.05); display: grid; gap: 10px; }
.image-card img { width: 100%; border-radius: 14px; object-fit: cover; aspect-ratio: 1 / 1; background: rgba(0,0,0,.18); }
.image-card a { color: var(--brand); text-decoration: none; font-weight: 800; }
.prompt-output { display: grid; gap: 14px; margin-top: 18px; }
.prompt-item { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: rgba(255,255,255,.05); }
.prompt-item pre { white-space: pre-wrap; color: var(--brand-2); border: 1px solid var(--line); padding: 12px; border-radius: 14px; overflow: auto; }
.admin-shell { width: min(1380px, calc(100vw - 36px)); margin: 18px auto 60px; display: grid; gap: 18px; }
.admin-top { align-items: end; }
.admin-title { font-size: clamp(28px, 4vw, 46px); }
.stats-grid { margin: 0; }
.stat { border-radius: 24px; padding: 20px; }
.stat b { display: block; font-size: 34px; color: var(--brand-2); }
.stat span { color: var(--muted); }
.quick-days { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.quick-days button { padding: 9px 12px; }
.wrap { flex-wrap: wrap; }
.list-tools { display: grid; grid-template-columns: 1.4fr .8fr auto; gap: 10px; align-items: end; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 880px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--brand-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
td { color: var(--muted); font-size: 13px; }
td code { color: var(--text); }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-actions button { padding: 7px 9px; border-radius: 10px; font-size: 12px; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; }
.badge.active { color: var(--ok); background: rgba(124,240,182,.12); }
.badge.disabled, .badge.expired { color: var(--danger); background: rgba(255,124,124,.12); }
.badge.pending { color: var(--warn); background: rgba(255,211,111,.12); }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cards.two, .cards.three, .cards.four, .form-grid.two, .form-grid.three, .form-grid.four, .form-grid.five { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 640px) {
  .gate-card, .panel, .hero { padding: 18px; border-radius: 22px; }
  .inline-form { grid-template-columns: 1fr; }
  .tiny-grid { grid-template-columns: 1fr; }
  .shell { padding: 12px; }
  .list-tools { grid-template-columns: 1fr; }
}
