:root {
  --ink: #15171d;
  --muted: #69707f;
  --line: #dde2e8;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --rose: #c8526f;
  --rose-dark: #9f334f;
  --teal: #0e7c77;
  --gold: #c09345;
  --blue: #37688f;
  --shadow: 0 18px 50px rgba(22, 27, 35, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f5;
  font-size: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding-left: 200px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 200px;
  padding: 20px 0;
  border-right: 1px solid var(--line);
  background: #fff;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(221, 226, 232, 0.86);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 0 18px 22px;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--teal));
  box-shadow: none;
  font-size: 14px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
}

.brand strong {
  color: #242b3a;
  font-size: 14px;
  font-weight: 900;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.side-nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  color: #242b3a;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.side-nav button:hover {
  background: #f5f7fb;
}

.side-nav button.active {
  color: #5d83ff;
  background: #edf3ff;
}

.side-nav button.active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: #5d83ff;
}

.nav-icon {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  color: #707070;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.side-nav button.active .nav-icon {
  color: #5d83ff;
}

.page-title {
  color: #2d3541;
  font-size: 14px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.points-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #cfd6df;
  border-radius: 999px;
  color: var(--teal);
  background: #eef8f6;
  font-size: 12px;
  font-weight: 900;
}

.primary,
.secondary,
.ghost,
.icon-button,
.quick-prompts button,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary {
  padding: 8px 14px;
  color: #fff;
  background: var(--rose);
  box-shadow: 0 10px 24px rgba(200, 82, 111, 0.24);
  font-weight: 700;
}

.primary:hover {
  background: var(--rose-dark);
  transform: translateY(-1px);
}

.secondary {
  padding: 8px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
}

.ghost {
  padding: 6px 10px;
  color: #394150;
  background: var(--soft);
  border: 1px solid var(--line);
}

.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}

.full {
  width: 100%;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  color: #3c4450;
  background: #fff;
  border: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-section {
  padding: 18px 18px;
}

.gallery-section {
  padding: 18px 18px;
}

.admin-section {
  padding: 18px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.workspace,
.competitor-workspace {
  display: grid;
  max-width: 1680px;
  margin: 0 auto;
  grid-template-columns: minmax(290px, 0.9fr) minmax(390px, 1.14fr) minmax(320px, 0.96fr);
  gap: 12px;
  align-items: start;
}

.video-workspace {
  display: grid;
  max-width: 1680px;
  margin: 0 auto;
  grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 12px;
  align-items: start;
}

.control-panel,
.prompt-panel,
.result-panel,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.result-panel {
  padding: 10px;
}

.control-panel {
  align-self: start;
  overflow: hidden;
}

.prompt-panel {
  padding: 10px;
}

.panel-section {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-weight: 800;
}

.section-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.product-title {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.product-title span {
  font-size: 10px;
  font-weight: 700;
}

.section-note {
  margin: -4px 0 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}

.danger-note {
  color: #c23b3b;
}

.upload-zone {
  display: grid;
  min-height: 128px;
  place-items: center;
  padding: 16px;
  border: 1px dashed #b9c2ce;
  border-radius: 8px;
  color: #3a4350;
  background: #f9fafc;
  cursor: pointer;
  text-align: center;
}

.upload-empty,
.upload-thumb {
  display: grid;
  place-items: center;
}

.upload-zone input {
  display: none;
}

.upload-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 8px;
  color: var(--teal);
  background: #e5f3f1;
}

.upload-zone small {
  color: var(--muted);
}

.upload-thumb {
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.upload-thumb img {
  display: block;
  width: min(140px, 70%);
  max-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  cursor: zoom-in;
}

.preview-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 9px;
}

.ghost.danger {
  color: #b94242;
  background: #fff5f5;
}

.hidden {
  display: none !important;
}

.field-label {
  display: grid;
  gap: 6px;
  color: #303844;
  font-size: 12px;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cfd6df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 84px;
  padding: 9px;
  resize: vertical;
  line-height: 1.7;
}

input,
select {
  min-height: 34px;
  padding: 0 10px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 124, 119, 0.12);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 10px;
}

.quick-prompts button {
  min-height: 26px;
  padding: 4px 7px;
  color: #41505f;
  background: #eef3f4;
  font-size: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.segmented button {
  min-height: 34px;
  border: 1px solid var(--line);
  color: #45505e;
  background: #fff;
}

.segmented button.active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.range-row,
.switch-row,
.counter-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  color: #33404e;
  font-size: 12px;
  font-weight: 700;
}

.switch-row,
.counter-row {
  grid-template-columns: 1fr auto;
}

.switch-row input {
  width: 38px;
  accent-color: var(--teal);
}

.counter-row select {
  width: 100px;
}

.prompt-card {
  padding: 10px;
  box-shadow: none;
}

.prompt-panel .prompt-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

#promptEditor {
  min-height: 210px;
}

