@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --page: #061613;
  --surface: rgba(12, 34, 30, .78);
  --surface-strong: #0c211e;
  --surface-soft: rgba(20, 52, 46, .72);
  --surface-hover: rgba(32, 78, 68, .64);
  --ink: #f4fbf8;
  --text: #d7e3df;
  --muted: #8ca19b;
  --muted-2: #647a74;
  --line: rgba(214, 255, 240, .1);
  --line-strong: rgba(79, 234, 188, .28);
  --primary: #13d6a3;
  --primary-2: #0da5ba;
  --gold: #ffc857;
  --danger: #ff5b7d;
  --success: #20e0a4;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 28px 90px rgba(0, 0, 0, .42);
  --glow: 0 20px 60px rgba(19, 214, 163, .25);
  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-sans: Inter, system-ui, sans-serif;
}

:root[data-theme="light"] {
  --page: #f3f8f6;
  --surface: rgba(255, 255, 255, .84);
  --surface-strong: #ffffff;
  --surface-soft: rgba(235, 244, 240, .9);
  --surface-hover: rgba(219, 238, 232, .9);
  --ink: #10221e;
  --text: #344942;
  --muted: #667e76;
  --muted-2: #82968f;
  --line: rgba(16, 34, 30, .1);
  --line-strong: rgba(13, 165, 186, .25);
  --shadow: 0 22px 70px rgba(27, 57, 51, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
.is-hidden { display: none !important; }
body {
  min-height: 100vh;
  background:
    radial-gradient(60rem 40rem at 12% -10%, rgba(19, 214, 163, .18), transparent 60%),
    radial-gradient(50rem 35rem at 95% 0%, rgba(255, 200, 87, .12), transparent 55%),
    radial-gradient(40rem 30rem at 50% 110%, rgba(13, 165, 186, .18), transparent 60%),
    var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, textarea, select, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(8, 22, 20, .72);
  backdrop-filter: blur(22px);
}
:root[data-theme="light"] .sidebar { background: rgba(255,255,255,.66); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #050606;
  box-shadow:
    0 0 0 1px rgba(142, 255, 92, .3),
    0 0 18px rgba(127, 255, 83, .22),
    0 14px 34px rgba(40, 255, 118, .16);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1;
}
.brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list { display: grid; gap: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  transition: .18s ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #06211a;
  box-shadow: var(--glow);
}
.nav-item span {
  margin-left: auto;
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255,255,255,.08);
  color: currentColor;
  text-align: center;
  font-size: 11px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 16px);
  margin: 2px 8px 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}
.theme-toggle__track {
  position: relative;
  display: grid;
  width: 54px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}
.theme-toggle__track::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  transition: transform .2s ease;
}
.theme-toggle[data-theme="light"] .theme-toggle__track::before { transform: translateX(26px); }
.theme-toggle__icon { position: absolute; z-index: 1; color: var(--muted); top: 6px; }
.theme-toggle__icon--moon { left: 7px; }
.theme-toggle__icon--sun { right: 7px; }
.theme-toggle__label { font-size: 12px; }

.sidebar-token-card {
  display: grid;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(19, 214, 163, .13), rgba(255, 200, 87, .06)),
    var(--surface-soft);
  color: var(--text);
  text-align: left;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.sidebar-token-card:hover {
  transform: translateY(-1px);
  border-color: rgba(19, 214, 163, .55);
  box-shadow: var(--glow);
}
.sidebar-token-card.is-active {
  border-color: rgba(32, 224, 164, .5);
}
.sidebar-token-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar-token-card strong {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
}
.sidebar-token-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.daily-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: var(--surface-soft);
}
.daily-card span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.daily-card span::after {
  content: 'Ativo';
  color: var(--primary);
  letter-spacing: 0;
  text-transform: none;
}
.daily-card strong {
  display: block;
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 34px;
}
.daily-card small, .daily-card p { color: var(--muted); }
.daily-card p { margin-top: 20px; font-size: 11px; text-align: center; }

.workspace {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 0 28px 80px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -28px;
  padding: 16px 28px;
  border-top: 0;
  border-radius: 0 0 18px 18px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}
.crumb strong { color: var(--ink); }
.top-generate, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #06211a;
  font-weight: 900;
  box-shadow: var(--glow);
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
  animation: soft-pulse 3.8s ease-in-out infinite;
}
.top-generate:hover, .primary-button:hover { transform: translateY(-1px); box-shadow: 0 18px 34px rgba(18, 190, 210, .24); }
.primary-button:disabled { opacity: .65; cursor: wait; transform: none; }
.primary-button.is-disabled { pointer-events: none; opacity: .45; }

