/* ============ tokens ============ */
:root {
  --bg: #07070c;
  --bg-2: #0b0b14;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f2f7;
  --muted: #8f8fa8;
  --dim: #61617a;
  --accent: #8b5cf6;
  --accent-2: #f0389b;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Hiragino Sans", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(139, 92, 246, 0.22), transparent 62%),
    radial-gradient(760px 480px at 96% 4%, rgba(240, 56, 155, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(34, 211, 238, 0.09), transparent 62%),
    linear-gradient(180deg, #08080f, #06060a 60%);
}

::selection { background: rgba(139, 92, 246, 0.4); }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
:focus-visible { outline: 2px solid rgba(139, 92, 246, 0.7); outline-offset: 2px; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }

/* ============ layout ============ */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 28px;
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(140deg, #8b5cf6, #f0389b);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px -8px rgba(139, 92, 246, 0.9);
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 14px; letter-spacing: 0.14em; font-weight: 650; }
.brand-text span { font-size: 10px; color: var(--dim); letter-spacing: 0.18em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; }
.nav a {
  padding: 7px 14px; border-radius: 10px; font-size: 13px; color: var(--muted);
  transition: all 0.16s ease; display: flex; align-items: center; gap: 7px;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.quota-chip {
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 13px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  min-width: 158px;
}
.quota-chip .qrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quota-chip b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.quota-chip small { font-size: 10.5px; color: var(--dim); }
.quota-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8b5cf6, #22d3ee); border-radius: 3px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
  background: linear-gradient(140deg, rgba(139, 92, 246, 0.9), rgba(34, 211, 238, 0.75));
  color: #0b0b12; border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-pop { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 232px;
  background: #111119; border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 50;
}
.user-menu.open { display: block; }
.user-menu .um-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu .um-head b { display: block; font-size: 12.5px; word-break: break-all; }
.user-menu .um-head span { font-size: 11px; color: var(--dim); }
.user-menu button {
  width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; color: var(--muted);
}
.user-menu button:hover { background: var(--surface); color: var(--text); }

.page { flex: 1; width: 100%; max-width: 1380px; margin: 0 auto; padding: 26px 28px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 620; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ============ cards ============ */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px -34px rgba(0, 0, 0, 0.9);
}
.card-pad { padding: 20px; }
.card-title { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.card-title .dot { width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(140deg, #8b5cf6, #f0389b); }
.card-title small { margin-left: auto; font-weight: 400; color: var(--dim); font-size: 11px; }

/* ============ studio grid ============ */
.studio { display: grid; grid-template-columns: minmax(340px, 0.86fr) minmax(0, 1.14fr); gap: 20px; align-items: start; }
@media (max-width: 1080px) { .studio { grid-template-columns: 1fr; } }

/* model picker */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.model-opt {
  position: relative; text-align: left; padding: 12px 13px; border-radius: 13px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02);
  transition: all 0.18s ease; overflow: hidden;
}
.model-opt:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.045); }
.model-opt.sel {
  border-color: rgba(139, 92, 246, 0.75);
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.18), rgba(240, 56, 155, 0.07));
  box-shadow: 0 10px 30px -18px rgba(139, 92, 246, 0.9);
}
.model-opt b { display: block; font-size: 13px; font-weight: 600; }
.model-opt span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.model-opt .tag {
  position: absolute; top: 9px; right: 9px; font-size: 9px; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 5px; background: rgba(139, 92, 246, 0.22);
  color: #cbb8ff; border: 1px solid rgba(139, 92, 246, 0.35);
}

/* prompt */
.label { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.02em; }
.label .count { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 10.5px; }
.label .count.over { color: var(--red); }

textarea.prompt {
  width: 100%; min-height: 132px; resize: vertical;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border);
  border-radius: 13px; padding: 13px 14px; font-size: 13.5px; line-height: 1.62;
  color: var(--text); transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
textarea.prompt::placeholder { color: #55556b; }
textarea.prompt:focus { outline: none; border-color: rgba(139, 92, 246, 0.6); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  font-size: 11px; color: var(--muted); padding: 4px 9px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.08); }

/* params */
.param-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }

.seg { display: flex; padding: 3px; gap: 3px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); border-radius: 11px; }
.seg button {
  flex: 1; padding: 7px 6px; border-radius: 8px; font-size: 12px; color: var(--muted);
  transition: all 0.15s ease; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.sel { background: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.8); }

.ratio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ratio-opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px 7px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02); transition: all 0.15s;
}
.ratio-opt:hover { border-color: var(--border-strong); }
.ratio-opt.sel { border-color: rgba(139, 92, 246, 0.7); background: rgba(139, 92, 246, 0.14); }
.ratio-opt .box { border: 1.5px solid var(--dim); border-radius: 2.5px; }
.ratio-opt.sel .box { border-color: #c4b5fd; }
.ratio-opt span { font-size: 9.5px; color: var(--muted); letter-spacing: 0.02em; }
.ratio-opt.sel span { color: #ddd6fe; }

.duration-wrap { display: flex; align-items: center; gap: 10px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, #8b5cf6 var(--p, 20%), rgba(255, 255, 255, 0.12) var(--p, 20%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 3px solid #8b5cf6; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); cursor: pointer;
}
.duration-val { min-width: 54px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #ddd6fe; }

.toggles { display: flex; flex-direction: column; gap: 9px; margin-top: 15px; }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 38px; height: 21px; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.toggle i {
  position: absolute; inset: 0; border-radius: 20px; background: rgba(255, 255, 255, 0.12);
  transition: 0.2s; pointer-events: none;
}
.toggle i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; transition: 0.2s; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.toggle input:checked + i { background: linear-gradient(120deg, #8b5cf6, #f0389b); }
.toggle input:checked + i::after { transform: translateX(17px); }
.toggle-row .t-label { font-size: 12.5px; }
.toggle-row .t-hint { font-size: 10.5px; color: var(--dim); margin-left: auto; }

.advanced { border-top: 1px dashed var(--border); margin-top: 16px; padding-top: 12px; }
.advanced summary { font-size: 11.5px; color: var(--muted); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "＋"; font-size: 11px; color: var(--dim); }
.advanced[open] summary::before { content: "−"; }
.advanced .inner { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input.txt, select.txt {
  width: 100%; padding: 8px 11px; border-radius: 10px; font-size: 12.5px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); color: var(--text);
}
input.txt:focus, select.txt:focus { outline: none; border-color: rgba(139, 92, 246, 0.6); }

.estimate {
  margin-top: 16px; padding: 12px 14px; border-radius: 13px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.estimate .est-l { font-size: 11px; color: var(--dim); }
.estimate .est-v { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.estimate .est-v small { font-size: 10.5px; color: var(--dim); font-weight: 400; margin-left: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; font-size: 13px; font-weight: 550;
  transition: all 0.16s ease; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary {
  width: 100%; margin-top: 12px; padding: 13px 18px; font-size: 13.5px;
  background: linear-gradient(120deg, #8b5cf6, #f0389b); color: #fff;
  box-shadow: 0 14px 34px -16px rgba(139, 92, 246, 0.95);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(0.3); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-sm { padding: 6px 11px; font-size: 11.5px; border-radius: 8px; }
.btn-danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.3); color: #fca5a5; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }

/* ============ stage / preview ============ */
.stage-card { overflow: hidden; }
.stage {
  position: relative; aspect-ratio: 16 / 9; background:
    radial-gradient(circle at 50% 40%, rgba(139, 92, 246, 0.12), transparent 62%), #05050a;
  display: grid; place-items: center; overflow: hidden;
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.stage-empty { text-align: center; padding: 30px; }
.stage-empty .ico {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 20px;
  background: linear-gradient(150deg, rgba(139, 92, 246, 0.22), rgba(240, 56, 155, 0.14));
  border: 1px solid rgba(139, 92, 246, 0.3); display: grid; place-items: center;
}
.stage-empty h3 { font-size: 15px; font-weight: 550; margin-bottom: 6px; }
.stage-empty p { font-size: 12px; color: var(--muted); max-width: 340px; margin: 0 auto; line-height: 1.65; }

.stage-status { text-align: center; padding: 26px; }
.orb { position: relative; width: 82px; height: 82px; margin: 0 auto 18px; }
.orb .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent; border-top-color: #a78bfa; border-right-color: rgba(240, 56, 155, 0.7);
  animation: spin 1.5s linear infinite;
}
.orb .ring:nth-child(2) { inset: 9px; border-top-color: rgba(34, 211, 238, 0.9); border-right-color: transparent; animation-duration: 2.4s; animation-direction: reverse; }
.orb .core {
  position: absolute; inset: 21px; border-radius: 50%;
  background: linear-gradient(140deg, #8b5cf6, #f0389b); opacity: 0.9;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.75; } 50% { transform: scale(1.1); opacity: 1; } }

.stage-status h3 { font-size: 15px; margin-bottom: 5px; }
.stage-status p { font-size: 12px; color: var(--muted); }
.stage-status .meta-line { margin-top: 12px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

.steps { display: flex; align-items: center; justify-content: center; gap: 0; margin-top: 20px; }
.step { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--dim); }
.step .b { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 10px; }
.step.done { color: var(--green); }
.step.now { color: #c4b5fd; }
.step.done .b { background: rgba(52, 211, 153, 0.15); }
.step.now .b { background: rgba(139, 92, 246, 0.2); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1); }
.step-line { width: 26px; height: 1px; background: var(--border); margin: 0 8px; }
.step-line.done { background: rgba(52, 211, 153, 0.5); }

.stage-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stage-foot .prompt-txt {
  flex: 1; min-width: 180px; font-size: 12px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; padding: 3px 8px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.1); }
.badge.run { color: #c4b5fd; border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.14); }
.badge.err { color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.1); }
.badge.warn { color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.1); }
.badge .pulse { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }

/* recent list */
.recent { margin-top: 20px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.recent-head h2 { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; }
.recent-head a { font-size: 11.5px; color: var(--dim); }
.recent-head a:hover { color: #c4b5fd; }
.recent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .recent-grid { grid-template-columns: 1fr; } }

.mini {
  text-align: left; border-radius: 13px; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface); transition: all 0.18s ease;
}
.mini:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.mini .thumb { aspect-ratio: 16 / 9; background: #0a0a12; position: relative; display: grid; place-items: center; overflow: hidden; }
.mini .thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini .thumb .ph { font-size: 10.5px; color: var(--dim); letter-spacing: 0.05em; }
.mini .thumb .badge { position: absolute; top: 7px; left: 7px; backdrop-filter: blur(8px); }
.mini .body { padding: 9px 11px; }
.mini .body p { font-size: 11.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #d4d4e2; }
.mini .body .m { font-size: 10px; color: var(--dim); margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }

/* ============ history table ============ */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar .grow { flex: 1; min-width: 180px; }
.search-box { position: relative; }
.search-box input { padding-left: 32px; }
.search-box::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--dim); font-size: 15px;
}

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-weight: 500; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
table.data tbody tr { transition: background 0.14s; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
table.data tr:last-child td { border-bottom: none; }
td .cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
td .t-thumb {
  width: 62px; height: 36px; border-radius: 6px; background: #0b0b13; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border);
}
td .t-thumb img { width: 100%; height: 100%; object-fit: cover; }
td .t-thumb span { font-size: 9px; color: var(--dim); }
td .t-prompt { font-size: 12px; color: #dcdce8; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
td .t-sub { font-size: 10.5px; color: var(--dim); margin-top: 2px; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--dim); }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 11.5px; color: var(--dim); }
.pager .btns { display: flex; gap: 6px; }

/* ============ modal ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 80; background: rgba(4, 4, 8, 0.82);
  backdrop-filter: blur(10px); display: grid; place-items: center; padding: 24px;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(920px, 100%); max-height: 90vh; overflow-y: auto; background: #0d0d15;
  border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: 0 40px 100px -30px #000;
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 14px; font-weight: 600; }
.modal-head .x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 17px; }
.modal-head .x:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: 20px; }
.modal .stage { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }

.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 640px) { .meta-grid { grid-template-columns: repeat(2, 1fr); } }
.meta-item { padding: 10px 12px; border-radius: 11px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); }
.meta-item span { display: block; font-size: 10px; color: var(--dim); letter-spacing: 0.05em; text-transform: uppercase; }
.meta-item b { display: block; font-size: 12.5px; margin-top: 3px; font-variant-numeric: tabular-nums; font-weight: 550; }

.prompt-block {
  margin-top: 14px; padding: 13px 15px; border-radius: 12px; background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border); font-size: 12.5px; line-height: 1.7; color: #d8d8e6; white-space: pre-wrap; word-break: break-word;
}
.modal-actions { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }

/* ============ admin ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  padding: 16px 18px; border-radius: 15px; border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
}
.stat span { font-size: 10.5px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; }
.stat b { display: block; font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat small { font-size: 10.5px; color: var(--dim); }
.stat.hl b { background: linear-gradient(120deg, #c4b5fd, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { padding: 9px 15px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.sel { color: #fff; border-bottom-color: var(--accent); }

.inline-q { display: flex; align-items: center; gap: 6px; }
.inline-q input { width: 110px; padding: 5px 8px; font-size: 11.5px; border-radius: 7px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); color: var(--text); }
.inline-q .num { font-size: 11.5px; }

.user-tag { display: inline-flex; align-items: center; gap: 7px; }
.user-tag .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; background: rgba(139, 92, 246, 0.25); color: #ddd6fe; }

/* ============ auth ============ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none !important; } }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 46px; border-right: 1px solid var(--border);
  background:
    radial-gradient(700px 480px at 20% 10%, rgba(139, 92, 246, 0.3), transparent 60%),
    radial-gradient(600px 420px at 80% 90%, rgba(240, 56, 155, 0.22), transparent 62%),
    #08080e;
}
.auth-art .grid-lines {
  position: absolute; inset: 0; opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 40% 40%, #000 20%, transparent 78%);
}
.auth-art .quote { position: relative; }
.auth-art .quote h2 { font-size: 30px; line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; max-width: 460px; }
.auth-art .quote h2 em { font-style: normal; background: linear-gradient(120deg, #c4b5fd, #f9a8d4, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art .quote p { color: var(--muted); font-size: 13px; margin-top: 14px; max-width: 400px; line-height: 1.7; }
.auth-art .feats { display: flex; flex-direction: column; gap: 10px; position: relative; margin-top: 34px; }
.auth-art .feat { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #c9c9d8; }
.auth-art .feat i { width: 22px; height: 22px; border-radius: 7px; background: rgba(139, 92, 246, 0.18); border: 1px solid rgba(139, 92, 246, 0.28); display: grid; place-items: center; font-size: 11px; font-style: normal; color: #c4b5fd; }
.auth-art .foot { font-size: 11px; color: var(--dim); position: relative; }

.auth-panel { display: grid; place-items: center; padding: 30px; }
.auth-card { width: min(392px, 100%); }
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); font-size: 12.5px; margin: 6px 0 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card .field label { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.auth-card input.txt { padding: 11px 13px; font-size: 13px; border-radius: 11px; }
.auth-card .btn-primary { margin-top: 6px; }
.auth-alert {
  display: none; padding: 10px 12px; border-radius: 10px; font-size: 12px;
  background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.28); color: #fca5a5;
}
.auth-alert.show { display: block; }
.auth-switch { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
.auth-switch a { color: #c4b5fd; }
.auth-note { margin-top: 18px; padding: 11px 13px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); font-size: 11px; color: var(--dim); line-height: 1.65; }

/* ============ empty / toast / misc ============ */
.empty { text-align: center; padding: 54px 24px; }
.empty .ico { font-size: 26px; opacity: 0.5; margin-bottom: 10px; }
.empty h3 { font-size: 14px; font-weight: 550; margin-bottom: 5px; }
.empty p { font-size: 12px; color: var(--muted); }

.toasts { position: fixed; right: 20px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 11px 15px; border-radius: 11px; font-size: 12.5px; max-width: 380px;
  background: #14141d; border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: slideIn 0.22s ease; display: flex; gap: 9px; align-items: flex-start;
}
.toast.err { border-color: rgba(248, 113, 113, 0.4); }
.toast.ok { border-color: rgba(52, 211, 153, 0.4); }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

.hint { font-size: 10.5px; color: var(--dim); margin-top: 5px; line-height: 1.5; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.right { margin-left: auto; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }
.hidden { display: none !important; }
