/* =====================================================================
   VOXFIELD — app styles (studios, account, admin)
   Tokens continue the original Voice Studio palette (indigo → violet).
   ===================================================================== */
:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #fbfbfe; --surface-3: #f1f2f8;
  --ink: #1b1e2b; --ink-2: #565c72; --ink-3: #8a90a6;
  --line: #ebecf4; --line-2: #dcdeec;
  --accent: #5b63f0; --accent-2: #8b5cf6; --accent-ink: #ffffff;
  --accent-soft: rgba(91, 99, 240, .10); --accent-ring: rgba(91, 99, 240, .25);
  --ok: #12a26b; --ok-soft: rgba(18, 162, 107, .12);
  --warn: #c98a04; --warn-soft: rgba(245, 158, 11, .14);
  --bad: #dc3d4b; --bad-soft: rgba(220, 61, 75, .11);
  --info: #2f7de1; --info-soft: rgba(47, 125, 225, .11);
  --buy-a: #f59e0b; --buy-b: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(24, 28, 50, .05), 0 1px 3px rgba(24, 28, 50, .05);
  --shadow-md: 0 8px 22px rgba(24, 28, 50, .07), 0 2px 6px rgba(24, 28, 50, .04);
  --shadow-lg: 0 24px 50px rgba(91, 99, 240, .14), 0 8px 22px rgba(24, 28, 50, .07);
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f17; --surface: #151824; --surface-2: #191c2a; --surface-3: #1f2333;
    --ink: #e9ebf5; --ink-2: #a6abc2; --ink-3: #737992;
    --line: #242839; --line-2: #2f3449;
    --accent: #7c83ff; --accent-2: #a78bfa; --accent-soft: rgba(124, 131, 255, .14); --accent-ring: rgba(124, 131, 255, .3);
    --ok: #35c98d; --ok-soft: rgba(53, 201, 141, .14); --warn: #f2b33d; --warn-soft: rgba(242, 179, 61, .14);
    --bad: #f0606d; --bad-soft: rgba(240, 96, 109, .14); --info: #5aa0f5; --info-soft: rgba(90, 160, 245, .14);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 10px 26px rgba(0,0,0,.35); --shadow-lg: 0 24px 50px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f17; --surface: #151824; --surface-2: #191c2a; --surface-3: #1f2333;
  --ink: #e9ebf5; --ink-2: #a6abc2; --ink-3: #737992;
  --line: #242839; --line-2: #2f3449;
  --accent: #7c83ff; --accent-2: #a78bfa; --accent-soft: rgba(124, 131, 255, .14); --accent-ring: rgba(124, 131, 255, .3);
  --ok: #35c98d; --ok-soft: rgba(53, 201, 141, .14); --warn: #f2b33d; --warn-soft: rgba(242, 179, 61, .14);
  --bad: #f0606d; --bad-soft: rgba(240, 96, 109, .14); --info: #5aa0f5; --info-soft: rgba(90, 160, 245, .14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 10px 26px rgba(0,0,0,.35); --shadow-lg: 0 24px 50px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.5;
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent);
          backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .06em; color: var(--ink); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
              display: grid; place-items: center; color: #fff; font-size: 14px; box-shadow: var(--shadow-sm); }
.brand small { font-weight: 600; color: var(--ink-3); letter-spacing: .02em; font-size: 11px; }
.studio-tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.studio-tabs a { padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; display: flex; gap: 7px; align-items: center; }
.studio-tabs a:hover { color: var(--ink); text-decoration: none; }
.studio-tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.topnav { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.topnav > a { color: var(--ink-2); font-weight: 600; padding: 7px 10px; border-radius: 9px; font-size: 13.5px; }
.topnav > a:hover, .topnav > a.active { color: var(--ink); background: var(--surface-3); text-decoration: none; }
.credit-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft);
               color: var(--accent); font-weight: 700; font-size: 13px; border: 1px solid transparent; }
.credit-pill:hover { text-decoration: none; border-color: var(--accent-ring); }
.credit-pill .held { color: var(--ink-3); font-weight: 600; }
.credit-pill.low { background: var(--warn-soft); color: var(--warn); }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line);
            background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--line);
              border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; z-index: 60; }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--ink);
              background: none; border: 0; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-3); text-decoration: none; }
.menu-panel .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-panel .who { padding: 8px 12px 10px; font-size: 12.5px; color: var(--ink-3); }
.mobile-only { display: none; }
@media (max-width: 860px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .studio-tabs { order: 3; width: 100%; justify-content: space-between; }
  .studio-tabs a { flex: 1; justify-content: center; padding: 7px 6px; }
  .topnav > a.hide-sm { display: none; }
  .brand small { display: none; }
}