.hero { padding: 34px 0 26px; }
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.online-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 7px rgba(19,214,163,.12);
}
.hero h1 {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  line-height: .98;
  letter-spacing: -.04em;
}
.hero h1 span {
  background: linear-gradient(135deg, #ffe184, #ffaf37);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 760px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 34px;
}
.stat-card {
  border-radius: 20px;
  padding: 20px;
}
.stat-card.is-accent { border-color: var(--line-strong); box-shadow: var(--glow); }
.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 30px;
}
.stat-card small { color: var(--muted); }

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr);
  gap: 28px;
  align-items: start;
}
.studio-panel, .preview-panel {
  border-radius: 28px;
  padding: 28px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.panel-head p, .library-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.panel-head h2, .library-head h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.presets { margin-bottom: 18px; }
.presets p {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.presets svg { color: var(--gold); }
.presets > div { display: flex; flex-wrap: wrap; gap: 9px; }
.preset-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255,255,255,.02);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  transition: .18s ease;
}
.preset-chip:hover { border-color: var(--line-strong); color: var(--ink); background: rgba(19,214,163,.08); }

.field-label, .form-grid label span, .token-field span, .admin-form label span, .modal-card label span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}
.prompt-wrap { position: relative; }
textarea, select, input[type="search"], input[type="password"], input[type="text"], input[type="email"], input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.16);
  color: var(--ink);
  outline: 0;
  transition: .18s ease;
}
:root[data-theme="light"] textarea,
:root[data-theme="light"] select,
:root[data-theme="light"] input[type="search"],
:root[data-theme="light"] input[type="password"],
:root[data-theme="light"] input[type="email"],
:root[data-theme="light"] input[type="text"],
:root[data-theme="light"] input[type="number"] { background: rgba(255,255,255,.72); }
textarea {
  min-height: 210px;
  resize: vertical;
  padding: 16px 18px 36px;
  line-height: 1.65;
}
textarea:focus, select:focus, input[type="search"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(19,214,163,.12);
}
textarea::placeholder, input::placeholder { color: var(--muted-2); }
#charCount {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: var(--muted);
  font-size: 11px;
}