#competitorPromptEditor {
  min-height: 520px;
}

.competitor-hint {
  min-height: 520px;
  padding: 24px;
  text-align: center;
}

.generation-settings {
  display: grid;
  gap: 9px;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.generation-settings .section-title {
  margin-bottom: 0;
}

.generate-button {
  margin-top: 9px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
  font-weight: 800;
}

.result-header h3 {
  margin: 0;
  font-size: inherit;
  letter-spacing: 0;
}

#taskStatus {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #e9f0f5;
  font-size: 11px;
  font-weight: 800;
}

.result-grid {
  display: grid;
  gap: 10px;
}

.result-grid {
  min-height: 340px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 290px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed #b9c2ce;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
}

.empty-state svg {
  width: 38px;
  height: 38px;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-card {
  position: relative;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--image-ratio, 4 / 5);
  background: #f8fafb;
  object-fit: contain;
  cursor: zoom-in;
}

.image-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 7px;
}

.image-actions button {
  flex: 1;
}

.favorite-grid {
  display: grid;
  max-width: 1680px;
  margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.favorite-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.favorite-image-wrap {
  position: relative;
  background: #f8fafb;
}

.favorite-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--image-ratio, 4 / 5);
  background: #f8fafb;
  object-fit: contain;
  cursor: zoom-in;
}

.favorite-image-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 12px;
  color: #9a3f3f;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  background: #fff5f5;
}

.favorite-card.image-missing img {
  opacity: 0;
}

.favorite-card.image-missing .favorite-image-error {
  display: grid;
}

.favorite-body {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.favorite-body small {
  color: var(--muted);
  line-height: 1.5;
}

.favorite-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 5px;
}

.video-favorite-list {
  display: grid;
  max-height: 420px;
  gap: 8px;
  overflow: auto;
}

.video-favorite-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.video-favorite-item img {
  width: 52px;
  height: 64px;
  border-radius: 6px;
  background: #f8fafb;
  object-fit: cover;
}

.video-favorite-item span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-empty {
  min-height: 120px;
}

.video-card #videoPrompt {
  min-height: 260px;
}

.video-result {
  display: grid;
  min-height: 420px;
}

.video-output-card {
  display: grid;
  gap: 10px;
}