.banner { max-width: 1320px; margin: 14px auto 0; padding: 10px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* ---------- page ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 6px; }
@media (max-width: 560px) { .page { padding: 18px 16px 50px; } h1 { font-size: 22px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-body { padding: 18px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; margin-bottom: 8px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2);
       background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .12s; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px var(--accent-ring); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn.buy { background: linear-gradient(135deg, var(--buy-a), var(--buy-b)); color: #2b1a00; border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 13px 20px; font-size: 15.5px; border-radius: 12px; }
.btn.block { width: 100%; }

/* ---------- forms ---------- */
label.field, .field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url],
input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 12px; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; background: var(--line-2); border-radius: 999px; position: relative; transition: .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 18px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-ring); }
.form-error { color: var(--bad); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
         background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok, .st-COMPLETED, .st-ACTIVE, .st-VALID { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .st-QUEUED, .st-SUBMITTING, .st-PENDING_APPROVAL, .st-PENDING_VERIFICATION, .st-UNTESTED, .st-DEPRECATED { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .st-FAILED, .st-TIMED_OUT, .st-SUSPENDED, .st-INVALID, .st-REVOKED, .st-RETIRED { background: var(--bad-soft); color: var(--bad); }
.badge.info, .st-PROCESSING { background: var(--info-soft); color: var(--info); }
.st-CANCELLED, .st-DELETED { background: var(--surface-3); color: var(--ink-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- studio ---------- */
.studio { display: grid; grid-template-columns: minmax(380px, 470px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .studio { grid-template-columns: 1fr; } }
.composer { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow: auto; }
@media (max-width: 1000px) { .composer { position: static; max-height: none; } }
.composer .card-body { display: flex; flex-direction: column; gap: 16px; }
.model-picker { position: relative; }
.model-current { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px;
                 background: var(--surface-2); cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.model-current:hover { border-color: var(--accent); }
.model-current .chev { margin-left: auto; color: var(--ink-3); }
.model-avatar { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
                background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.model-avatar.t-FAST { background: linear-gradient(135deg, #0ea5e9, #22c55e); }
.model-avatar.t-BUDGET { background: linear-gradient(135deg, #64748b, #94a3b8); }
.model-avatar.t-STANDARD { background: linear-gradient(135deg, #6366f1, #0ea5e9); }
.model-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
              border-radius: 14px; box-shadow: var(--shadow-lg); max-height: 440px; overflow: auto; padding: 6px; }
.model-option { display: flex; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; align-items: flex-start; }
.model-option:hover, .model-option.sel { background: var(--surface-3); }
.model-option.off { opacity: .55; cursor: not-allowed; }
.model-option .name { font-weight: 650; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.model-option .desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.model-option .price { font-size: 12px; color: var(--accent); font-weight: 650; margin-top: 4px; }
.model-filter { position: sticky; top: -6px; background: var(--surface); padding: 6px 4px 8px; z-index: 1; }
.cost-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); }
.cost-bar .cost { font-size: 20px; font-weight: 800; }
.cost-bar .cost small { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-left: 4px; }
.cost-bar .detail { font-size: 12px; color: var(--ink-3); }
.cost-bar.insufficient .cost { color: var(--bad); }
.counter { font-size: 12px; color: var(--ink-3); text-align: right; }
.counter.over { color: var(--bad); font-weight: 700; }
.adv-toggle { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; padding: 0; font-size: 13px; }

.upload-slot { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--surface-2); }
.upload-slot.drag { border-color: var(--accent); background: var(--accent-soft); }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: shimmer 1.2s infinite; }
.add-file { width: 74px; height: 74px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-3); font-size: 22px; }
.add-file:hover { color: var(--accent); border-color: var(--accent); }

/* voices */
.voice-tools { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .voice-tools { grid-template-columns: 1fr 1fr; } .voice-tools input { grid-column: 1 / -1; } }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 330px; overflow: auto; padding: 2px; }
.voice-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; position: relative; }
.voice-card:hover { border-color: var(--line-2); }
.voice-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
.voice-card .vn { font-weight: 700; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.voice-card .vl { font-size: 11.5px; color: var(--ink-3); }
.voice-card .vd { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.play { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 10px; color: var(--accent); flex: none; }
.play.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* results feed */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-empty { padding: 50px 20px; text-align: center; color: var(--ink-3); border: 1.5px dashed var(--line-2); border-radius: var(--r); }
.feed-empty .big { font-size: 34px; margin-bottom: 8px; }
.job { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.job-head { padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.job-head .meta { font-size: 12.5px; color: var(--ink-3); }
.job-prompt { padding: 10px 16px 0; color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.job-body { padding: 14px 16px 16px; }
.job-error { color: var(--bad); font-size: 13.5px; background: var(--bad-soft); padding: 10px 12px; border-radius: 10px; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .6s; }
.progress.indet > i { width: 35% !important; animation: indet 1.4s infinite ease-in-out; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.media-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.media-grid.one { grid-template-columns: 1fr; }
.media { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.media img, .media video { display: block; width: 100%; height: auto; max-height: 560px; object-fit: contain; background: #0b0d14; }
.media .media-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; opacity: 0; transition: .15s; }
.media:hover .media-actions, .media:focus-within .media-actions { opacity: 1; }
.media-actions a, .media-actions button { background: rgba(10, 12, 20, .72); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.media-actions a:hover { text-decoration: none; background: rgba(10,12,20,.9); }
audio { width: 100%; }
.expired { padding: 18px; color: var(--ink-3); font-size: 13px; text-align: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700;
          padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); font-weight: 650; }
.neg { color: var(--bad); font-weight: 650; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 140px; }
.filters .field.wide { min-width: 220px; flex: 1; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; gap: 10px; font-size: 13px; color: var(--ink-2); }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }

/* ---------- stats ---------- */
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.balance-hero { display: flex; gap: 28px; align-items: flex-end; flex-wrap: wrap; }
.balance-hero .big { font-size: 44px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- pricing packages ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { padding: 22px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan.featured { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.plan .price { font-size: 34px; font-weight: 800; }
.plan .credits { font-weight: 700; color: var(--accent); }
.plan ul { margin: 0; padding-left: 18px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }
.plan > .btn:last-child { margin-top: auto; }   /* buy button pinned to the bottom so all cards line up */
.plan .ribbon { position: absolute; top: -11px; right: 16px; z-index: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2));
               color: var(--accent-ink); padding: 3px 10px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }

/* ---------- 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 { background: radial-gradient(1200px 600px at 10% 0%, rgba(139,92,246,.35), transparent 60%),
            radial-gradient(900px 500px at 90% 100%, rgba(91,99,240,.4), transparent 60%), #0e1020;
            color: #e9ebf5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 34px; line-height: 1.15; max-width: 460px; font-weight: 800; letter-spacing: -.02em; }
.auth-art p { color: #b9bdd6; max-width: 440px; margin-top: 14px; font-size: 15.5px; }
.auth-points { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.auth-points span { padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 600; }
.auth-main { display: grid; place-items: center; padding: 40px 20px; position: relative; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 22px; }
.auth-foot { margin-top: 18px; font-size: 13.5px; color: var(--ink-2); text-align: center; }
.code-input { letter-spacing: .5em; font-size: 24px !important; text-align: center; font-weight: 700; }
.theme-float { position: absolute; top: 18px; right: 18px; }

/* ---------- toasts / modal ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-back { position: fixed; inset: 0; background: rgba(8, 10, 18, .55); z-index: 150; display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal.wide { max-width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.admin-side { border-right: 1px solid var(--line); background: var(--surface); padding: 16px 10px; position: sticky; top: 62px; height: calc(100vh - 62px); overflow: auto; }
.admin-side a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.admin-side a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.admin-side a.active { background: var(--accent-soft); color: var(--accent); }
.admin-side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; padding: 14px 12px 6px; }
.admin-main { padding: 24px 26px 60px; min-width: 0; }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .admin-side .grp { display: none; }
  .admin-main { padding: 18px 16px 50px; }
}
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
pre.json { background: var(--surface-3); border-radius: 10px; padding: 12px; overflow: auto; font-size: 12px; max-height: 340px; margin: 0; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 220px; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.chart { width: 100%; height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 650; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.issue { color: var(--warn); font-size: 12.5px; }
.secret-note { font-size: 12.5px; color: var(--ink-2); background: var(--info-soft); padding: 10px 12px; border-radius: 10px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { padding: 40px; text-align: center; color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- admin: user creations gallery ---------- */
.creations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.creation { overflow: hidden; display: flex; flex-direction: column; }
.creation-outputs { display: grid; gap: 2px; background: var(--surface-3); }
.creation-outputs.multi { grid-template-columns: 1fr 1fr; }
.creation-media { display: block; aspect-ratio: 16 / 10; background: var(--surface-3); overflow: hidden; }
.creation-media img, .creation-media video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.creation-media img { background: var(--surface-3); }
.creation-media.audio { aspect-ratio: auto; padding: 22px 12px; display: flex; align-items: center;
  background: linear-gradient(135deg, var(--accent-soft), transparent); }
.creation-media.audio audio { width: 100%; }
.creation-media.expired { display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; aspect-ratio: auto; padding: 28px 12px; }
.creation-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.creation-prompt { font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