.reference-upload {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  padding: 16px;
  background: rgba(19,214,163,.05);
  transition: .18s ease;
}
.reference-upload:hover, .reference-upload.is-dragging, .reference-upload:focus-visible {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(19,214,163,.1);
}
.reference-empty { display: flex; align-items: center; gap: 12px; }
.reference-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--primary);
}
.reference-upload strong { display: block; }
.reference-upload p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}
.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.reference-preview {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: var(--surface-soft);
}
.reference-preview.is-hidden { display: none; }
.reference-preview img {
  width: 66px;
  height: 66px;
  border-radius: 12px;
  object-fit: cover;
}
.reference-preview strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-preview span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}
select {
  height: 50px;
  padding: 0 46px 0 16px;
  font-weight: 800;
  appearance: none;
  border-color: rgba(32, 224, 164, .22);
  background:
    linear-gradient(45deg, transparent 50%, var(--primary) 50%) calc(100% - 21px) 20px / 7px 7px no-repeat,
    linear-gradient(135deg, rgba(32, 224, 164, .13), rgba(19, 31, 51, .5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
select:hover {
  border-color: rgba(32, 224, 164, .55);
  box-shadow: 0 0 0 3px rgba(32, 224, 164, .08), inset 0 1px 0 rgba(255,255,255,.08);
  transform: translateY(-1px);
}
select option {
  background: #0b211b;
  color: #effff9;
  font-weight: 800;
}
::root[data-theme="light"] select {
  background:
    linear-gradient(45deg, transparent 50%, #087d68 50%) calc(100% - 21px) 20px / 7px 7px no-repeat,
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(232,249,243,.9));
}
.token-field {
  display: block;
  margin-top: 18px;
}
.token-field input,
.admin-form input {
  height: 46px;
  padding: 0 14px;
  font-weight: 800;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
#formMessage { color: var(--muted); font-size: 12px; line-height: 1.4; }

.preview-panel { position: sticky; top: 92px; }
.video-preview {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 22px;
  padding: 2px;
  background: conic-gradient(from var(--border-angle, 0deg), var(--primary), var(--gold), var(--primary-2), var(--primary));
  animation: preview-spin 5s linear infinite;
}
@property --border-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes preview-spin { to { --border-angle: 360deg; } }
.video-preview::after {
  content: '';
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: 20px;
  background: var(--preview-surface, #121615);
}
.video-preview.is-landscape { width: 100%; aspect-ratio: 16 / 9; }
.video-preview.is-portrait { width: min(100%, 290px); aspect-ratio: 9 / 16; margin-inline: auto; }
.video-preview > div {
  max-width: 260px;
  padding: 20px;
  text-align: center;
}
.video-preview strong { display: block; font-size: 16px; }
.video-preview span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.video-preview video {
  position: relative;
  z-index: 1;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  border-radius: 20px;
  object-fit: cover;
  background: #000;
}
.preview-prompt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.5;
}
.preview-actions { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; margin-top: 16px; }
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
}

.library-section { margin-top: 58px; }
.templates-section { margin-top: 58px; }
.admin-section { margin-top: 58px; }
.library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.library-title-stack {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.token-activation {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
}
.token-activation:hover {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}
.token-activation__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 7px rgba(255, 91, 125, .12);
}
.token-activation.is-active .token-activation__dot {
  background: var(--success);
  box-shadow: 0 0 0 7px rgba(32, 224, 164, .12);
}
.token-activation strong,
.token-activation small {
  display: block;
}
.token-activation strong {
  font-size: 13px;
  font-weight: 900;
}
.token-activation small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.library-tools { display: flex; gap: 10px; align-items: center; }
#searchJobs { width: 260px; height: 40px; padding: 0 12px; }
.filter-tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 4px;
  background: var(--surface);
}
.filter-tabs button {
  border: 0;
  border-radius: 10px;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.filter-tabs button.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #06211a;
}
.jobs-grid {
  display: block;
  column-count: 3;
  column-gap: 18px;
}
.job-card {
  display: inline-flex;
  flex-direction: column;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  page-break-inside: avoid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: .18s ease;
}
.job-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.job-thumb {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(19,214,163,.55), rgba(255,200,87,.45));
}
.job-thumb.is-landscape { aspect-ratio: 16 / 9; }
.job-card.is-portrait-card {
  background:
    linear-gradient(180deg, rgba(19, 214, 163, .06), transparent 44%),
    var(--surface);
}
.job-card.is-portrait-card .job-thumb {
  width: min(68%, 230px);
  aspect-ratio: 9 / 16;
  margin: 14px auto 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #020c0a;
}
.job-thumb.is-portrait { aspect-ratio: 9 / 16; max-height: none; }
.job-thumb video, .job-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.play-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(0,0,0,.48);
  color: white;
  backdrop-filter: blur(8px);
}
.job-status {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(0,0,0,.46);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}
.job-status.completed { color: var(--success); background: rgba(21, 89, 70, .74); }
.job-status.generating, .job-status.queued { color: var(--primary); }
.job-status.failed { color: var(--danger); background: rgba(85, 18, 34, .72); }
.job-meta-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(0,0,0,.46);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}
.job-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}
.job-body p {
  display: -webkit-box;
  min-height: 43px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.55;
}
.job-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.job-error {
  margin-top: 12px;
  border: 1px solid rgba(255,91,125,.28);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(255,91,125,.08);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
}
.job-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}
.job-actions a, .job-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}
.job-actions .danger-action {
  border-color: rgba(255, 91, 125, .28);
  color: #ff9aae;
  background: rgba(255, 91, 125, .08);
}
.job-actions .danger-action:hover {
  border-color: rgba(255, 91, 125, .48);
  background: rgba(255, 91, 125, .14);
}
.empty-state {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 46px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(14px);
}
.modal-card {
  position: relative;
  width: min(100%, 480px);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  padding: 26px;
  background: var(--surface-strong);
  box-shadow: var(--shadow), var(--glow);
}
.danger-card {
  border-color: rgba(255, 91, 125, .42);
  box-shadow: var(--shadow), 0 20px 70px rgba(255, 91, 125, .14);
}
.danger-card .modal-kicker {
  color: var(--danger);
}
.auth-card { width: min(100%, 520px); }
.modal-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.modal-card h2 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.08;
}
.modal-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.modal-card form,
.modal-card label {
  display: grid;
  gap: 12px;
}
.modal-card form { margin-top: 18px; }
.modal-card label { gap: 7px; }
.modal-card input {
  height: 48px;
  padding: 0 14px;
  font-weight: 800;
}
.modal-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.modal-message[data-kind="success"] { color: var(--success); }
.modal-message[data-kind="error"] { color: var(--danger); }
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
}
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(255, 91, 125, .42);
  border-radius: 13px;
  padding: 0 18px;
  background: linear-gradient(135deg, #ff5b7d, #c92d52);
  color: #fff;
  font-weight: 900;
}
.danger-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  min-height: 36px;
}
.text-button:hover { color: var(--ink); }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 30px;
}
.auth-shell {
  width: min(100%, 1120px);
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(360px, 430px);
  gap: 72px;
  align-items: center;
  justify-content: center;
}
.auth-intro {
  display: grid;
  align-content: center;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 46px;
}
.auth-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
}
.auth-brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.auth-copy span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.auth-copy h1 {
  max-width: 620px;
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(44px, 5vw, 68px);
  line-height: 1;
}
.auth-copy p {
  max-width: 560px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}