.video-output-card video {
  width: 100%;
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.video-output-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.library-toolbar h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.library-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.library-block {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.video-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.video-library-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.video-library-media {
  display: grid;
  min-height: 140px;
  background: #f8fafb;
}

.video-library-media video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  object-fit: contain;
}

.video-loading {
  min-height: 420px;
}

.danger-action {
  color: #b42318;
}

.prompt-dialog {
  width: min(720px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.recharge-dialog {
  width: min(560px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.support-dialog {
  width: min(460px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.recharge-dialog::backdrop,
.support-dialog::backdrop {
  background: rgba(15, 18, 24, 0.45);
}

.support-message {
  margin: 10px 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.support-wechat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.support-wechat span {
  color: var(--muted);
  font-weight: 800;
}

.support-wechat strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.image-dialog {
  width: min(92vw, 980px);
  max-height: 92vh;
  padding: 42px 14px 14px;
  border: 0;
  border-radius: 8px;
  background: #111318;
  box-shadow: var(--shadow);
}

.image-dialog::backdrop {
  background: rgba(15, 18, 24, 0.72);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 64px);
  object-fit: contain;
}

.image-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background: #eef2f5;
}

.auth-screen.active {
  display: grid;
}

.auth-card {
  display: grid;
  width: min(380px, 100%);
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-logo {
  margin-bottom: 12px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #f1f4f7;
}

.auth-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.auth-tabs button.active {
  color: #fff;
  background: var(--teal);
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.price-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.price-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.price-card strong,
.price-card span {
  display: block;
}

.price-card span {
  color: var(--muted);
  font-size: 12px;
}

.pay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pay-actions .primary {
  min-height: 34px;
  padding: 8px 12px;
}

.admin-shell {
  max-width: 1320px;
  margin: 0 auto;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-head h2,
.admin-head p {
  margin: 0;
}

.admin-head h2 {
  font-size: 18px;
}

.admin-head p {
  margin-top: 4px;
  color: var(--muted);
}

.admin-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: min(760px, 100%);
}

.admin-tools label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.admin-tools input {
  min-width: 240px;
}

.admin-tools input[type="date"] {
  min-width: 132px;
}

.admin-dashboard {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.referral-shell {
  display: grid;
  max-width: 1120px;
  margin: 0 auto;
  gap: 12px;
}

.referral-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.referral-code-box,
.referral-link-box,
.referral-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.referral-code-box {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafb;
}

.referral-code-box span,
.referral-link-box span,
.referral-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.referral-code-box strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  letter-spacing: 1px;
}

.referral-link-box input {
  flex: 1;
  min-width: 0;
}

.referral-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.referral-list {
  display: grid;
  gap: 8px;
}

.referral-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.referral-row > div:last-child {
  text-align: right;
}

.admin-dashboard:empty {
  display: none;
}

.admin-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-dashboard-head strong {
  font-size: 16px;
}

.admin-dashboard-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-stat-card {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.admin-stat-card span,
.admin-stat-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-stat-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.admin-grid {
  display: grid;
  gap: 10px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table th {
  color: var(--muted);
  background: #fbfcfd;
  font-weight: 900;
}

.admin-table tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.admin-table tbody tr:hover {
  background: #f4f8fb;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-account {
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.admin-account strong,
.admin-account small {
  display: block;
}

.admin-account small,
.admin-compact-note {
  color: var(--muted);
  font-size: 12px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #e9f0f5;
  font-size: 11px;
  font-weight: 900;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-row-actions input {
  width: 72px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
}

.admin-log {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.prompt-dialog::backdrop {
  background: rgba(15, 18, 24, 0.45);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-head {
  margin-bottom: 10px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

#savedPromptViewer {
  min-height: 320px;
}

.loading-tile {
  display: grid;
  min-height: 220px;
  aspect-ratio: var(--image-ratio, 4 / 5);
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(110deg, #f2f4f7 8%, #ffffff 18%, #f2f4f7 33%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  color: var(--muted);
  font-weight: 800;
}

@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  background: rgba(21, 23, 29, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1060px) {
  body {
    padding-left: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 0;
  }

  .brand {
    padding: 0 14px 12px;
  }

  .side-nav button {
    justify-content: center;
    min-height: 46px;
    padding: 0 12px;
    font-size: 12px;
  }

  .workspace,
  .competitor-workspace {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }

  .result-panel {
    grid-column: 1 / -1;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 10px 14px;
  }

  .brand {
    min-width: 0;
  }

  .top-actions .primary {
    display: none;
  }

  .admin-dashboard-head,
  .admin-head,
  .admin-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-tools input,
  .admin-stat-grid {
    width: 100%;
  }

  .admin-stat-grid {
    grid-template-columns: 1fr;
  }

  .video-workspace {
    grid-template-columns: 1fr;
  }

  .workspace-section,
  .gallery-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .favorite-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .workspace,
  .competitor-workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    grid-column: auto;
  }

  .workspace-section,
  .gallery-section {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-head,
  .admin-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-tools input {
    min-width: 0;
  }
}