.auth-form {
  width: 100%;
  display: grid;
  gap: 16px;
  border-radius: 28px;
  padding: 26px;
}
.auth-form label span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}
.auth-form input {
  height: 50px;
  padding: 0 14px;
  font-weight: 800;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 5px;
  background: var(--surface-soft);
}
.auth-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.auth-tabs button.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #06211a;
}

.template-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.template-card {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(19,214,163,.08), rgba(255,200,87,.04)),
    var(--surface);
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}
.template-card span {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(19,214,163,.12);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.template-card h3 {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: 23px;
}
.template-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.provider-grid,
.model-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.admin-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 26px;
  padding: 28px;
}
.admin-hero p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-hero h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 56px);
}
.admin-hero span {
  display: block;
  max-width: 640px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}
.admin-panel {
  margin-top: 24px;
  border-radius: 26px;
  padding: 24px;
}
.admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
}
.provider-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 150px minmax(220px, 1fr) auto;
}
.admin-message {
  min-height: 20px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.admin-message[data-kind="error"] {
  color: var(--danger);
}
.token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.token-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.token-card.active { border-color: rgba(32, 224, 164, .35); }
.token-card.paused { border-color: rgba(255, 200, 87, .35); }
.token-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,.16);
}
.token-value code {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-value button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
}
.token-meter {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.token-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.provider-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.provider-card.active { border-color: rgba(32, 224, 164, .35); }
.provider-card.paused,
.provider-card.quota_exceeded,
.provider-card.depleted,
.provider-card.auth_error,
.provider-card.permission_error,
.provider-card.error { border-color: rgba(255, 91, 125, .35); }
.provider-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.provider-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.provider-card h3 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 20px;
}
.model-admin-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(145deg, rgba(9, 41, 34, .9), rgba(12, 31, 47, .72));
  box-shadow: var(--shadow);
}
.model-admin-card.active { border-color: rgba(32, 224, 164, .45); }
.model-admin-card.paused { opacity: .72; border-color: rgba(255, 91, 125, .4); }
.model-admin-card span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.model-admin-card h3 {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 21px;
}
.model-admin-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}
.model-admin-card button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(32, 224, 164, .09);
  color: var(--ink);
  font-weight: 900;
}
.model-admin-card button:hover {
  border-color: rgba(32, 224, 164, .5);
  background: rgba(32, 224, 164, .16);
}
.provider-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.provider-status.active {
  background: rgba(32, 224, 164, .14);
  color: var(--success);
}
.provider-status.paused {
  background: rgba(255, 200, 87, .14);
  color: var(--gold);
}
.provider-status.quota_exceeded,
.provider-status.depleted,
.provider-status.auth_error,
.provider-status.permission_error,
.provider-status.error,
.provider-status.request_error {
  background: rgba(255, 91, 125, .14);
  color: var(--danger);
}
.provider-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.provider-stats dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.provider-stats dd {
  overflow: hidden;
  margin-top: 4px;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.provider-error,
.provider-muted {
  margin-top: 14px;
  border-radius: 13px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}
.provider-error {
  border: 1px solid rgba(255,91,125,.28);
  background: rgba(255,91,125,.08);
  color: var(--danger);
}
.provider-muted {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
}
.provider-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.provider-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
}
.provider-actions span {
  color: var(--muted);
  font-size: 12px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(18, 190, 210, .13); }
  50% { box-shadow: 0 16px 38px rgba(32, 224, 164, .24); }
}
.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,.02), rgba(19,214,163,.18), rgba(255,255,255,.02));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

@media (max-width: 1120px) {
  .studio-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .jobs-grid, .provider-grid, .model-admin-grid, .template-grid, .token-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jobs-grid { column-count: 2; }
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; gap: 28px; }
  .auth-brand { margin-bottom: 24px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .brand { padding-bottom: 4px; }
  .nav-list { display: flex; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .theme-toggle { width: auto; margin-left: auto; }
  .daily-card, .sidebar-token-card { display: none; }
  .workspace { padding-inline: 16px; }
  .topbar { margin-inline: -16px; padding-inline: 16px; }
  .stats-grid, .jobs-grid, .provider-grid, .model-admin-grid, .template-grid, .token-grid, .admin-form, .provider-form { grid-template-columns: 1fr; }
  .jobs-grid { column-count: 1; }
  .admin-hero { align-items: stretch; flex-direction: column; }
  .library-head, .library-tools, .library-title-stack { align-items: stretch; flex-direction: column; }
  #searchJobs { width: 100%; }
}
@media (max-width: 620px) {
  .hero h1 { font-size: 40px; }
  .studio-panel, .preview-panel { padding: 20px; border-radius: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .reference-upload { align-items: stretch; flex-direction: column; }
  .preview-actions { grid-template-columns: 1fr; }
  .filter-tabs { overflow-x: auto; }
}
